Skip to content

Commit 753550e

Browse files
committed
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/[email protected] Signed-off-by: "Eric W. Biederman" <[email protected]>
1 parent 68d85f0 commit 753550e

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

kernel/fork.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2068,6 +2068,9 @@ static __latent_entropy struct task_struct *copy_process(
20682068
p = dup_task_struct(current, node);
20692069
if (!p)
20702070
goto fork_out;
2071+
p->flags &= ~PF_KTHREAD;
2072+
if (args->kthread)
2073+
p->flags |= PF_KTHREAD;
20712074
if (args->io_thread) {
20722075
/*
20732076
* Mark us an IO worker, and block any signal that isn't

0 commit comments

Comments
 (0)