All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pid_ns: zap_pid_ns_processes: use SEND_SIG_NOINFO instead of force_sig()
       [not found]                 ` <20100303193003.GA10734@redhat.com>
@ 2010-03-03 20:26                   ` Oleg Nesterov
  2010-03-04  7:20                     ` Serge E. Hallyn
                                       ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Oleg Nesterov @ 2010-03-03 20:26 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Roland McGrath, wylda, gregkh, jkosina, Linus Torvalds,
	Sukadev Bhattiprolu, Serge Hallyn, linux-kernel

zap_pid_ns_processes() uses force_sig(SIGKILL) to ensure SIGKILL
will be delivered to sub-namespace inits as well. This is correct,
but we are going to change force_sig_info() semantics.
See http://bugzilla.kernel.org/show_bug.cgi?id=15395#c31

We can use send_sig_info(SEND_SIG_NOINFO) instead, since
614c517d7c00af1b26ded20646b329397d6f51a1 SEND_SIG_NOINFO means
"from user" and therefore send_signal() will get the correct
from_ancestor_ns = T flag.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---

 kernel/pid_namespace.c |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

--- mm/kernel/pid_namespace.c~NS_DONT_ABUSE_FORCE	2010-02-25 15:22:13.000000000 +0100
+++ mm/kernel/pid_namespace.c	2010-03-03 20:58:12.000000000 +0100
@@ -161,13 +161,12 @@ void zap_pid_ns_processes(struct pid_nam
 		rcu_read_lock();
 
 		/*
-		 * Use force_sig() since it clears SIGNAL_UNKILLABLE ensuring
-		 * any nested-container's init processes don't ignore the
-		 * signal
+		 * Any nested-container's init processes won't ignore the
+		 * SEND_SIG_NOINFO signal, see send_signal()->si_fromuser().
 		 */
 		task = pid_task(find_vpid(nr), PIDTYPE_PID);
 		if (task)
-			force_sig(SIGKILL, task);
+			send_sig_info(SIGKILL, SEND_SIG_NOINFO, task);
 
 		rcu_read_unlock();
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pid_ns: zap_pid_ns_processes: use SEND_SIG_NOINFO instead of force_sig()
  2010-03-03 20:26                   ` [PATCH] pid_ns: zap_pid_ns_processes: use SEND_SIG_NOINFO instead of force_sig() Oleg Nesterov
@ 2010-03-04  7:20                     ` Serge E. Hallyn
  2010-03-04 16:06                     ` Linus Torvalds
  2010-03-04 20:48                     ` Roland McGrath
  2 siblings, 0 replies; 4+ messages in thread
From: Serge E. Hallyn @ 2010-03-04  7:20 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, Roland McGrath, wylda, gregkh, jkosina,
	Linus Torvalds, Sukadev Bhattiprolu, linux-kernel

Quoting Oleg Nesterov (oleg@redhat.com):
> zap_pid_ns_processes() uses force_sig(SIGKILL) to ensure SIGKILL
> will be delivered to sub-namespace inits as well. This is correct,
> but we are going to change force_sig_info() semantics.
> See http://bugzilla.kernel.org/show_bug.cgi?id=15395#c31
> 
> We can use send_sig_info(SEND_SIG_NOINFO) instead, since
> 614c517d7c00af1b26ded20646b329397d6f51a1 SEND_SIG_NOINFO means
> "from user" and therefore send_signal() will get the correct
> from_ancestor_ns = T flag.
> 
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>

Justification makes sense, and (in some superficial testing, killing some
nested pid_ns's) the patch seems to do the right thing.

Acked-by: Serge Hallyn <serue@us.ibm.com>

> ---
> 
>  kernel/pid_namespace.c |    7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> --- mm/kernel/pid_namespace.c~NS_DONT_ABUSE_FORCE	2010-02-25 15:22:13.000000000 +0100
> +++ mm/kernel/pid_namespace.c	2010-03-03 20:58:12.000000000 +0100
> @@ -161,13 +161,12 @@ void zap_pid_ns_processes(struct pid_nam
>  		rcu_read_lock();
> 
>  		/*
> -		 * Use force_sig() since it clears SIGNAL_UNKILLABLE ensuring
> -		 * any nested-container's init processes don't ignore the
> -		 * signal
> +		 * Any nested-container's init processes won't ignore the
> +		 * SEND_SIG_NOINFO signal, see send_signal()->si_fromuser().
>  		 */
>  		task = pid_task(find_vpid(nr), PIDTYPE_PID);
>  		if (task)
> -			force_sig(SIGKILL, task);
> +			send_sig_info(SIGKILL, SEND_SIG_NOINFO, task);
> 
>  		rcu_read_unlock();
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pid_ns: zap_pid_ns_processes: use SEND_SIG_NOINFO instead of force_sig()
  2010-03-03 20:26                   ` [PATCH] pid_ns: zap_pid_ns_processes: use SEND_SIG_NOINFO instead of force_sig() Oleg Nesterov
  2010-03-04  7:20                     ` Serge E. Hallyn
@ 2010-03-04 16:06                     ` Linus Torvalds
  2010-03-04 20:48                     ` Roland McGrath
  2 siblings, 0 replies; 4+ messages in thread
From: Linus Torvalds @ 2010-03-04 16:06 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, Roland McGrath, wylda, gregkh, jkosina,
	Sukadev Bhattiprolu, Serge Hallyn, linux-kernel



On Wed, 3 Mar 2010, Oleg Nesterov wrote:
>
> zap_pid_ns_processes() uses force_sig(SIGKILL) to ensure SIGKILL
> will be delivered to sub-namespace inits as well. This is correct,
> but we are going to change force_sig_info() semantics.
> See http://bugzilla.kernel.org/show_bug.cgi?id=15395#c31
> 
> We can use send_sig_info(SEND_SIG_NOINFO) instead, since
> 614c517d7c00af1b26ded20646b329397d6f51a1 SEND_SIG_NOINFO means
> "from user" and therefore send_signal() will get the correct
> from_ancestor_ns = T flag.
> 
> Signed-off-by: Oleg Nesterov <oleg@redhat.com>

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>

			Linus

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] pid_ns: zap_pid_ns_processes: use SEND_SIG_NOINFO instead of force_sig()
  2010-03-03 20:26                   ` [PATCH] pid_ns: zap_pid_ns_processes: use SEND_SIG_NOINFO instead of force_sig() Oleg Nesterov
  2010-03-04  7:20                     ` Serge E. Hallyn
  2010-03-04 16:06                     ` Linus Torvalds
@ 2010-03-04 20:48                     ` Roland McGrath
  2 siblings, 0 replies; 4+ messages in thread
From: Roland McGrath @ 2010-03-04 20:48 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Andrew Morton, wylda, gregkh, jkosina, Linus Torvalds,
	Sukadev Bhattiprolu, Serge Hallyn, linux-kernel

Acked-by: Roland McGrath <roland@redhat.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-03-04 20:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <alpine.LFD.2.00.1003021136400.3616@localhost.localdomain>
     [not found] ` <20100302201646.GA10734@redhat.com>
     [not found]   ` <alpine.LFD.2.00.1003021223060.3616@localhost.localdomain>
     [not found]     ` <20100303013227.4FFDE89EB@magilla.sf.frob.com>
     [not found]       ` <alpine.LFD.2.00.1003021740560.3616@localhost.localdomain>
     [not found]         ` <20100303112343.B89802F@magilla.sf.frob.com>
     [not found]           ` <alpine.LFD.2.00.1003030930100.3627@localhost.localdomain>
     [not found]             ` <20100303184412.GA7816@redhat.com>
     [not found]               ` <alpine.LFD.2.00.1003031053050.3599@localhost.localdomain>
     [not found]                 ` <20100303193003.GA10734@redhat.com>
2010-03-03 20:26                   ` [PATCH] pid_ns: zap_pid_ns_processes: use SEND_SIG_NOINFO instead of force_sig() Oleg Nesterov
2010-03-04  7:20                     ` Serge E. Hallyn
2010-03-04 16:06                     ` Linus Torvalds
2010-03-04 20:48                     ` Roland McGrath

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.