lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 6 Apr 2007 23:36:21 +0400
From:	Oleg Nesterov <oleg@...sign.ru>
To:	Linus Torvalds <torvalds@...ux-foundation.org>
Cc:	"Eric W. Biederman" <ebiederm@...ssion.com>,
	Robin Holt <holt@....com>, Chris Snook <csnook@...hat.com>,
	Ingo Molnar <mingo@...e.hu>, linux-kernel@...r.kernel.org
Subject: Re: init's children list is long and slows reaping children.

On 04/06, Linus Torvalds wrote:
> 
> On Fri, 6 Apr 2007, Oleg Nesterov wrote:
> > 
> > Oops. I misread stop_machine(), it does kernel_thread(), not kthread_create().
> > So "stopmachine" threads are all re-parented to init when the caller exits.
> > I think it makes sense to set ->exit_state = -1 in stopmachine(), regadless
> > of any other changes.
> 
> I agree that "->exit_state = -1" makes sense, but I disagree in that I 
> don't think it *matters*.
> 
> Most of the problematic kernel threads are long-running (as in "never 
> exit"). Things like eventd, khelper, migration-threads etc will have init 
> as their parent and never actually exit, so their ->exit_state doesn't 
> matter. What matters is that they are on the children list, so when you 
> have 1024 CPU's, and init has many thousand of these per-cpu threads as 
> its children, then the *user* threads (that do exit) will cause problems!
> 
> I'd almost prefer to just not add kernel threads to any parent process 
> list *at*all*. 

Yes sure, I didn't argue with that. However, "->exit_state = -1" does matter,
we can't detach process unless we make it auto-reap.

Perhaps,

--- t/kernel/exit.c~	2007-04-06 23:31:31.000000000 +0400
+++ t/kernel/exit.c	2007-04-06 23:31:57.000000000 +0400
@@ -275,10 +275,7 @@ static void reparent_to_init(void)
 	remove_parent(current);
 	current->parent = child_reaper(current);
 	current->real_parent = child_reaper(current);
-	add_parent(current);
-
-	/* Set the exit signal to SIGCHLD so we signal init on exit */
-	current->exit_signal = SIGCHLD;
+	current->exit_signal = -1;
 
 	if (!has_rt_policy(current) && (task_nice(current) < 0))
 		set_user_nice(current, 0);

is enough. init is still our parent (make ps happy), but it can't see us,
we are not on ->children list.

Off course, we also need to add preparent_to_init() to kthread() and
(say) stopmachine(). Or we can create kernel_thread_detached() and
modify callers to use it.

Oleg.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ