diff options
Diffstat (limited to 'security/tomoyo/realpath.c')
-rw-r--r-- | security/tomoyo/realpath.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c index d1b96f019621..3ceb1724c92d 100644 --- a/security/tomoyo/realpath.c +++ b/security/tomoyo/realpath.c | |||
@@ -333,6 +333,9 @@ void __init tomoyo_realpath_init(void) | |||
333 | panic("Can't register tomoyo_kernel_domain"); | 333 | panic("Can't register tomoyo_kernel_domain"); |
334 | } | 334 | } |
335 | 335 | ||
336 | unsigned int tomoyo_quota_for_query; | ||
337 | unsigned int tomoyo_query_memory_size; | ||
338 | |||
336 | /** | 339 | /** |
337 | * tomoyo_read_memory_counter - Check for memory usage in bytes. | 340 | * tomoyo_read_memory_counter - Check for memory usage in bytes. |
338 | * | 341 | * |
@@ -345,6 +348,7 @@ int tomoyo_read_memory_counter(struct tomoyo_io_buffer *head) | |||
345 | if (!head->read_eof) { | 348 | if (!head->read_eof) { |
346 | const unsigned int policy | 349 | const unsigned int policy |
347 | = atomic_read(&tomoyo_policy_memory_size); | 350 | = atomic_read(&tomoyo_policy_memory_size); |
351 | const unsigned int query = tomoyo_query_memory_size; | ||
348 | char buffer[64]; | 352 | char buffer[64]; |
349 | 353 | ||
350 | memset(buffer, 0, sizeof(buffer)); | 354 | memset(buffer, 0, sizeof(buffer)); |
@@ -354,8 +358,17 @@ int tomoyo_read_memory_counter(struct tomoyo_io_buffer *head) | |||
354 | tomoyo_quota_for_policy); | 358 | tomoyo_quota_for_policy); |
355 | else | 359 | else |
356 | buffer[0] = '\0'; | 360 | buffer[0] = '\0'; |
357 | tomoyo_io_printf(head, "Policy: %10u%s\n", policy, buffer); | 361 | tomoyo_io_printf(head, "Policy: %10u%s\n", policy, |
358 | tomoyo_io_printf(head, "Total: %10u\n", policy); | 362 | buffer); |
363 | if (tomoyo_quota_for_query) | ||
364 | snprintf(buffer, sizeof(buffer) - 1, | ||
365 | " (Quota: %10u)", | ||
366 | tomoyo_quota_for_query); | ||
367 | else | ||
368 | buffer[0] = '\0'; | ||
369 | tomoyo_io_printf(head, "Query lists: %10u%s\n", query, | ||
370 | buffer); | ||
371 | tomoyo_io_printf(head, "Total: %10u\n", policy + query); | ||
359 | head->read_eof = true; | 372 | head->read_eof = true; |
360 | } | 373 | } |
361 | return 0; | 374 | return 0; |
@@ -375,5 +388,7 @@ int tomoyo_write_memory_quota(struct tomoyo_io_buffer *head) | |||
375 | 388 | ||
376 | if (sscanf(data, "Policy: %u", &size) == 1) | 389 | if (sscanf(data, "Policy: %u", &size) == 1) |
377 | tomoyo_quota_for_policy = size; | 390 | tomoyo_quota_for_policy = size; |
391 | else if (sscanf(data, "Query lists: %u", &size) == 1) | ||
392 | tomoyo_quota_for_query = size; | ||
378 | return 0; | 393 | return 0; |
379 | } | 394 | } |