Skip to contentSkip to conversation

is_global_init() called on global init sub-thread

RFC Sergey Senozhatsky 4 participants 7 messages Dec 30, 2015 – Jan 4, 2016

lore
Share & tools
lore
#0 lore raw

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
#1 lore raw
Quoted 12 lines · 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.

Quoted 3 lines

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?

Quoted 7 lines

static inline int is_global_init(struct task_struct *tsk) {

(quoted diff) +1 -1
-	return tsk->pid == 1;
+	return task_tgid_nr(tsk) == 1;
 }
	-ss
#2 lore raw
Quoted 10 lines · Serge E. Hallyn
Quoted 10 lines

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.

Quoted 7 lines
Quoted 3 lines

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
Quoted 5 lines
Quoted 5 lines

static inline int is_global_init(struct task_struct *tsk) {

(quoted diff) +1 -1
-	return tsk->pid == 1;
+	return task_tgid_nr(tsk) == 1;
 }
Acked-by Serge Hallyn
#3 lore raw
Quoted 15 lines · Sergey Senozhatsky
Quoted 14 lines · Serge E. Hallyn
Quoted 13 lines

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()).

Quoted 7 lines
Quoted 3 lines

... 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

#4 lore raw
Quoted 20 lines · Serge E. Hallyn
Quoted 19 lines · Sergey Senozhatsky
Quoted 17 lines · Serge E. Hallyn
Quoted 10 lines

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.

Quoted 3 lines

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?

Quoted 8 lines
Quoted 3 lines

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).

Quoted 1 line
	-ss
#5 lore raw
Quoted 25 lines · Sergey Senozhatsky
Quoted 24 lines · Serge E. Hallyn
Quoted 22 lines · Sergey Senozhatsky
Quoted 10 lines · Serge E. Hallyn
Quoted 10 lines

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.

Quoted 7 lines
Quoted 3 lines

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
Quoted 7 lines
Quoted 4 lines

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.

Quoted 5 lines

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

Quoted 1 line
	-ss
#6 lore raw
In reply to Sergey Senozhatsky
Quoted 25 lines · Sergey Senozhatsky
Quoted 24 lines · Serge E. Hallyn
Quoted 22 lines · Sergey Senozhatsky
Quoted 10 lines · Serge E. Hallyn
Quoted 10 lines

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.

Quoted 7 lines
Quoted 3 lines

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
Quoted 7 lines
Quoted 4 lines

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.

Quoted 3 lines
Quoted 1 line
	-ss

- RGB

--
Richard Guy Briggs <[email protected]>
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