diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2010-05-16 21:11:36 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2010-08-02 01:33:38 -0400 |
commit | 17fcfbd9d45b57f38d40e31f9d28db53f4af5c88 (patch) | |
tree | e221937affe4d886706e880f39e1424333490cc0 /security/tomoyo/realpath.c | |
parent | 2106ccd972dcd9fda7df9b181505fac1741b3508 (diff) |
TOMOYO: Add interactive enforcing mode.
Since the behavior of the system is restricted by policy, we may need to update
policy when you update packages.
We need to update policy in the following cases.
* The pathname of files has changed.
* The dependency of files has changed.
* The access permissions required has increased.
The ideal way to update policy is to rebuild from the scratch using learning
mode. But it is not desirable to change from enforcing mode to other mode if
the system has once entered in production state. Suppose MAC could support
per-application enforcing mode, the MAC becomes useless if an application that
is not running in enforcing mode was cracked. For example, the whole system
becomes vulnerable if only HTTP server application is running in learning mode
to rebuild policy for the application. So, in TOMOYO Linux, updating policy is
done while the system is running in enforcing mode.
This patch implements "interactive enforcing mode" which allows administrators
to judge whether to accept policy violation in enforcing mode or not.
A demo movie is available at http://www.youtube.com/watch?v=b9q1Jo25LPA .
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: James Morris <jmorris@namei.org>
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 | } |