* [PATCH 2/2] signals: replace p->pid == 1 check with a check for task_child_reaper
@ 2008-07-17 14:56 ` Daniel Hokka Zakrisson
0 siblings, 0 replies; 8+ messages in thread
From: Daniel Hokka Zakrisson @ 2008-07-17 14:56 UTC (permalink / raw)
To: linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
xemul-GEFAQzZX7r8dnm+yROfE0A, oleg-6lXkIZvqkOAvJsYlp49lxw,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
ebiederm-aS9lmoZGLiVWk0Htik3J/w
p->pid == 1 is insufficient when there are multiple pid namespaces.
Instead, check whether the task is in the current task's
child reaper's thread group.
Signed-off-by: Daniel Hokka Zakrisson <daniel-nym3zxDgnZcAvxtiuMwx3w@public.gmane.org>
diff --git a/kernel/signal.c b/kernel/signal.c
index 93713a5..be932b9 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1142,10 +1142,20 @@ static int kill_something_info(int sig, struct
siginfo *info, int pid)
pid ? find_vpid(-pid) : task_pgrp(current));
} else {
int retval = 0, count = 0;
- struct task_struct * p;
+ struct task_struct *p, *reaper = task_child_reaper(current);
+
+ /*
+ * The reaper has died, so there's probably a
+ * SIGKILL pending. Return.
+ */
+ if (unlikely(!reaper)) {
+ ret = -ESRCH;
+ goto out;
+ }
for_each_process(p) {
- if (p->pid > 1 && !same_thread_group(p, current) &&
+ if (!same_thread_group(p, reaper) &&
+ !same_thread_group(p, current) &&
task_in_pid_ns(p, current->nsproxy->pid_ns)) {
int err = group_send_sig_info(sig, info, p);
++count;
@@ -1155,6 +1165,7 @@ static int kill_something_info(int sig, struct
siginfo *info, int pid)
}
ret = count ? retval : -ESRCH;
}
+out:
read_unlock(&tasklist_lock);
return ret;
--
1.5.5.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] signals: replace p->pid == 1 check with a check for task_child_reaper
@ 2008-07-17 14:56 ` Daniel Hokka Zakrisson
0 siblings, 0 replies; 8+ messages in thread
From: Daniel Hokka Zakrisson @ 2008-07-17 14:56 UTC (permalink / raw)
To: linux-kernel; +Cc: containers, oleg, ebiederm, xemul, akpm
p->pid == 1 is insufficient when there are multiple pid namespaces.
Instead, check whether the task is in the current task's
child reaper's thread group.
Signed-off-by: Daniel Hokka Zakrisson <daniel@hozac.com>
diff --git a/kernel/signal.c b/kernel/signal.c
index 93713a5..be932b9 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1142,10 +1142,20 @@ static int kill_something_info(int sig, struct
siginfo *info, int pid)
pid ? find_vpid(-pid) : task_pgrp(current));
} else {
int retval = 0, count = 0;
- struct task_struct * p;
+ struct task_struct *p, *reaper = task_child_reaper(current);
+
+ /*
+ * The reaper has died, so there's probably a
+ * SIGKILL pending. Return.
+ */
+ if (unlikely(!reaper)) {
+ ret = -ESRCH;
+ goto out;
+ }
for_each_process(p) {
- if (p->pid > 1 && !same_thread_group(p, current) &&
+ if (!same_thread_group(p, reaper) &&
+ !same_thread_group(p, current) &&
task_in_pid_ns(p, current->nsproxy->pid_ns)) {
int err = group_send_sig_info(sig, info, p);
++count;
@@ -1155,6 +1165,7 @@ static int kill_something_info(int sig, struct
siginfo *info, int pid)
}
ret = count ? retval : -ESRCH;
}
+out:
read_unlock(&tasklist_lock);
return ret;
--
1.5.5.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] signals: replace p->pid == 1 check with a check for task_child_reaper
[not found] ` <487F5DA1.6000107-nym3zxDgnZcAvxtiuMwx3w@public.gmane.org>
@ 2008-07-17 17:55 ` Eric W. Biederman
0 siblings, 0 replies; 8+ messages in thread
From: Eric W. Biederman @ 2008-07-17 17:55 UTC (permalink / raw)
To: Daniel Hokka Zakrisson
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
xemul-GEFAQzZX7r8dnm+yROfE0A, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
oleg-6lXkIZvqkOAvJsYlp49lxw
Daniel Hokka Zakrisson <daniel-nym3zxDgnZcAvxtiuMwx3w@public.gmane.org> writes:
> p->pid == 1 is insufficient when there are multiple pid namespaces.
> Instead, check whether the task is in the current task's
> child reaper's thread group.
We should just drop the check for init as it is redundant.
Eric
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] signals: replace p->pid == 1 check with a check for task_child_reaper
2008-07-17 14:56 ` Daniel Hokka Zakrisson
(?)
@ 2008-07-17 17:55 ` Eric W. Biederman
2008-07-17 18:21 ` Daniel Hokka Zakrisson
[not found] ` <m14p6ov1j0.fsf-B27657KtZYmhTnVgQlOflh2eb7JE58TQ@public.gmane.org>
-1 siblings, 2 replies; 8+ messages in thread
From: Eric W. Biederman @ 2008-07-17 17:55 UTC (permalink / raw)
To: Daniel Hokka Zakrisson; +Cc: linux-kernel, containers, oleg, xemul, akpm
Daniel Hokka Zakrisson <daniel@hozac.com> writes:
> p->pid == 1 is insufficient when there are multiple pid namespaces.
> Instead, check whether the task is in the current task's
> child reaper's thread group.
We should just drop the check for init as it is redundant.
Eric
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] signals: replace p->pid == 1 check with a check for task_child_reaper
[not found] ` <m14p6ov1j0.fsf-B27657KtZYmhTnVgQlOflh2eb7JE58TQ@public.gmane.org>
@ 2008-07-17 18:21 ` Daniel Hokka Zakrisson
0 siblings, 0 replies; 8+ messages in thread
From: Daniel Hokka Zakrisson @ 2008-07-17 18:21 UTC (permalink / raw)
To: Eric W. Biederman
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
xemul-GEFAQzZX7r8dnm+yROfE0A, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
oleg-6lXkIZvqkOAvJsYlp49lxw
Eric W. Biederman wrote:
> Daniel Hokka Zakrisson <daniel-nym3zxDgnZcAvxtiuMwx3w@public.gmane.org> writes:
>
>> p->pid == 1 is insufficient when there are multiple pid namespaces.
>> Instead, check whether the task is in the current task's
>> child reaper's thread group.
>
> We should just drop the check for init as it is redundant.
I'm not sure what you mean? Without protecting init here, kill -s 9 -- -1
will kill it (i.e. the init in the pid namespace). E.g.:
# vspace --new --pid --mount -- bash
# bash -c 'kill -s 9 -- -1'
will kill off all those processes, and dispose of the pid namespace.
> Eric
--
Daniel Hokka Zakrisson
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] signals: replace p->pid == 1 check with a check for task_child_reaper
2008-07-17 17:55 ` Eric W. Biederman
@ 2008-07-17 18:21 ` Daniel Hokka Zakrisson
2008-07-17 18:51 ` Eric W. Biederman
2008-07-17 18:51 ` Eric W. Biederman
[not found] ` <m14p6ov1j0.fsf-B27657KtZYmhTnVgQlOflh2eb7JE58TQ@public.gmane.org>
1 sibling, 2 replies; 8+ messages in thread
From: Daniel Hokka Zakrisson @ 2008-07-17 18:21 UTC (permalink / raw)
To: Eric W. Biederman; +Cc: linux-kernel, containers, oleg, xemul, akpm
Eric W. Biederman wrote:
> Daniel Hokka Zakrisson <daniel@hozac.com> writes:
>
>> p->pid == 1 is insufficient when there are multiple pid namespaces.
>> Instead, check whether the task is in the current task's
>> child reaper's thread group.
>
> We should just drop the check for init as it is redundant.
I'm not sure what you mean? Without protecting init here, kill -s 9 -- -1
will kill it (i.e. the init in the pid namespace). E.g.:
# vspace --new --pid --mount -- bash
# bash -c 'kill -s 9 -- -1'
will kill off all those processes, and dispose of the pid namespace.
> Eric
--
Daniel Hokka Zakrisson
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] signals: replace p->pid == 1 check with a check for task_child_reaper
2008-07-17 18:21 ` Daniel Hokka Zakrisson
@ 2008-07-17 18:51 ` Eric W. Biederman
2008-07-17 18:51 ` Eric W. Biederman
1 sibling, 0 replies; 8+ messages in thread
From: Eric W. Biederman @ 2008-07-17 18:51 UTC (permalink / raw)
To: Daniel Hokka Zakrisson
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA,
xemul-GEFAQzZX7r8dnm+yROfE0A, linux-kernel-u79uwXL29TY76Z2rM5mHXA,
akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b,
oleg-6lXkIZvqkOAvJsYlp49lxw
"Daniel Hokka Zakrisson" <daniel-nym3zxDgnZcAvxtiuMwx3w@public.gmane.org> writes:
> Eric W. Biederman wrote:
>> Daniel Hokka Zakrisson <daniel-nym3zxDgnZcAvxtiuMwx3w@public.gmane.org> writes:
>>
>>> p->pid == 1 is insufficient when there are multiple pid namespaces.
>>> Instead, check whether the task is in the current task's
>>> child reaper's thread group.
>>
>> We should just drop the check for init as it is redundant.
Sorry that was a half truth. Outside of the context of pid namespaces it is true.
In the context of pid namespaces it is false because we haven't merged the patches
to drop signals from inside the pid namespace on the way to init.
So it is a check that _should_ be redundant.
Eric
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] signals: replace p->pid == 1 check with a check for task_child_reaper
2008-07-17 18:21 ` Daniel Hokka Zakrisson
2008-07-17 18:51 ` Eric W. Biederman
@ 2008-07-17 18:51 ` Eric W. Biederman
1 sibling, 0 replies; 8+ messages in thread
From: Eric W. Biederman @ 2008-07-17 18:51 UTC (permalink / raw)
To: Daniel Hokka Zakrisson; +Cc: linux-kernel, containers, oleg, xemul, akpm
"Daniel Hokka Zakrisson" <daniel@hozac.com> writes:
> Eric W. Biederman wrote:
>> Daniel Hokka Zakrisson <daniel@hozac.com> writes:
>>
>>> p->pid == 1 is insufficient when there are multiple pid namespaces.
>>> Instead, check whether the task is in the current task's
>>> child reaper's thread group.
>>
>> We should just drop the check for init as it is redundant.
Sorry that was a half truth. Outside of the context of pid namespaces it is true.
In the context of pid namespaces it is false because we haven't merged the patches
to drop signals from inside the pid namespace on the way to init.
So it is a check that _should_ be redundant.
Eric
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-07-17 18:52 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-17 14:56 [PATCH 2/2] signals: replace p->pid == 1 check with a check for task_child_reaper Daniel Hokka Zakrisson
2008-07-17 14:56 ` Daniel Hokka Zakrisson
2008-07-17 17:55 ` Eric W. Biederman
2008-07-17 18:21 ` Daniel Hokka Zakrisson
2008-07-17 18:51 ` Eric W. Biederman
2008-07-17 18:51 ` Eric W. Biederman
[not found] ` <m14p6ov1j0.fsf-B27657KtZYmhTnVgQlOflh2eb7JE58TQ@public.gmane.org>
2008-07-17 18:21 ` Daniel Hokka Zakrisson
[not found] ` <487F5DA1.6000107-nym3zxDgnZcAvxtiuMwx3w@public.gmane.org>
2008-07-17 17:55 ` Eric W. Biederman
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.