[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YH6o6gd4oqqs6sHr@hirez.programming.kicks-ass.net>
Date: Tue, 20 Apr 2021 12:11:54 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Valentin Schneider <valentin.schneider@....com>
Cc: syzbot <syzbot+9362b31a2e0cad8b749d@...kaller.appspotmail.com>,
bp@...en8.de, dwmw@...zon.co.uk, hpa@...or.com,
linux-kernel@...r.kernel.org, luto@...nel.org, mingo@...hat.com,
syzkaller-bugs@...glegroups.com, tglx@...utronix.de, x86@...nel.org
Subject: Re: [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.
Powered by blists - more mailing lists