diff options
Diffstat (limited to 'kernel/sys.c')
-rw-r--r-- | kernel/sys.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/kernel/sys.c b/kernel/sys.c index 7d4a9a6df956..b07adca97ea3 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -2063,6 +2063,24 @@ static int prctl_get_tid_address(struct task_struct *me, int __user **tid_addr) | |||
2063 | } | 2063 | } |
2064 | #endif | 2064 | #endif |
2065 | 2065 | ||
2066 | static int propagate_has_child_subreaper(struct task_struct *p, void *data) | ||
2067 | { | ||
2068 | /* | ||
2069 | * If task has has_child_subreaper - all its decendants | ||
2070 | * already have these flag too and new decendants will | ||
2071 | * inherit it on fork, skip them. | ||
2072 | * | ||
2073 | * If we've found child_reaper - skip descendants in | ||
2074 | * it's subtree as they will never get out pidns. | ||
2075 | */ | ||
2076 | if (p->signal->has_child_subreaper || | ||
2077 | is_child_reaper(task_pid(p))) | ||
2078 | return 0; | ||
2079 | |||
2080 | p->signal->has_child_subreaper = 1; | ||
2081 | return 1; | ||
2082 | } | ||
2083 | |||
2066 | SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, | 2084 | SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, |
2067 | unsigned long, arg4, unsigned long, arg5) | 2085 | unsigned long, arg4, unsigned long, arg5) |
2068 | { | 2086 | { |
@@ -2214,6 +2232,10 @@ SYSCALL_DEFINE5(prctl, int, option, unsigned long, arg2, unsigned long, arg3, | |||
2214 | break; | 2232 | break; |
2215 | case PR_SET_CHILD_SUBREAPER: | 2233 | case PR_SET_CHILD_SUBREAPER: |
2216 | me->signal->is_child_subreaper = !!arg2; | 2234 | me->signal->is_child_subreaper = !!arg2; |
2235 | if (!arg2) | ||
2236 | break; | ||
2237 | |||
2238 | walk_process_tree(me, propagate_has_child_subreaper, NULL); | ||
2217 | break; | 2239 | break; |
2218 | case PR_GET_CHILD_SUBREAPER: | 2240 | case PR_GET_CHILD_SUBREAPER: |
2219 | error = put_user(me->signal->is_child_subreaper, | 2241 | error = put_user(me->signal->is_child_subreaper, |