diff options
Diffstat (limited to 'kernel/exit.c')
-rw-r--r-- | kernel/exit.c | 157 |
1 files changed, 94 insertions, 63 deletions
diff --git a/kernel/exit.c b/kernel/exit.c index 2c704c86edb3..f1aec27f1df0 100644 --- a/kernel/exit.c +++ b/kernel/exit.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/taskstats_kern.h> | 31 | #include <linux/taskstats_kern.h> |
32 | #include <linux/delayacct.h> | 32 | #include <linux/delayacct.h> |
33 | #include <linux/freezer.h> | 33 | #include <linux/freezer.h> |
34 | #include <linux/cpuset.h> | 34 | #include <linux/cgroup.h> |
35 | #include <linux/syscalls.h> | 35 | #include <linux/syscalls.h> |
36 | #include <linux/signal.h> | 36 | #include <linux/signal.h> |
37 | #include <linux/posix-timers.h> | 37 | #include <linux/posix-timers.h> |
@@ -148,6 +148,7 @@ void release_task(struct task_struct * p) | |||
148 | int zap_leader; | 148 | int zap_leader; |
149 | repeat: | 149 | repeat: |
150 | atomic_dec(&p->user->processes); | 150 | atomic_dec(&p->user->processes); |
151 | proc_flush_task(p); | ||
151 | write_lock_irq(&tasklist_lock); | 152 | write_lock_irq(&tasklist_lock); |
152 | ptrace_unlink(p); | 153 | ptrace_unlink(p); |
153 | BUG_ON(!list_empty(&p->ptrace_list) || !list_empty(&p->ptrace_children)); | 154 | BUG_ON(!list_empty(&p->ptrace_list) || !list_empty(&p->ptrace_children)); |
@@ -175,7 +176,6 @@ repeat: | |||
175 | } | 176 | } |
176 | 177 | ||
177 | write_unlock_irq(&tasklist_lock); | 178 | write_unlock_irq(&tasklist_lock); |
178 | proc_flush_task(p); | ||
179 | release_thread(p); | 179 | release_thread(p); |
180 | call_rcu(&p->rcu, delayed_put_task_struct); | 180 | call_rcu(&p->rcu, delayed_put_task_struct); |
181 | 181 | ||
@@ -221,7 +221,7 @@ static int will_become_orphaned_pgrp(struct pid *pgrp, struct task_struct *ignor | |||
221 | do_each_pid_task(pgrp, PIDTYPE_PGID, p) { | 221 | do_each_pid_task(pgrp, PIDTYPE_PGID, p) { |
222 | if (p == ignored_task | 222 | if (p == ignored_task |
223 | || p->exit_state | 223 | || p->exit_state |
224 | || is_init(p->real_parent)) | 224 | || is_global_init(p->real_parent)) |
225 | continue; | 225 | continue; |
226 | if (task_pgrp(p->real_parent) != pgrp && | 226 | if (task_pgrp(p->real_parent) != pgrp && |
227 | task_session(p->real_parent) == task_session(p)) { | 227 | task_session(p->real_parent) == task_session(p)) { |
@@ -299,14 +299,14 @@ void __set_special_pids(pid_t session, pid_t pgrp) | |||
299 | { | 299 | { |
300 | struct task_struct *curr = current->group_leader; | 300 | struct task_struct *curr = current->group_leader; |
301 | 301 | ||
302 | if (process_session(curr) != session) { | 302 | if (task_session_nr(curr) != session) { |
303 | detach_pid(curr, PIDTYPE_SID); | 303 | detach_pid(curr, PIDTYPE_SID); |
304 | set_signal_session(curr->signal, session); | 304 | set_task_session(curr, session); |
305 | attach_pid(curr, PIDTYPE_SID, find_pid(session)); | 305 | attach_pid(curr, PIDTYPE_SID, find_pid(session)); |
306 | } | 306 | } |
307 | if (process_group(curr) != pgrp) { | 307 | if (task_pgrp_nr(curr) != pgrp) { |
308 | detach_pid(curr, PIDTYPE_PGID); | 308 | detach_pid(curr, PIDTYPE_PGID); |
309 | curr->signal->pgrp = pgrp; | 309 | set_task_pgrp(curr, pgrp); |
310 | attach_pid(curr, PIDTYPE_PGID, find_pid(pgrp)); | 310 | attach_pid(curr, PIDTYPE_PGID, find_pid(pgrp)); |
311 | } | 311 | } |
312 | } | 312 | } |
@@ -400,11 +400,12 @@ void daemonize(const char *name, ...) | |||
400 | current->fs = fs; | 400 | current->fs = fs; |
401 | atomic_inc(&fs->count); | 401 | atomic_inc(&fs->count); |
402 | 402 | ||
403 | exit_task_namespaces(current); | 403 | if (current->nsproxy != init_task.nsproxy) { |
404 | current->nsproxy = init_task.nsproxy; | 404 | get_nsproxy(init_task.nsproxy); |
405 | get_task_namespaces(current); | 405 | switch_task_namespaces(current, init_task.nsproxy); |
406 | } | ||
406 | 407 | ||
407 | exit_files(current); | 408 | exit_files(current); |
408 | current->files = init_task.files; | 409 | current->files = init_task.files; |
409 | atomic_inc(¤t->files->count); | 410 | atomic_inc(¤t->files->count); |
410 | 411 | ||
@@ -492,7 +493,7 @@ void reset_files_struct(struct task_struct *tsk, struct files_struct *files) | |||
492 | } | 493 | } |
493 | EXPORT_SYMBOL(reset_files_struct); | 494 | EXPORT_SYMBOL(reset_files_struct); |
494 | 495 | ||
495 | static inline void __exit_files(struct task_struct *tsk) | 496 | static void __exit_files(struct task_struct *tsk) |
496 | { | 497 | { |
497 | struct files_struct * files = tsk->files; | 498 | struct files_struct * files = tsk->files; |
498 | 499 | ||
@@ -509,7 +510,7 @@ void exit_files(struct task_struct *tsk) | |||
509 | __exit_files(tsk); | 510 | __exit_files(tsk); |
510 | } | 511 | } |
511 | 512 | ||
512 | static inline void __put_fs_struct(struct fs_struct *fs) | 513 | static void __put_fs_struct(struct fs_struct *fs) |
513 | { | 514 | { |
514 | /* No need to hold fs->lock if we are killing it */ | 515 | /* No need to hold fs->lock if we are killing it */ |
515 | if (atomic_dec_and_test(&fs->count)) { | 516 | if (atomic_dec_and_test(&fs->count)) { |
@@ -530,7 +531,7 @@ void put_fs_struct(struct fs_struct *fs) | |||
530 | __put_fs_struct(fs); | 531 | __put_fs_struct(fs); |
531 | } | 532 | } |
532 | 533 | ||
533 | static inline void __exit_fs(struct task_struct *tsk) | 534 | static void __exit_fs(struct task_struct *tsk) |
534 | { | 535 | { |
535 | struct fs_struct * fs = tsk->fs; | 536 | struct fs_struct * fs = tsk->fs; |
536 | 537 | ||
@@ -665,19 +666,22 @@ reparent_thread(struct task_struct *p, struct task_struct *father, int traced) | |||
665 | * the child reaper process (ie "init") in our pid | 666 | * the child reaper process (ie "init") in our pid |
666 | * space. | 667 | * space. |
667 | */ | 668 | */ |
668 | static void | 669 | static void forget_original_parent(struct task_struct *father) |
669 | forget_original_parent(struct task_struct *father, struct list_head *to_release) | ||
670 | { | 670 | { |
671 | struct task_struct *p, *reaper = father; | 671 | struct task_struct *p, *n, *reaper = father; |
672 | struct list_head *_p, *_n; | 672 | struct list_head ptrace_dead; |
673 | |||
674 | INIT_LIST_HEAD(&ptrace_dead); | ||
675 | |||
676 | write_lock_irq(&tasklist_lock); | ||
673 | 677 | ||
674 | do { | 678 | do { |
675 | reaper = next_thread(reaper); | 679 | reaper = next_thread(reaper); |
676 | if (reaper == father) { | 680 | if (reaper == father) { |
677 | reaper = child_reaper(father); | 681 | reaper = task_child_reaper(father); |
678 | break; | 682 | break; |
679 | } | 683 | } |
680 | } while (reaper->exit_state); | 684 | } while (reaper->flags & PF_EXITING); |
681 | 685 | ||
682 | /* | 686 | /* |
683 | * There are only two places where our children can be: | 687 | * There are only two places where our children can be: |
@@ -687,9 +691,8 @@ forget_original_parent(struct task_struct *father, struct list_head *to_release) | |||
687 | * | 691 | * |
688 | * Search them and reparent children. | 692 | * Search them and reparent children. |
689 | */ | 693 | */ |
690 | list_for_each_safe(_p, _n, &father->children) { | 694 | list_for_each_entry_safe(p, n, &father->children, sibling) { |
691 | int ptrace; | 695 | int ptrace; |
692 | p = list_entry(_p, struct task_struct, sibling); | ||
693 | 696 | ||
694 | ptrace = p->ptrace; | 697 | ptrace = p->ptrace; |
695 | 698 | ||
@@ -715,13 +718,23 @@ forget_original_parent(struct task_struct *father, struct list_head *to_release) | |||
715 | * while it was being traced by us, to be able to see it in wait4. | 718 | * while it was being traced by us, to be able to see it in wait4. |
716 | */ | 719 | */ |
717 | if (unlikely(ptrace && p->exit_state == EXIT_ZOMBIE && p->exit_signal == -1)) | 720 | if (unlikely(ptrace && p->exit_state == EXIT_ZOMBIE && p->exit_signal == -1)) |
718 | list_add(&p->ptrace_list, to_release); | 721 | list_add(&p->ptrace_list, &ptrace_dead); |
719 | } | 722 | } |
720 | list_for_each_safe(_p, _n, &father->ptrace_children) { | 723 | |
721 | p = list_entry(_p, struct task_struct, ptrace_list); | 724 | list_for_each_entry_safe(p, n, &father->ptrace_children, ptrace_list) { |
722 | p->real_parent = reaper; | 725 | p->real_parent = reaper; |
723 | reparent_thread(p, father, 1); | 726 | reparent_thread(p, father, 1); |
724 | } | 727 | } |
728 | |||
729 | write_unlock_irq(&tasklist_lock); | ||
730 | BUG_ON(!list_empty(&father->children)); | ||
731 | BUG_ON(!list_empty(&father->ptrace_children)); | ||
732 | |||
733 | list_for_each_entry_safe(p, n, &ptrace_dead, ptrace_list) { | ||
734 | list_del_init(&p->ptrace_list); | ||
735 | release_task(p); | ||
736 | } | ||
737 | |||
725 | } | 738 | } |
726 | 739 | ||
727 | /* | 740 | /* |
@@ -732,7 +745,6 @@ static void exit_notify(struct task_struct *tsk) | |||
732 | { | 745 | { |
733 | int state; | 746 | int state; |
734 | struct task_struct *t; | 747 | struct task_struct *t; |
735 | struct list_head ptrace_dead, *_p, *_n; | ||
736 | struct pid *pgrp; | 748 | struct pid *pgrp; |
737 | 749 | ||
738 | if (signal_pending(tsk) && !(tsk->signal->flags & SIGNAL_GROUP_EXIT) | 750 | if (signal_pending(tsk) && !(tsk->signal->flags & SIGNAL_GROUP_EXIT) |
@@ -753,8 +765,6 @@ static void exit_notify(struct task_struct *tsk) | |||
753 | spin_unlock_irq(&tsk->sighand->siglock); | 765 | spin_unlock_irq(&tsk->sighand->siglock); |
754 | } | 766 | } |
755 | 767 | ||
756 | write_lock_irq(&tasklist_lock); | ||
757 | |||
758 | /* | 768 | /* |
759 | * This does two things: | 769 | * This does two things: |
760 | * | 770 | * |
@@ -763,12 +773,10 @@ static void exit_notify(struct task_struct *tsk) | |||
763 | * as a result of our exiting, and if they have any stopped | 773 | * as a result of our exiting, and if they have any stopped |
764 | * jobs, send them a SIGHUP and then a SIGCONT. (POSIX 3.2.2.2) | 774 | * jobs, send them a SIGHUP and then a SIGCONT. (POSIX 3.2.2.2) |
765 | */ | 775 | */ |
776 | forget_original_parent(tsk); | ||
777 | exit_task_namespaces(tsk); | ||
766 | 778 | ||
767 | INIT_LIST_HEAD(&ptrace_dead); | 779 | write_lock_irq(&tasklist_lock); |
768 | forget_original_parent(tsk, &ptrace_dead); | ||
769 | BUG_ON(!list_empty(&tsk->children)); | ||
770 | BUG_ON(!list_empty(&tsk->ptrace_children)); | ||
771 | |||
772 | /* | 780 | /* |
773 | * Check to see if any process groups have become orphaned | 781 | * Check to see if any process groups have become orphaned |
774 | * as a result of our exiting, and if they have any stopped | 782 | * as a result of our exiting, and if they have any stopped |
@@ -792,7 +800,7 @@ static void exit_notify(struct task_struct *tsk) | |||
792 | /* Let father know we died | 800 | /* Let father know we died |
793 | * | 801 | * |
794 | * Thread signals are configurable, but you aren't going to use | 802 | * Thread signals are configurable, but you aren't going to use |
795 | * that to send signals to arbitary processes. | 803 | * that to send signals to arbitary processes. |
796 | * That stops right now. | 804 | * That stops right now. |
797 | * | 805 | * |
798 | * If the parent exec id doesn't match the exec id we saved | 806 | * If the parent exec id doesn't match the exec id we saved |
@@ -833,12 +841,6 @@ static void exit_notify(struct task_struct *tsk) | |||
833 | 841 | ||
834 | write_unlock_irq(&tasklist_lock); | 842 | write_unlock_irq(&tasklist_lock); |
835 | 843 | ||
836 | list_for_each_safe(_p, _n, &ptrace_dead) { | ||
837 | list_del_init(_p); | ||
838 | t = list_entry(_p, struct task_struct, ptrace_list); | ||
839 | release_task(t); | ||
840 | } | ||
841 | |||
842 | /* If the process is dead, release it - nobody will wait for it */ | 844 | /* If the process is dead, release it - nobody will wait for it */ |
843 | if (state == EXIT_DEAD) | 845 | if (state == EXIT_DEAD) |
844 | release_task(tsk); | 846 | release_task(tsk); |
@@ -874,10 +876,35 @@ static inline void check_stack_usage(void) {} | |||
874 | 876 | ||
875 | static inline void exit_child_reaper(struct task_struct *tsk) | 877 | static inline void exit_child_reaper(struct task_struct *tsk) |
876 | { | 878 | { |
877 | if (likely(tsk->group_leader != child_reaper(tsk))) | 879 | if (likely(tsk->group_leader != task_child_reaper(tsk))) |
878 | return; | 880 | return; |
879 | 881 | ||
880 | panic("Attempted to kill init!"); | 882 | if (tsk->nsproxy->pid_ns == &init_pid_ns) |
883 | panic("Attempted to kill init!"); | ||
884 | |||
885 | /* | ||
886 | * @tsk is the last thread in the 'cgroup-init' and is exiting. | ||
887 | * Terminate all remaining processes in the namespace and reap them | ||
888 | * before exiting @tsk. | ||
889 | * | ||
890 | * Note that @tsk (last thread of cgroup-init) may not necessarily | ||
891 | * be the child-reaper (i.e main thread of cgroup-init) of the | ||
892 | * namespace i.e the child_reaper may have already exited. | ||
893 | * | ||
894 | * Even after a child_reaper exits, we let it inherit orphaned children, | ||
895 | * because, pid_ns->child_reaper remains valid as long as there is | ||
896 | * at least one living sub-thread in the cgroup init. | ||
897 | |||
898 | * This living sub-thread of the cgroup-init will be notified when | ||
899 | * a child inherited by the 'child-reaper' exits (do_notify_parent() | ||
900 | * uses __group_send_sig_info()). Further, when reaping child processes, | ||
901 | * do_wait() iterates over children of all living sub threads. | ||
902 | |||
903 | * i.e even though 'child_reaper' thread is listed as the parent of the | ||
904 | * orphaned children, any living sub-thread in the cgroup-init can | ||
905 | * perform the role of the child_reaper. | ||
906 | */ | ||
907 | zap_pid_ns_processes(tsk->nsproxy->pid_ns); | ||
881 | } | 908 | } |
882 | 909 | ||
883 | fastcall NORET_TYPE void do_exit(long code) | 910 | fastcall NORET_TYPE void do_exit(long code) |
@@ -932,7 +959,7 @@ fastcall NORET_TYPE void do_exit(long code) | |||
932 | 959 | ||
933 | if (unlikely(in_atomic())) | 960 | if (unlikely(in_atomic())) |
934 | printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n", | 961 | printk(KERN_INFO "note: %s[%d] exited with preempt_count %d\n", |
935 | current->comm, current->pid, | 962 | current->comm, task_pid_nr(current), |
936 | preempt_count()); | 963 | preempt_count()); |
937 | 964 | ||
938 | acct_update_integrals(tsk); | 965 | acct_update_integrals(tsk); |
@@ -972,7 +999,7 @@ fastcall NORET_TYPE void do_exit(long code) | |||
972 | __exit_fs(tsk); | 999 | __exit_fs(tsk); |
973 | check_stack_usage(); | 1000 | check_stack_usage(); |
974 | exit_thread(); | 1001 | exit_thread(); |
975 | cpuset_exit(tsk); | 1002 | cgroup_exit(tsk, 1); |
976 | exit_keys(tsk); | 1003 | exit_keys(tsk); |
977 | 1004 | ||
978 | if (group_dead && tsk->signal->leader) | 1005 | if (group_dead && tsk->signal->leader) |
@@ -983,7 +1010,6 @@ fastcall NORET_TYPE void do_exit(long code) | |||
983 | module_put(tsk->binfmt->module); | 1010 | module_put(tsk->binfmt->module); |
984 | 1011 | ||
985 | proc_exit_connector(tsk); | 1012 | proc_exit_connector(tsk); |
986 | exit_task_namespaces(tsk); | ||
987 | exit_notify(tsk); | 1013 | exit_notify(tsk); |
988 | #ifdef CONFIG_NUMA | 1014 | #ifdef CONFIG_NUMA |
989 | mpol_free(tsk->mempolicy); | 1015 | mpol_free(tsk->mempolicy); |
@@ -1086,15 +1112,17 @@ asmlinkage void sys_exit_group(int error_code) | |||
1086 | static int eligible_child(pid_t pid, int options, struct task_struct *p) | 1112 | static int eligible_child(pid_t pid, int options, struct task_struct *p) |
1087 | { | 1113 | { |
1088 | int err; | 1114 | int err; |
1115 | struct pid_namespace *ns; | ||
1089 | 1116 | ||
1117 | ns = current->nsproxy->pid_ns; | ||
1090 | if (pid > 0) { | 1118 | if (pid > 0) { |
1091 | if (p->pid != pid) | 1119 | if (task_pid_nr_ns(p, ns) != pid) |
1092 | return 0; | 1120 | return 0; |
1093 | } else if (!pid) { | 1121 | } else if (!pid) { |
1094 | if (process_group(p) != process_group(current)) | 1122 | if (task_pgrp_nr_ns(p, ns) != task_pgrp_vnr(current)) |
1095 | return 0; | 1123 | return 0; |
1096 | } else if (pid != -1) { | 1124 | } else if (pid != -1) { |
1097 | if (process_group(p) != -pid) | 1125 | if (task_pgrp_nr_ns(p, ns) != -pid) |
1098 | return 0; | 1126 | return 0; |
1099 | } | 1127 | } |
1100 | 1128 | ||
@@ -1164,9 +1192,12 @@ static int wait_task_zombie(struct task_struct *p, int noreap, | |||
1164 | { | 1192 | { |
1165 | unsigned long state; | 1193 | unsigned long state; |
1166 | int retval, status, traced; | 1194 | int retval, status, traced; |
1195 | struct pid_namespace *ns; | ||
1196 | |||
1197 | ns = current->nsproxy->pid_ns; | ||
1167 | 1198 | ||
1168 | if (unlikely(noreap)) { | 1199 | if (unlikely(noreap)) { |
1169 | pid_t pid = p->pid; | 1200 | pid_t pid = task_pid_nr_ns(p, ns); |
1170 | uid_t uid = p->uid; | 1201 | uid_t uid = p->uid; |
1171 | int exit_code = p->exit_code; | 1202 | int exit_code = p->exit_code; |
1172 | int why, status; | 1203 | int why, status; |
@@ -1285,11 +1316,11 @@ static int wait_task_zombie(struct task_struct *p, int noreap, | |||
1285 | retval = put_user(status, &infop->si_status); | 1316 | retval = put_user(status, &infop->si_status); |
1286 | } | 1317 | } |
1287 | if (!retval && infop) | 1318 | if (!retval && infop) |
1288 | retval = put_user(p->pid, &infop->si_pid); | 1319 | retval = put_user(task_pid_nr_ns(p, ns), &infop->si_pid); |
1289 | if (!retval && infop) | 1320 | if (!retval && infop) |
1290 | retval = put_user(p->uid, &infop->si_uid); | 1321 | retval = put_user(p->uid, &infop->si_uid); |
1291 | if (!retval) | 1322 | if (!retval) |
1292 | retval = p->pid; | 1323 | retval = task_pid_nr_ns(p, ns); |
1293 | 1324 | ||
1294 | if (traced) { | 1325 | if (traced) { |
1295 | write_lock_irq(&tasklist_lock); | 1326 | write_lock_irq(&tasklist_lock); |
@@ -1326,6 +1357,7 @@ static int wait_task_stopped(struct task_struct *p, int delayed_group_leader, | |||
1326 | int __user *stat_addr, struct rusage __user *ru) | 1357 | int __user *stat_addr, struct rusage __user *ru) |
1327 | { | 1358 | { |
1328 | int retval, exit_code; | 1359 | int retval, exit_code; |
1360 | struct pid_namespace *ns; | ||
1329 | 1361 | ||
1330 | if (!p->exit_code) | 1362 | if (!p->exit_code) |
1331 | return 0; | 1363 | return 0; |
@@ -1344,11 +1376,12 @@ static int wait_task_stopped(struct task_struct *p, int delayed_group_leader, | |||
1344 | * keep holding onto the tasklist_lock while we call getrusage and | 1376 | * keep holding onto the tasklist_lock while we call getrusage and |
1345 | * possibly take page faults for user memory. | 1377 | * possibly take page faults for user memory. |
1346 | */ | 1378 | */ |
1379 | ns = current->nsproxy->pid_ns; | ||
1347 | get_task_struct(p); | 1380 | get_task_struct(p); |
1348 | read_unlock(&tasklist_lock); | 1381 | read_unlock(&tasklist_lock); |
1349 | 1382 | ||
1350 | if (unlikely(noreap)) { | 1383 | if (unlikely(noreap)) { |
1351 | pid_t pid = p->pid; | 1384 | pid_t pid = task_pid_nr_ns(p, ns); |
1352 | uid_t uid = p->uid; | 1385 | uid_t uid = p->uid; |
1353 | int why = (p->ptrace & PT_PTRACED) ? CLD_TRAPPED : CLD_STOPPED; | 1386 | int why = (p->ptrace & PT_PTRACED) ? CLD_TRAPPED : CLD_STOPPED; |
1354 | 1387 | ||
@@ -1419,11 +1452,11 @@ bail_ref: | |||
1419 | if (!retval && infop) | 1452 | if (!retval && infop) |
1420 | retval = put_user(exit_code, &infop->si_status); | 1453 | retval = put_user(exit_code, &infop->si_status); |
1421 | if (!retval && infop) | 1454 | if (!retval && infop) |
1422 | retval = put_user(p->pid, &infop->si_pid); | 1455 | retval = put_user(task_pid_nr_ns(p, ns), &infop->si_pid); |
1423 | if (!retval && infop) | 1456 | if (!retval && infop) |
1424 | retval = put_user(p->uid, &infop->si_uid); | 1457 | retval = put_user(p->uid, &infop->si_uid); |
1425 | if (!retval) | 1458 | if (!retval) |
1426 | retval = p->pid; | 1459 | retval = task_pid_nr_ns(p, ns); |
1427 | put_task_struct(p); | 1460 | put_task_struct(p); |
1428 | 1461 | ||
1429 | BUG_ON(!retval); | 1462 | BUG_ON(!retval); |
@@ -1443,6 +1476,7 @@ static int wait_task_continued(struct task_struct *p, int noreap, | |||
1443 | int retval; | 1476 | int retval; |
1444 | pid_t pid; | 1477 | pid_t pid; |
1445 | uid_t uid; | 1478 | uid_t uid; |
1479 | struct pid_namespace *ns; | ||
1446 | 1480 | ||
1447 | if (!(p->signal->flags & SIGNAL_STOP_CONTINUED)) | 1481 | if (!(p->signal->flags & SIGNAL_STOP_CONTINUED)) |
1448 | return 0; | 1482 | return 0; |
@@ -1457,7 +1491,8 @@ static int wait_task_continued(struct task_struct *p, int noreap, | |||
1457 | p->signal->flags &= ~SIGNAL_STOP_CONTINUED; | 1491 | p->signal->flags &= ~SIGNAL_STOP_CONTINUED; |
1458 | spin_unlock_irq(&p->sighand->siglock); | 1492 | spin_unlock_irq(&p->sighand->siglock); |
1459 | 1493 | ||
1460 | pid = p->pid; | 1494 | ns = current->nsproxy->pid_ns; |
1495 | pid = task_pid_nr_ns(p, ns); | ||
1461 | uid = p->uid; | 1496 | uid = p->uid; |
1462 | get_task_struct(p); | 1497 | get_task_struct(p); |
1463 | read_unlock(&tasklist_lock); | 1498 | read_unlock(&tasklist_lock); |
@@ -1468,7 +1503,7 @@ static int wait_task_continued(struct task_struct *p, int noreap, | |||
1468 | if (!retval && stat_addr) | 1503 | if (!retval && stat_addr) |
1469 | retval = put_user(0xffff, stat_addr); | 1504 | retval = put_user(0xffff, stat_addr); |
1470 | if (!retval) | 1505 | if (!retval) |
1471 | retval = p->pid; | 1506 | retval = task_pid_nr_ns(p, ns); |
1472 | } else { | 1507 | } else { |
1473 | retval = wait_noreap_copyout(p, pid, uid, | 1508 | retval = wait_noreap_copyout(p, pid, uid, |
1474 | CLD_CONTINUED, SIGCONT, | 1509 | CLD_CONTINUED, SIGCONT, |
@@ -1517,12 +1552,9 @@ repeat: | |||
1517 | tsk = current; | 1552 | tsk = current; |
1518 | do { | 1553 | do { |
1519 | struct task_struct *p; | 1554 | struct task_struct *p; |
1520 | struct list_head *_p; | ||
1521 | int ret; | 1555 | int ret; |
1522 | 1556 | ||
1523 | list_for_each(_p,&tsk->children) { | 1557 | list_for_each_entry(p, &tsk->children, sibling) { |
1524 | p = list_entry(_p, struct task_struct, sibling); | ||
1525 | |||
1526 | ret = eligible_child(pid, options, p); | 1558 | ret = eligible_child(pid, options, p); |
1527 | if (!ret) | 1559 | if (!ret) |
1528 | continue; | 1560 | continue; |
@@ -1604,9 +1636,8 @@ check_continued: | |||
1604 | } | 1636 | } |
1605 | } | 1637 | } |
1606 | if (!flag) { | 1638 | if (!flag) { |
1607 | list_for_each(_p, &tsk->ptrace_children) { | 1639 | list_for_each_entry(p, &tsk->ptrace_children, |
1608 | p = list_entry(_p, struct task_struct, | 1640 | ptrace_list) { |
1609 | ptrace_list); | ||
1610 | if (!eligible_child(pid, options, p)) | 1641 | if (!eligible_child(pid, options, p)) |
1611 | continue; | 1642 | continue; |
1612 | flag = 1; | 1643 | flag = 1; |