Skip to content

Commit

Permalink
Reset current->pdeath_signal on SUID binary execution
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marcel Holtmann authored and Linus Torvalds committed Aug 18, 2007
1 parent 28e8351 commit d2d56c5
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -1084,9 +1084,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);
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);
set_dumpable(current->mm, suid_dumpable);
}
Expand Down Expand Up @@ -1177,8 +1180,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);
Expand Down

0 comments on commit d2d56c5

Please sign in to comment.