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:   Sat, 25 Jun 2022 19:21:50 -0500
From:   "Eric W. Biederman" <ebiederm@...ssion.com>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Christian Brauner <brauner@...nel.org>, Tejun Heo <tj@...nel.org>,
        Petr Mladek <pmladek@...e.com>,
        Lai Jiangshan <jiangshanlai@...il.com>,
        Michal Hocko <mhocko@...e.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Oleg Nesterov <oleg@...hat.com>
Subject: Re: re. Spurious wakeup on a newly created kthread

Linus Torvalds <torvalds@...ux-foundation.org> writes:

> On Sat, Jun 25, 2022 at 4:28 PM Eric W. Biederman <ebiederm@...ssion.com> wrote:
>>
>> I presume you mean kthreadd games?
>
> Yeah, sorry.
>
>> So with the introduction of kthreadd the kernel threads were moved
>> out of the userspace process tree, and userspace stopped being able to
>> influence the kernel threads.
>
> Ahh. So essentially it's indeed just basically the parenting issue.

That is one way to look at it.  The way I described it at the time was:

> commit 73c279927f89561ecb45b2dfdf9314bafcfd9f67
> Author: Eric W. Biederman <ebiederm@...ssion.com>
> Date:   Wed May 9 02:34:32 2007 -0700
> 
>     kthread: don't depend on work queues
>     
>     Currently there is a circular reference between work queue initialization
>     and kthread initialization.  This prevents the kthread infrastructure from
>     initializing until after work queues have been initialized.
>     
>     We want the properties of tasks created with kthread_create to be as close
>     as possible to the init_task and to not be contaminated by user processes.
>     The later we start our kthreadd that creates these tasks the harder it is
>     to avoid contamination from user processes and the more of a mess we have
>     to clean up because the defaults have changed on us.
>     
>     So this patch modifies the kthread support to not use work queues but to
>     instead use a simple list of structures, and to have kthreadd start from
>     init_task immediately after our kernel thread that execs /sbin/init.
>     
>     By being a true child of init_task we only have to change those process
>     settings that we want to have different from init_task, such as our process
>     name, the cpus that are allowed, blocking all signals and setting SIGCHLD
>     to SIG_IGN so that all of our children are reaped automatically.
>     
>     By being a true child of init_task we also naturally get our ppid set to 0
>     and do not wind up as a child of PID == 1.  Ensuring that tasks generated
>     by kthread_create will not slow down the functioning of the wait family of
>     functions.
>     
>     [akpm@...ux-foundation.org: use interruptible sleeps]
>     Signed-off-by: Eric W. Biederman <ebiederm@...ssion.com>
>     Cc: Oleg Nesterov <oleg@...sign.ru>
>     Signed-off-by: Andrew Morton <akpm@...ux-foundation.org>
>     Signed-off-by: Linus Torvalds <torvalds@...ux-foundation.org>

Eric

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ