From: Marcel Holtmann Date: Sat, 6 Oct 2007 22:03:26 +0000 (+0200) Subject: Reset current->pdeath_signal on SUID binary execution (CVE-2007-3848) X-Git-Tag: v2.6.16.55-rc1~7 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=9236d592ceee5d4033cd90d2f7d02440aea9b778;p=karo-tx-linux.git Reset current->pdeath_signal on SUID binary execution (CVE-2007-3848) 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 Signed-off-by: Adrian Bunk --- diff --git a/fs/exec.c b/fs/exec.c index 0b515ac53134..91a36b27ec91 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -891,9 +891,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; } @@ -991,8 +994,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);