On Fri, 25 Apr 2025 16:03:16 -0700
Kees Cook <[email protected]> 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 <[email protected]>
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