diff options
Diffstat (limited to 'fs/exec.c')
-rw-r--r-- | fs/exec.c | 24 |
1 files changed, 7 insertions, 17 deletions
@@ -24,6 +24,7 @@ | |||
24 | 24 | ||
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/file.h> | 26 | #include <linux/file.h> |
27 | #include <linux/fdtable.h> | ||
27 | #include <linux/mman.h> | 28 | #include <linux/mman.h> |
28 | #include <linux/a.out.h> | 29 | #include <linux/a.out.h> |
29 | #include <linux/stat.h> | 30 | #include <linux/stat.h> |
@@ -735,6 +736,7 @@ static int exec_mmap(struct mm_struct *mm) | |||
735 | tsk->active_mm = mm; | 736 | tsk->active_mm = mm; |
736 | activate_mm(active_mm, mm); | 737 | activate_mm(active_mm, mm); |
737 | task_unlock(tsk); | 738 | task_unlock(tsk); |
739 | mm_update_next_owner(mm); | ||
738 | arch_pick_mmap_layout(mm); | 740 | arch_pick_mmap_layout(mm); |
739 | if (old_mm) { | 741 | if (old_mm) { |
740 | up_read(&old_mm->mmap_sem); | 742 | up_read(&old_mm->mmap_sem); |
@@ -765,9 +767,7 @@ static int de_thread(struct task_struct *tsk) | |||
765 | 767 | ||
766 | /* | 768 | /* |
767 | * Kill all other threads in the thread group. | 769 | * Kill all other threads in the thread group. |
768 | * We must hold tasklist_lock to call zap_other_threads. | ||
769 | */ | 770 | */ |
770 | read_lock(&tasklist_lock); | ||
771 | spin_lock_irq(lock); | 771 | spin_lock_irq(lock); |
772 | if (signal_group_exit(sig)) { | 772 | if (signal_group_exit(sig)) { |
773 | /* | 773 | /* |
@@ -775,21 +775,10 @@ static int de_thread(struct task_struct *tsk) | |||
775 | * return so that the signal is processed. | 775 | * return so that the signal is processed. |
776 | */ | 776 | */ |
777 | spin_unlock_irq(lock); | 777 | spin_unlock_irq(lock); |
778 | read_unlock(&tasklist_lock); | ||
779 | return -EAGAIN; | 778 | return -EAGAIN; |
780 | } | 779 | } |
781 | |||
782 | /* | ||
783 | * child_reaper ignores SIGKILL, change it now. | ||
784 | * Reparenting needs write_lock on tasklist_lock, | ||
785 | * so it is safe to do it under read_lock. | ||
786 | */ | ||
787 | if (unlikely(tsk->group_leader == task_child_reaper(tsk))) | ||
788 | task_active_pid_ns(tsk)->child_reaper = tsk; | ||
789 | |||
790 | sig->group_exit_task = tsk; | 780 | sig->group_exit_task = tsk; |
791 | zap_other_threads(tsk); | 781 | zap_other_threads(tsk); |
792 | read_unlock(&tasklist_lock); | ||
793 | 782 | ||
794 | /* Account for the thread group leader hanging around: */ | 783 | /* Account for the thread group leader hanging around: */ |
795 | count = thread_group_leader(tsk) ? 1 : 2; | 784 | count = thread_group_leader(tsk) ? 1 : 2; |
@@ -810,7 +799,7 @@ static int de_thread(struct task_struct *tsk) | |||
810 | if (!thread_group_leader(tsk)) { | 799 | if (!thread_group_leader(tsk)) { |
811 | leader = tsk->group_leader; | 800 | leader = tsk->group_leader; |
812 | 801 | ||
813 | sig->notify_count = -1; | 802 | sig->notify_count = -1; /* for exit_notify() */ |
814 | for (;;) { | 803 | for (;;) { |
815 | write_lock_irq(&tasklist_lock); | 804 | write_lock_irq(&tasklist_lock); |
816 | if (likely(leader->exit_state)) | 805 | if (likely(leader->exit_state)) |
@@ -820,6 +809,8 @@ static int de_thread(struct task_struct *tsk) | |||
820 | schedule(); | 809 | schedule(); |
821 | } | 810 | } |
822 | 811 | ||
812 | if (unlikely(task_child_reaper(tsk) == leader)) | ||
813 | task_active_pid_ns(tsk)->child_reaper = tsk; | ||
823 | /* | 814 | /* |
824 | * The only record we have of the real-time age of a | 815 | * The only record we have of the real-time age of a |
825 | * process, regardless of execs it's done, is start_time. | 816 | * process, regardless of execs it's done, is start_time. |
@@ -963,6 +954,8 @@ int flush_old_exec(struct linux_binprm * bprm) | |||
963 | if (retval) | 954 | if (retval) |
964 | goto out; | 955 | goto out; |
965 | 956 | ||
957 | set_mm_exe_file(bprm->mm, bprm->file); | ||
958 | |||
966 | /* | 959 | /* |
967 | * Release all of the old mmap stuff | 960 | * Release all of the old mmap stuff |
968 | */ | 961 | */ |
@@ -1268,7 +1261,6 @@ int do_execve(char * filename, | |||
1268 | { | 1261 | { |
1269 | struct linux_binprm *bprm; | 1262 | struct linux_binprm *bprm; |
1270 | struct file *file; | 1263 | struct file *file; |
1271 | unsigned long env_p; | ||
1272 | struct files_struct *displaced; | 1264 | struct files_struct *displaced; |
1273 | int retval; | 1265 | int retval; |
1274 | 1266 | ||
@@ -1321,11 +1313,9 @@ int do_execve(char * filename, | |||
1321 | if (retval < 0) | 1313 | if (retval < 0) |
1322 | goto out; | 1314 | goto out; |
1323 | 1315 | ||
1324 | env_p = bprm->p; | ||
1325 | retval = copy_strings(bprm->argc, argv, bprm); | 1316 | retval = copy_strings(bprm->argc, argv, bprm); |
1326 | if (retval < 0) | 1317 | if (retval < 0) |
1327 | goto out; | 1318 | goto out; |
1328 | bprm->argv_len = env_p - bprm->p; | ||
1329 | 1319 | ||
1330 | retval = search_binary_handler(bprm,regs); | 1320 | retval = search_binary_handler(bprm,regs); |
1331 | if (retval >= 0) { | 1321 | if (retval >= 0) { |