aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 7bdea7937ee8..c21a8cc06277 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -780,18 +780,11 @@ static int de_thread(struct task_struct *tsk)
780 int count; 780 int count;
781 781
782 /* 782 /*
783 * Tell all the sighand listeners that this sighand has
784 * been detached. The signalfd_detach() function grabs the
785 * sighand lock, if signal listeners are present on the sighand.
786 */
787 signalfd_detach(tsk);
788
789 /*
790 * If we don't share sighandlers, then we aren't sharing anything 783 * If we don't share sighandlers, then we aren't sharing anything
791 * and we can just re-use it all. 784 * and we can just re-use it all.
792 */ 785 */
793 if (atomic_read(&oldsighand->count) <= 1) { 786 if (atomic_read(&oldsighand->count) <= 1) {
794 BUG_ON(atomic_read(&sig->count) != 1); 787 signalfd_detach(tsk);
795 exit_itimers(sig); 788 exit_itimers(sig);
796 return 0; 789 return 0;
797 } 790 }
@@ -930,12 +923,11 @@ static int de_thread(struct task_struct *tsk)
930 sig->flags = 0; 923 sig->flags = 0;
931 924
932no_thread_group: 925no_thread_group:
926 signalfd_detach(tsk);
933 exit_itimers(sig); 927 exit_itimers(sig);
934 if (leader) 928 if (leader)
935 release_task(leader); 929 release_task(leader);
936 930
937 BUG_ON(atomic_read(&sig->count) != 1);
938
939 if (atomic_read(&oldsighand->count) == 1) { 931 if (atomic_read(&oldsighand->count) == 1) {
940 /* 932 /*
941 * Now that we nuked the rest of the thread group, 933 * Now that we nuked the rest of the thread group,
@@ -1084,9 +1076,12 @@ int flush_old_exec(struct linux_binprm * bprm)
1084 */ 1076 */
1085 current->mm->task_size = TASK_SIZE; 1077 current->mm->task_size = TASK_SIZE;
1086 1078
1087 if (bprm->e_uid != current->euid || bprm->e_gid != current->egid || 1079 if (bprm->e_uid != current->euid || bprm->e_gid != current->egid) {
1088 file_permission(bprm->file, MAY_READ) || 1080 suid_keys(current);
1089 (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) { 1081 set_dumpable(current->mm, suid_dumpable);
1082 current->pdeath_signal = 0;
1083 } else if (file_permission(bprm->file, MAY_READ) ||
1084 (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) {
1090 suid_keys(current); 1085 suid_keys(current);
1091 set_dumpable(current->mm, suid_dumpable); 1086 set_dumpable(current->mm, suid_dumpable);
1092 } 1087 }
@@ -1177,8 +1172,10 @@ void compute_creds(struct linux_binprm *bprm)
1177{ 1172{
1178 int unsafe; 1173 int unsafe;
1179 1174
1180 if (bprm->e_uid != current->uid) 1175 if (bprm->e_uid != current->uid) {
1181 suid_keys(current); 1176 suid_keys(current);
1177 current->pdeath_signal = 0;
1178 }
1182 exec_keys(current); 1179 exec_keys(current);
1183 1180
1184 task_lock(current); 1181 task_lock(current);