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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250820164651.GA18799@redhat.com>
Date: Wed, 20 Aug 2025 18:46:51 +0200
From: Oleg Nesterov <oleg@...hat.com>
To: Borislav Petkov <bp@...en8.de>,
	Dave Hansen <dave.hansen@...ux.intel.com>,
	Ingo Molnar <mingo@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Thomas Gleixner <tglx@...utronix.de>
Cc: Rick Edgecombe <rick.p.edgecombe@...el.com>,
	Mark Brown <broonie@...nel.org>, x86@...nel.org,
	linux-kernel@...r.kernel.org
Subject: [PATCH] x86/process: fix the misleading comment about
 PF_USER_WORKERs in copy_thread()

The comment says "doesn't return to ret_after_fork()" but in fact it should
say "doesn't return from ret_from_fork()".

Plus the comment lacks some important details, and even "user space thread"
doesn't look accurate, if nothing else this doesn't match the comment about
PF_USER_WORKER in include/linux/sched.h.

Signed-off-by: Oleg Nesterov <oleg@...hat.com>
---
 arch/x86/kernel/process.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index e932e0e53972..cc4fe540d952 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -237,14 +237,20 @@ int copy_thread(struct task_struct *p, const struct kernel_clone_args *args)
 
 	if (unlikely(args->fn)) {
 		/*
-		 * A user space thread, but it doesn't return to
-		 * ret_after_fork().
+		 * A non-PF_KTHREAD thread, but it doesn't return from
+		 * ret_from_fork().
+		 *
+		 * Either a PF_USER_WORKER kernel thread, in this case
+		 * arg->fn() must not return.
+		 * Or a user space task created by user_mode_thread(), in
+		 * this case arg->fn() can only return after a successful
+		 * kernel_execve().
 		 *
 		 * In order to indicate that to tools like gdb,
 		 * we reset the stack and instruction pointers.
 		 *
 		 * It does the same kernel frame setup to return to a kernel
-		 * function that a kernel thread does.
+		 * function that a PF_KTHREAD thread does.
 		 */
 		childregs->sp = 0;
 		childregs->ip = 0;
-- 
2.25.1.362.g51ebf55



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ