summaryrefslogtreecommitdiffstats
path: root/kernel/ptrace.c
diff options
context:
space:
mode:
authorAl Viro2008-01-02 15:09:57 +0100
committerLinus Torvalds2008-01-02 22:13:27 +0100
commit831830b5a2b5d413407adf380ef62fe17d6fcbf2 (patch)
treeb08f54f15374b5b98b0b3bea20a1d2ea8d1f50e0 /kernel/ptrace.c
parentscsi: revert "[SCSI] Get rid of scsi_cmnd->done" (diff)
downloadkernel-qcow2-linux-831830b5a2b5d413407adf380ef62fe17d6fcbf2.tar.gz
kernel-qcow2-linux-831830b5a2b5d413407adf380ef62fe17d6fcbf2.tar.xz
kernel-qcow2-linux-831830b5a2b5d413407adf380ef62fe17d6fcbf2.zip
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/ptrace.c')
-rw-r--r--kernel/ptrace.c4
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)
return ret;
}
-static int may_attach(struct task_struct *task)
+int __ptrace_may_attach(struct task_struct *task)
{
/* May we inspect the given task?
* This check is used both for attaching with ptrace
@@ -154,7 +154,7 @@ int ptrace_may_attach(struct task_struct *task)
{
int err;
task_lock(task);
- err = may_attach(task);
+ err = __ptrace_may_attach(task);
task_unlock(task);
return !err;
}