]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
Reset current->pdeath_signal on SUID binary execution (CVE-2007-3848)
authorMarcel Holtmann <marcel@holtmann.org>
Fri, 17 Aug 2007 19:47:58 +0000 (21:47 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 21 Aug 2007 04:32:42 +0000 (21:32 -0700)
This fixes a vulnerability in the "parent process death signal"
implementation discoverd by Wojciech Purczynski of COSEINC PTE Ltd.
and iSEC Security Research.

http://marc.info/?l=bugtraq&m=118711306802632&w=2

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/exec.c

index f20561ff4528f21ad7a36d35d56513346c5f740b..9a93770023b6dfc029e7311e439fd237fd81596a 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -890,9 +890,12 @@ int flush_old_exec(struct linux_binprm * bprm)
         */
        current->mm->task_size = TASK_SIZE;
 
-       if (bprm->e_uid != current->euid || bprm->e_gid != current->egid || 
-           file_permission(bprm->file, MAY_READ) ||
-           (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) {
+       if (bprm->e_uid != current->euid || bprm->e_gid != current->egid) {
+               suid_keys(current);
+               current->mm->dumpable = suid_dumpable;
+               current->pdeath_signal = 0;
+       } else if (file_permission(bprm->file, MAY_READ) ||
+                       (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) {
                suid_keys(current);
                current->mm->dumpable = suid_dumpable;
        }
@@ -983,8 +986,10 @@ void compute_creds(struct linux_binprm *bprm)
 {
        int unsafe;
 
-       if (bprm->e_uid != current->uid)
+       if (bprm->e_uid != current->uid) {
                suid_keys(current);
+               current->pdeath_signal = 0;
+       }
        exec_keys(current);
 
        task_lock(current);