diff options
author | Al Viro <viro@ZenIV.linux.org.uk> | 2008-01-02 09:09:57 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-01-02 16:13:27 -0500 |
commit | 831830b5a2b5d413407adf380ef62fe17d6fcbf2 (patch) | |
tree | b08f54f15374b5b98b0b3bea20a1d2ea8d1f50e0 /kernel | |
parent | ac40532ef0b8649e6f7f83859ea0de1c4ed08a19 (diff) |
restrict reading from /proc/<pid>/maps to those who share ->mm or can ptrace pid
Contents of /proc/*/maps is sensitive and may become sensitive after
open() (e.g. if target originally shares our ->mm and later does exec
on suid-root binary).
Check at read() (actually, ->start() of iterator) time that mm_struct
we'd grabbed and locked is
- still the ->mm of target
- equal to reader's ->mm or the target is ptracable by reader.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Acked-by: Rik van Riel <riel@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/ptrace.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c index 7c76f2ffaeaa..0c65d306f412 100644 --- a/kernel/ptrace.c +++ b/kernel/ptrace.c | |||
@@ -120,7 +120,7 @@ int ptrace_check_attach(struct task_struct *child, int kill) | |||
120 | return ret; | 120 | return ret; |
121 | } | 121 | } |
122 | 122 | ||
123 | static int may_attach(struct task_struct *task) | 123 | int __ptrace_may_attach(struct task_struct *task) |
124 | { | 124 | { |
125 | /* May we inspect the given task? | 125 | /* May we inspect the given task? |
126 | * This check is used both for attaching with ptrace | 126 | * This check is used both for attaching with ptrace |
@@ -154,7 +154,7 @@ int ptrace_may_attach(struct task_struct *task) | |||
154 | { | 154 | { |
155 | int err; | 155 | int err; |
156 | task_lock(task); | 156 | task_lock(task); |
157 | err = may_attach(task); | 157 | err = __ptrace_may_attach(task); |
158 | task_unlock(task); | 158 | task_unlock(task); |
159 | return !err; | 159 | return !err; |
160 | } | 160 | } |