The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Davide Libenzi <davidel@xmailserver.org>,
	Jan Engelhardt <jengelh@linux01.gwdg.de>,
	Ingo Molnar <mingo@elte.hu>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Robin Holt <holt@sgi.com>, Roland McGrath <roland@redhat.com>,
	"Serge E. Hallyn" <serge@hallyn.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] make kernel threads invisible to /sbin/init
Date: Wed, 11 Apr 2007 15:42:05 +0400	[thread overview]
Message-ID: <20070411114205.GA127@tv-sign.ru> (raw)
In-Reply-To: <m1wt0jva1i.fsf@ebiederm.dsl.xmission.com>

On 04/10, Eric W. Biederman wrote:
>
> Oleg Nesterov <oleg@tv-sign.ru> writes:
> 
> > 1. rename reparent_to_init() to reparent_kthread() and export it
> >
> > 2. use init_pid_ns.child_reaper instead of child_reaper(current)
> >
> > 3. set ->exit_signal = -1, so init can't see us and we don't use
> >    it to reap the task.
> >
> > 4. add reparent_kthread() to kthread() and stopmachine()
> >
> 
> If the goal is to hide from /sbin/init.  We don't need to touch
> kernel/kthread.c or 
> kernel/stop_machine.c
> 
> Their parents are already kernel threads.
> 
> For the kernel thread they all inherit signals with SIGCHLD set to
> SIG_IGN, so there is child auto reaping in that form.  Adding
> the ->exit_signal = -1 would be a bonus but is not required.

Unless a kernel thread does kernel_thread() (not kthread_create) and
exits. In that case the child will be re-parented to init which doesn't
ignore SIGCHLD.

Robin Holt wrote:
>
> wait_task_zombie() is taking many seconds to get through the list.
> For the case of a modprobe, stop_machine creates one thread per cpu
> (remember big number). All are parented to init and their exit will
> cause wait_task_zombie to scan multiple times most of the way through
> this very long list looking for threads which need to be reaped.

initially, "stopmachine" threads were not parented to init.

However, I agree, your patch is better, and solves most problems in more
simple way. Including the above problem, I believe. "stopmachine" likely
does exit_notify() and notices SIG_IGN (inherited from kthreadd_setup())
before "do_stop" does forget_original_parent().

Oleg.


  reply	other threads:[~2007-04-11 11:42 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-10 18:51 [PATCH 2/3] make kernel threads invisible to /sbin/init Oleg Nesterov
2007-04-10 23:16 ` Serge E. Hallyn
2007-04-11  3:29   ` Eric W. Biederman
2007-04-11  3:56 ` Eric W. Biederman
2007-04-11 11:42   ` Oleg Nesterov [this message]
2007-04-11  5:44 ` [PATCH] kthread: Don't depend on work queues Eric W. Biederman
2007-04-11  7:03   ` Andrew Morton
2007-04-11 10:13     ` Rafael J. Wysocki
2007-04-11 11:21       ` Gautham R Shenoy
2007-04-11 11:48         ` Oleg Nesterov
2007-04-11 13:31           ` Gautham R Shenoy
2007-04-11 14:36             ` Oleg Nesterov
2007-04-11 19:37               ` Rafael J. Wysocki
2007-04-11 14:44             ` Rafael J. Wysocki
2007-04-11 18:22     ` Eric W. Biederman
2007-04-11 18:27     ` [PATCH] kthread: Don't depend on work queues (take 2) Eric W. Biederman
2007-04-11 18:49       ` [PATCH] Change reparent_to_init to reparent_to_kthreadd Eric W. Biederman
2007-04-11 19:21       ` [PATCH] kthread: Don't depend on work queues (take 2) Andrew Morton
2007-04-11 19:28       ` Oleg Nesterov
2007-04-11 19:40         ` Eric W. Biederman
2007-04-11 19:49           ` Oleg Nesterov
2007-04-11 20:02             ` Eric W. Biederman
2007-04-11 12:04   ` [PATCH] kthread: Don't depend on work queues Oleg Nesterov
2007-04-11 16:25     ` Eric W. Biederman
2007-04-11 13:15   ` Oleg Nesterov
2007-04-11 16:22     ` Eric W. Biederman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070411114205.GA127@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=akpm@linux-foundation.org \
    --cc=davidel@xmailserver.org \
    --cc=ebiederm@xmission.com \
    --cc=holt@sgi.com \
    --cc=jengelh@linux01.gwdg.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=roland@redhat.com \
    --cc=serge@hallyn.com \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox