Commit d2d56c5f authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Linus Torvalds

Reset current->pdeath_signal on SUID binary execution

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=2Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 28e8351a
...@@ -1084,9 +1084,12 @@ int flush_old_exec(struct linux_binprm * bprm) ...@@ -1084,9 +1084,12 @@ int flush_old_exec(struct linux_binprm * bprm)
*/ */
current->mm->task_size = TASK_SIZE; current->mm->task_size = TASK_SIZE;
if (bprm->e_uid != current->euid || bprm->e_gid != current->egid || if (bprm->e_uid != current->euid || bprm->e_gid != current->egid) {
file_permission(bprm->file, MAY_READ) || suid_keys(current);
(bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) { set_dumpable(current->mm, suid_dumpable);
current->pdeath_signal = 0;
} else if (file_permission(bprm->file, MAY_READ) ||
(bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) {
suid_keys(current); suid_keys(current);
set_dumpable(current->mm, suid_dumpable); set_dumpable(current->mm, suid_dumpable);
} }
...@@ -1177,8 +1180,10 @@ void compute_creds(struct linux_binprm *bprm) ...@@ -1177,8 +1180,10 @@ void compute_creds(struct linux_binprm *bprm)
{ {
int unsafe; int unsafe;
if (bprm->e_uid != current->uid) if (bprm->e_uid != current->uid) {
suid_keys(current); suid_keys(current);
current->pdeath_signal = 0;
}
exec_keys(current); exec_keys(current);
task_lock(current); task_lock(current);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment