lkml.org 
[lkml]   [2021]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [syzbot] WARNING in kthread_is_per_cpu
On Tue, Apr 20, 2021 at 10:43:43AM +0100, Valentin Schneider wrote:
> On 20/04/21 10:51, Peter Zijlstra wrote:

> > I think free_kthread_struct() is ok, because a task at that point in its
> > lifetime cannot be also doing exec().
> >
>
> What if it's one of those kthreads created by directly invoking
> kernel_thread()? AFAICT right now it's only umh, and that one does execve()
> so it ends up stripped of PF_KTHREAD. It could however go through an error
> path, i.e. not call exec, and exit, giving us:
>
> put_task_struct(p)
> `\
> free_task(p)
> `\
> if (tsk->flags & PF_KTHREAD)
> free_kthread_struct(tsk);
> `\
> to_kthread(p)

I'm not following, at the point we hit free_task() it had better be dead
and p->flags had better be stable. Either it will, or will not, have
PF_KTHREAD.


\
 
 \ /
  Last update: 2021-04-20 12:13    [W:0.047 / U:1.240 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site