auxv: require the target to be tracable (or yourself), CVE-2011-1020
authorAl Viro <viro@zeniv.linux.org.uk>
Thu, 21 Jul 2011 13:13:45 +0000 (14:13 +0100)
committerHerton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
Mon, 29 Aug 2011 19:23:06 +0000 (16:23 -0300)
same as for environ, except that we didn't do any checks to
prevent access after suid execve

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

(cherry picked from commit 2fadaef41283aad7100fa73f01998cddaca25833)
CVE-2011-1020
BugLink: http://bugs.launchpad.net/bugs/813026
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>

fs/proc/base.c

index 3803523..bf64fd7 100644 (file)
@@ -281,9 +281,9 @@ out:
 
 static int proc_pid_auxv(struct task_struct *task, char *buffer)
 {
 
 static int proc_pid_auxv(struct task_struct *task, char *buffer)
 {
-       int res = 0;
-       struct mm_struct *mm = get_task_mm(task);
-       if (mm) {
+       struct mm_struct *mm = mm_for_maps(task);
+       int res = PTR_ERR(mm);
+       if (mm && !IS_ERR(mm)) {
                unsigned int nwords = 0;
                do {
                        nwords += 2;
                unsigned int nwords = 0;
                do {
                        nwords += 2;