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: <20250619120104.4622-1-jqqlijiazi@gmail.com>
Date: Thu, 19 Jun 2025 20:00:58 +0800
From: Jiazi Li <jqqlijiazi@...il.com>
To: Peter Zijlstra <peterz@...radead.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"Eric W . Biederman" <ebiederm@...ssion.com>
Cc: Jiazi Li <jqqlijiazi@...il.com>,
	linux-kernel@...r.kernel.org,
	"mingzhu.wang" <mingzhu.wang@...nssion.com>
Subject: [PATCH] kthread: update comment for __to_kthread

With commit 343f4c49f243 ("kthread: Don't allocate kthread_struct
for init and umh") and commit 753550eb0ce1 ("fork: Explicitly set
PF_KTHREAD"), umh task no longer have struct kthread and PF_KTHREAD flag.
Io_uring worker thread does not have PF_KTHREAD flag, but worker_private
is not null, so update comment for __to_kthread.

Signed-off-by: Jiazi Li <jqqlijiazi@...il.com>
Signed-off-by: mingzhu.wang <mingzhu.wang@...nssion.com>
---
 kernel/kthread.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/kernel/kthread.c b/kernel/kthread.c
index 85fc068f0083..810cc244b81c 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -88,13 +88,9 @@ static inline struct kthread *to_kthread(struct task_struct *k)
 /*
  * Variant of to_kthread() that doesn't assume @p is a kthread.
  *
- * Per construction; when:
- *
- *   (p->flags & PF_KTHREAD) && p->worker_private
- *
- * the task is both a kthread and struct kthread is persistent. However
- * PF_KTHREAD on it's own is not, kernel_thread() can exec() (See umh.c and
- * begin_new_exec()).
+ * For io_uring worker thread, p->worker_private point to io_worker
+ * struct, but they do not have PF_KTHREAD flag.
+ * Return NULL for such tasks.
  */
 static inline struct kthread *__to_kthread(struct task_struct *p)
 {
-- 
2.49.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ