vfs: coredumping fix (CVE-2007-6206)
authorIngo Molnar <mingo@elte.hu>
Mon, 21 Jan 2008 00:20:19 +0000 (02:20 +0200)
committerAdrian Bunk <bunk@kernel.org>
Mon, 21 Jan 2008 00:20:19 +0000 (02:20 +0200)
fix: http://bugzilla.kernel.org/show_bug.cgi?id=3043

only allow coredumping to the same uid that the coredumping
task runs under.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
fs/exec.c

index 91a36b27ec914fda0201d986203e3b405a16ec66..f28672f6a172243e69179f6c5abaa2aa92a09be7 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1512,6 +1512,12 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
 
        if (!S_ISREG(inode->i_mode))
                goto close_fail;
+       /*
+        * Dont allow local users get cute and trick others to coredump
+        * into their pre-created files:
+        */
+       if (inode->i_uid != current->fsuid)
+               goto close_fail;
        if (!file->f_op)
                goto close_fail;
        if (!file->f_op->write)