diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2007-08-17 15:47:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-08-18 12:29:07 -0400 |
commit | d2d56c5f51028cb9f3d800882eb6f4cbd3f9099f (patch) | |
tree | 877b9aea4d369c083abd5741f2ab90c52ac863ad /fs/exec.c | |
parent | 28e8351ac22de25034e048c680014ad824323c65 (diff) |
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=2
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -1084,9 +1084,12 @@ int flush_old_exec(struct linux_binprm * bprm) | |||
1084 | */ | 1084 | */ |
1085 | current->mm->task_size = TASK_SIZE; | 1085 | current->mm->task_size = TASK_SIZE; |
1086 | 1086 | ||
1087 | if (bprm->e_uid != current->euid || bprm->e_gid != current->egid || | 1087 | if (bprm->e_uid != current->euid || bprm->e_gid != current->egid) { |
1088 | file_permission(bprm->file, MAY_READ) || | 1088 | suid_keys(current); |
1089 | (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) { | 1089 | set_dumpable(current->mm, suid_dumpable); |
1090 | current->pdeath_signal = 0; | ||
1091 | } else if (file_permission(bprm->file, MAY_READ) || | ||
1092 | (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) { | ||
1090 | suid_keys(current); | 1093 | suid_keys(current); |
1091 | set_dumpable(current->mm, suid_dumpable); | 1094 | set_dumpable(current->mm, suid_dumpable); |
1092 | } | 1095 | } |
@@ -1177,8 +1180,10 @@ void compute_creds(struct linux_binprm *bprm) | |||
1177 | { | 1180 | { |
1178 | int unsafe; | 1181 | int unsafe; |
1179 | 1182 | ||
1180 | if (bprm->e_uid != current->uid) | 1183 | if (bprm->e_uid != current->uid) { |
1181 | suid_keys(current); | 1184 | suid_keys(current); |
1185 | current->pdeath_signal = 0; | ||
1186 | } | ||
1182 | exec_keys(current); | 1187 | exec_keys(current); |
1183 | 1188 | ||
1184 | task_lock(current); | 1189 | task_lock(current); |