[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250426083634.25897a33@batman.local.home>
Date: Sat, 26 Apr 2025 08:36:34 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Kees Cook <kees@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org, Masami
Hiramatsu <mhiramat@...nel.org>, Mark Rutland <mark.rutland@....com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, Andrew Morton
<akpm@...ux-foundation.org>, Peter Zijlstra <peterz@...radead.org>, Linus
Torvalds <torvalds@...ux-foundation.org>, Ingo Molnar <mingo@...hat.com>,
x86@...nel.org, bpf@...r.kernel.org, Tejun Heo <tj@...nel.org>, Julia
Lawall <Julia.Lawall@...ia.fr>, Nicolas Palix <nicolas.palix@...g.fr>,
cocci@...ia.fr
Subject: Re: [RFC][PATCH 1/2] kthread: Add is_user_thread() and
is_kernel_thread() helper functions
On Fri, 25 Apr 2025 16:03:16 -0700
Kees Cook <kees@...nel.org> wrote:
> > +static __always_inline bool is_kernel_thread(struct task_struct *task)
> > +{
> > + return task->flags & PF_KTHREAD;
>
> nit: maybe do explicit type conversion:
>
> return !!(task->flags & PF_KTHREAD);
>
> but that's just a style issue, really.
I may use Boris's suggestion (which I thought of doing originally too)
and have this return:
return !is_user_thread(task);
>
> Reviewed-by: Kees Cook <kees@...nel.org>
Thanks.
>
> Thank you for not using current->mm -- KUnit, live patching, etc, all
> use current->mm but are kthreads. :)
Yeah, Peter was stressing this.
-- Steve
Powered by blists - more mailing lists