diff options
author | Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp> | 2010-06-24 01:57:16 -0400 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2010-08-02 01:34:45 -0400 |
commit | f23571e866309a2048030ef6a5f0725cf139d4c9 (patch) | |
tree | 0116bcef462f367307b2db927b249b7ce21039c2 /security/tomoyo/memory.c | |
parent | 5db5a39b6462c8360c9178b28f4b07c320dfca1c (diff) |
TOMOYO: Copy directly to userspace buffer.
When userspace program reads policy from /sys/kernel/security/tomoyo/
interface, TOMOYO uses line buffered mode. A line has at least one word.
Commit 006dacc "TOMOYO: Support longer pathname." changed a word's max length
from 4000 bytes to max kmalloc()able bytes. By that commit, a line's max length
changed from 8192 bytes to more than max kmalloc()able bytes.
Max number of words in a line remains finite. This patch changes the way of
buffering so that all words in a line are firstly directly copied to userspace
buffer as much as possible and are secondly queued for next read request.
Words queued are guaranteed to be valid until /sys/kernel/security/tomoyo/
interface is close()d.
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/memory.c')
-rw-r--r-- | security/tomoyo/memory.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/security/tomoyo/memory.c b/security/tomoyo/memory.c index 95a77599ff98..a4aba4d9ca2e 100644 --- a/security/tomoyo/memory.c +++ b/security/tomoyo/memory.c | |||
@@ -234,7 +234,7 @@ unsigned int tomoyo_quota_for_query; | |||
234 | */ | 234 | */ |
235 | void tomoyo_read_memory_counter(struct tomoyo_io_buffer *head) | 235 | void tomoyo_read_memory_counter(struct tomoyo_io_buffer *head) |
236 | { | 236 | { |
237 | if (!head->read_eof) { | 237 | if (!head->r.eof) { |
238 | const unsigned int policy | 238 | const unsigned int policy |
239 | = atomic_read(&tomoyo_policy_memory_size); | 239 | = atomic_read(&tomoyo_policy_memory_size); |
240 | const unsigned int query = tomoyo_query_memory_size; | 240 | const unsigned int query = tomoyo_query_memory_size; |
@@ -258,7 +258,7 @@ void tomoyo_read_memory_counter(struct tomoyo_io_buffer *head) | |||
258 | tomoyo_io_printf(head, "Query lists: %10u%s\n", query, | 258 | tomoyo_io_printf(head, "Query lists: %10u%s\n", query, |
259 | buffer); | 259 | buffer); |
260 | tomoyo_io_printf(head, "Total: %10u\n", policy + query); | 260 | tomoyo_io_printf(head, "Total: %10u\n", policy + query); |
261 | head->read_eof = true; | 261 | head->r.eof = true; |
262 | } | 262 | } |
263 | } | 263 | } |
264 | 264 | ||