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-prev] [day] [month] [year] [list]
Message-ID: <871prdzr44.fsf@email.froward.int.ebiederm.org>
Date: Fri, 20 Jun 2025 22:54:35 -0500
From: "Eric W. Biederman" <ebiederm@...ssion.com>
To: Jiazi Li <jqqlijiazi@...il.com>
Cc: Peter Zijlstra <peterz@...radead.org>,  Andrew Morton
 <akpm@...ux-foundation.org>,  linux-kernel@...r.kernel.org,
  "mingzhu.wang" <mingzhu.wang@...nssion.com>
Subject: Re: [PATCH v2] kthread: update comment for __to_kthread

Jiazi Li <jqqlijiazi@...il.com> writes:

> 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.
>
> Update the comment to describe what the current rules are to detect
> is something is a kthread.

Reviewed-by: "Eric W. Biederman" <ebiederm@...ssion.com>
> Suggested-by Eric W . Biederman <ebiederm@...ssion.com>
> Signed-off-by: Jiazi Li <jqqlijiazi@...il.com>
> Signed-off-by: mingzhu.wang <mingzhu.wang@...nssion.com>
>
> ---
> Changes in v2:
> - describe current rules for detect
> ---
> ---
>  kernel/kthread.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
>
> diff --git a/kernel/kthread.c b/kernel/kthread.c
> index 85fc068f0083..0e98b228a8ef 100644
> --- a/kernel/kthread.c
> +++ b/kernel/kthread.c
> @@ -88,13 +88,12 @@ 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:
> + * When "(p->flags & PF_KTHREAD)" is set the task is a kthread and will
> + * always remain a kthread.  For kthreads p->worker_private always
> + * points to a struct kthread.  For tasks that are not kthreads
> + * p->worker_private is used to point to other things.
>   *
> - *   (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()).
> + * Return NULL for any task that is not a kthread.
>   */
>  static inline struct kthread *__to_kthread(struct task_struct *p)
>  {

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ