public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [RFC] is_global_init() called on global init sub-thread
@ 2015-12-30  6:25 Sergey Senozhatsky
  2016-01-01  1:08 ` Serge E. Hallyn
  0 siblings, 1 reply; 7+ messages in thread
From: Sergey Senozhatsky @ 2015-12-30  6:25 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: Peter Zijlstra, Andrew Morton, Richard Guy Briggs,
	Eric W. Biederman, Serge E. Hallyn, linux-kernel,
	Sergey Senozhatsky, Sergey Senozhatsky

Hello,

re-upping https://www.redhat.com/archives/linux-audit/2013-December/msg00086.html

Oleg Nesterov wrote:

:Because is_global_init() is only true for the main thread of /sbin/init.
:
:Just look at oom_unkillable_task(). It tries to not kill init. But, say,
:select_bad_process() can happily find a sub-thread of is_global_init()
:and still kill it.

this is still the case, isn't it? at least in some -stable kernels.
is there (or was there) any reason this change has never been committed?
(I'm particularly interested in is_global_init()).

 static inline int is_global_init(struct task_struct *tsk)
 {
-	return tsk->pid == 1;
+	return task_tgid_nr(tsk) == 1;
 }

	-ss

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

* Re: [RFC] is_global_init() called on global init sub-thread
  2015-12-30  6:25 [RFC] is_global_init() called on global init sub-thread Sergey Senozhatsky
@ 2016-01-01  1:08 ` Serge E. Hallyn
  2016-01-01  1:10   ` Sergey Senozhatsky
  0 siblings, 1 reply; 7+ messages in thread
From: Serge E. Hallyn @ 2016-01-01  1:08 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Oleg Nesterov, Peter Zijlstra, Andrew Morton, Richard Guy Briggs,
	Eric W. Biederman, Serge E. Hallyn, linux-kernel,
	Sergey Senozhatsky

On Wed, Dec 30, 2015 at 03:25:42PM +0900, Sergey Senozhatsky wrote:
> Hello,
> 
> re-upping https://www.redhat.com/archives/linux-audit/2013-December/msg00086.html
> 
> Oleg Nesterov wrote:
> 
> :Because is_global_init() is only true for the main thread of /sbin/init.
> :
> :Just look at oom_unkillable_task(). It tries to not kill init. But, say,
> :select_bad_process() can happily find a sub-thread of is_global_init()
> :and still kill it.
> 
> this is still the case, isn't it? at least in some -stable kernels.
> is there (or was there) any reason this change has never been committed?
> (I'm particularly interested in is_global_init()).

...  seems like it makes sense.  Can you remind us which init you're having
to deal with?

>  static inline int is_global_init(struct task_struct *tsk)
>  {
> -	return tsk->pid == 1;
> +	return task_tgid_nr(tsk) == 1;
>  }
> 
> 	-ss

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

* Re: [RFC] is_global_init() called on global init sub-thread
  2016-01-01  1:08 ` Serge E. Hallyn
@ 2016-01-01  1:10   ` Sergey Senozhatsky
  2016-01-01  1:18     ` Serge E. Hallyn
  0 siblings, 1 reply; 7+ messages in thread
From: Sergey Senozhatsky @ 2016-01-01  1:10 UTC (permalink / raw)
  To: Serge E. Hallyn
  Cc: Sergey Senozhatsky, Oleg Nesterov, Peter Zijlstra, Andrew Morton,
	Richard Guy Briggs, Eric W. Biederman, Serge E. Hallyn,
	linux-kernel, Sergey Senozhatsky

On (12/31/15 19:08), Serge E. Hallyn wrote:
> > re-upping https://www.redhat.com/archives/linux-audit/2013-December/msg00086.html
> > 
> > Oleg Nesterov wrote:
> > 
> > :Because is_global_init() is only true for the main thread of /sbin/init.
> > :
> > :Just look at oom_unkillable_task(). It tries to not kill init. But, say,
> > :select_bad_process() can happily find a sub-thread of is_global_init()
> > :and still kill it.
> > 
> > this is still the case, isn't it? at least in some -stable kernels.
> > is there (or was there) any reason this change has never been committed?
> > (I'm particularly interested in is_global_init()).
> 
> ...  seems like it makes sense.  Can you remind us which init you're having
> to deal with?
> 

systemd

	-ss

> >  static inline int is_global_init(struct task_struct *tsk)
> >  {
> > -	return tsk->pid == 1;
> > +	return task_tgid_nr(tsk) == 1;
> >  }

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

* Re: [RFC] is_global_init() called on global init sub-thread
  2016-01-01  1:10   ` Sergey Senozhatsky
@ 2016-01-01  1:18     ` Serge E. Hallyn
  2016-01-01  1:33       ` Sergey Senozhatsky
  0 siblings, 1 reply; 7+ messages in thread
From: Serge E. Hallyn @ 2016-01-01  1:18 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Serge E. Hallyn, Sergey Senozhatsky, Oleg Nesterov,
	Peter Zijlstra, Andrew Morton, Richard Guy Briggs,
	Eric W. Biederman, Serge E. Hallyn, linux-kernel

On Fri, Jan 01, 2016 at 10:10:35AM +0900, Sergey Senozhatsky wrote:
> On (12/31/15 19:08), Serge E. Hallyn wrote:
> > > re-upping https://www.redhat.com/archives/linux-audit/2013-December/msg00086.html
> > > 
> > > Oleg Nesterov wrote:
> > > 
> > > :Because is_global_init() is only true for the main thread of /sbin/init.
> > > :
> > > :Just look at oom_unkillable_task(). It tries to not kill init. But, say,
> > > :select_bad_process() can happily find a sub-thread of is_global_init()
> > > :and still kill it.
> > > 
> > > this is still the case, isn't it? at least in some -stable kernels.
> > > is there (or was there) any reason this change has never been committed?
> > > (I'm particularly interested in is_global_init()).
> > 
> > ...  seems like it makes sense.  Can you remind us which init you're having
> > to deal with?
> > 
> 
> systemd
> 
> 	-ss

Well it makes sense to me.  The question is whether we are protecting the
thing running as init, or the 'physical' thread with pid 1.  I think it's
the former, so let's push on this.  Please resend the patch with a proper
signed-off-by, and feel free to add

Acked-by: Serge Hallyn <serge.hallyn@canonical.com>


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

* Re: [RFC] is_global_init() called on global init sub-thread
  2016-01-01  1:18     ` Serge E. Hallyn
@ 2016-01-01  1:33       ` Sergey Senozhatsky
  2016-01-01  2:28         ` Serge E. Hallyn
  2016-01-04  7:51         ` Richard Guy Briggs
  0 siblings, 2 replies; 7+ messages in thread
From: Sergey Senozhatsky @ 2016-01-01  1:33 UTC (permalink / raw)
  To: Serge E. Hallyn
  Cc: Sergey Senozhatsky, Sergey Senozhatsky, Oleg Nesterov,
	Peter Zijlstra, Andrew Morton, Richard Guy Briggs,
	Eric W. Biederman, Serge E. Hallyn, linux-kernel

On (12/31/15 19:18), Serge E. Hallyn wrote:
> On Fri, Jan 01, 2016 at 10:10:35AM +0900, Sergey Senozhatsky wrote:
> > On (12/31/15 19:08), Serge E. Hallyn wrote:
> > > > re-upping https://www.redhat.com/archives/linux-audit/2013-December/msg00086.html
> > > > 
> > > > Oleg Nesterov wrote:
> > > > 
> > > > :Because is_global_init() is only true for the main thread of /sbin/init.
> > > > :
> > > > :Just look at oom_unkillable_task(). It tries to not kill init. But, say,
> > > > :select_bad_process() can happily find a sub-thread of is_global_init()
> > > > :and still kill it.
> > > > 
> > > > this is still the case, isn't it? at least in some -stable kernels.
> > > > is there (or was there) any reason this change has never been committed?
> > > > (I'm particularly interested in is_global_init()).
> > > 
> > > ...  seems like it makes sense.  Can you remind us which init you're having
> > > to deal with?
> > > 
> > 
> > systemd
> > 
> > 	-ss
> 
> Well it makes sense to me.  The question is whether we are protecting the
> thing running as init, or the 'physical' thread with pid 1.  I think it's
> the former, so let's push on this.  Please resend the patch with a proper
> signed-off-by, and feel free to add

thanks. a bit puzzled, would reported-by Oleg and suggested-by Richard
be appropriate? (no objections if Oleg or Richard will submit it).

> Acked-by: Serge Hallyn <serge.hallyn@canonical.com>

	-ss

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

* Re: [RFC] is_global_init() called on global init sub-thread
  2016-01-01  1:33       ` Sergey Senozhatsky
@ 2016-01-01  2:28         ` Serge E. Hallyn
  2016-01-04  7:51         ` Richard Guy Briggs
  1 sibling, 0 replies; 7+ messages in thread
From: Serge E. Hallyn @ 2016-01-01  2:28 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Serge E. Hallyn, Sergey Senozhatsky, Oleg Nesterov,
	Peter Zijlstra, Andrew Morton, Richard Guy Briggs,
	Eric W. Biederman, Serge E. Hallyn, linux-kernel

On Fri, Jan 01, 2016 at 10:33:53AM +0900, Sergey Senozhatsky wrote:
> On (12/31/15 19:18), Serge E. Hallyn wrote:
> > On Fri, Jan 01, 2016 at 10:10:35AM +0900, Sergey Senozhatsky wrote:
> > > On (12/31/15 19:08), Serge E. Hallyn wrote:
> > > > > re-upping https://www.redhat.com/archives/linux-audit/2013-December/msg00086.html
> > > > > 
> > > > > Oleg Nesterov wrote:
> > > > > 
> > > > > :Because is_global_init() is only true for the main thread of /sbin/init.
> > > > > :
> > > > > :Just look at oom_unkillable_task(). It tries to not kill init. But, say,
> > > > > :select_bad_process() can happily find a sub-thread of is_global_init()
> > > > > :and still kill it.
> > > > > 
> > > > > this is still the case, isn't it? at least in some -stable kernels.
> > > > > is there (or was there) any reason this change has never been committed?
> > > > > (I'm particularly interested in is_global_init()).
> > > > 
> > > > ...  seems like it makes sense.  Can you remind us which init you're having
> > > > to deal with?
> > > > 
> > > 
> > > systemd
> > > 
> > > 	-ss
> > 
> > Well it makes sense to me.  The question is whether we are protecting the
> > thing running as init, or the 'physical' thread with pid 1.  I think it's
> > the former, so let's push on this.  Please resend the patch with a proper
> > signed-off-by, and feel free to add
> 
> thanks. a bit puzzled, would reported-by Oleg and suggested-by Richard
> be appropriate?

Sounds good.

>  (no objections if Oleg or Richard will submit it).

> > Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
> 
> 	-ss

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

* Re: [RFC] is_global_init() called on global init sub-thread
  2016-01-01  1:33       ` Sergey Senozhatsky
  2016-01-01  2:28         ` Serge E. Hallyn
@ 2016-01-04  7:51         ` Richard Guy Briggs
  1 sibling, 0 replies; 7+ messages in thread
From: Richard Guy Briggs @ 2016-01-04  7:51 UTC (permalink / raw)
  To: Sergey Senozhatsky
  Cc: Serge E. Hallyn, Sergey Senozhatsky, Oleg Nesterov,
	Peter Zijlstra, Andrew Morton, Eric W. Biederman, Serge E. Hallyn,
	linux-kernel

On 16/01/01, Sergey Senozhatsky wrote:
> On (12/31/15 19:18), Serge E. Hallyn wrote:
> > On Fri, Jan 01, 2016 at 10:10:35AM +0900, Sergey Senozhatsky wrote:
> > > On (12/31/15 19:08), Serge E. Hallyn wrote:
> > > > > re-upping https://www.redhat.com/archives/linux-audit/2013-December/msg00086.html
> > > > > 
> > > > > Oleg Nesterov wrote:
> > > > > 
> > > > > :Because is_global_init() is only true for the main thread of /sbin/init.
> > > > > :
> > > > > :Just look at oom_unkillable_task(). It tries to not kill init. But, say,
> > > > > :select_bad_process() can happily find a sub-thread of is_global_init()
> > > > > :and still kill it.
> > > > > 
> > > > > this is still the case, isn't it? at least in some -stable kernels.
> > > > > is there (or was there) any reason this change has never been committed?
> > > > > (I'm particularly interested in is_global_init()).
> > > > 
> > > > ...  seems like it makes sense.  Can you remind us which init you're having
> > > > to deal with?
> > > > 
> > > 
> > > systemd
> > > 
> > > 	-ss
> > 
> > Well it makes sense to me.  The question is whether we are protecting the
> > thing running as init, or the 'physical' thread with pid 1.  I think it's
> > the former, so let's push on this.  Please resend the patch with a proper
> > signed-off-by, and feel free to add
> 
> thanks. a bit puzzled, would reported-by Oleg and suggested-by Richard
> be appropriate? (no objections if Oleg or Richard will submit it).

This works for me.  I have more patches related to it, but I'll
re-submit them later.

> > Acked-by: Serge Hallyn <serge.hallyn@canonical.com>
> 
> 	-ss

- RGB

--
Richard Guy Briggs <rbriggs@redhat.com>
Senior Software Engineer, Kernel Security, AMER ENG Base Operating Systems, Red Hat
Remote, Ottawa, Canada
Voice: +1.647.777.2635, Internal: (81) 32635, Alt: +1.613.693.0684x3545

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

end of thread, other threads:[~2016-01-04  7:51 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-30  6:25 [RFC] is_global_init() called on global init sub-thread Sergey Senozhatsky
2016-01-01  1:08 ` Serge E. Hallyn
2016-01-01  1:10   ` Sergey Senozhatsky
2016-01-01  1:18     ` Serge E. Hallyn
2016-01-01  1:33       ` Sergey Senozhatsky
2016-01-01  2:28         ` Serge E. Hallyn
2016-01-04  7:51         ` Richard Guy Briggs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox