mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
fork: Explicitly set PF_KTHREAD
Instead of implicitly inheriting PF_KTHREAD from the parent process examine arguments in kernel_clone_args to see if PF_KTHREAD should be set. This makes knowledge of which new threads are kernel threads explicit. This also makes it so that init and the user mode helper processes no longer have PF_KTHREAD set. Link: https://lkml.kernel.org/r/20220506141512.516114-6-ebiederm@xmission.com Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
This commit is contained in:
parent
68d85f0a33
commit
753550eb0c
1 changed files with 3 additions and 0 deletions
|
@ -2068,6 +2068,9 @@ static __latent_entropy struct task_struct *copy_process(
|
||||||
p = dup_task_struct(current, node);
|
p = dup_task_struct(current, node);
|
||||||
if (!p)
|
if (!p)
|
||||||
goto fork_out;
|
goto fork_out;
|
||||||
|
p->flags &= ~PF_KTHREAD;
|
||||||
|
if (args->kthread)
|
||||||
|
p->flags |= PF_KTHREAD;
|
||||||
if (args->io_thread) {
|
if (args->io_thread) {
|
||||||
/*
|
/*
|
||||||
* Mark us an IO worker, and block any signal that isn't
|
* Mark us an IO worker, and block any signal that isn't
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue