Re: [PATCH] perf: Fix oops when kthread execs user process

From: Mark Rutland
Date: Thu May 30 2019 - 06:39:19 EST


On Wed, May 29, 2019 at 07:03:13PM +0200, Peter Zijlstra wrote:
> On Wed, May 29, 2019 at 05:38:54PM +0100, Mark Rutland wrote:
> > Generally speaking though, if we ever task task_pt_regs() of an idle
> > task we'll get junk, and user_mode() could be true.
>
> Agreed, but we're not doing that.

Sure.

I just think that might be an argument for having task_pt_regs() return
NULL for kthreads, or having a WARN_ON_ONCE(t->flags & PF_KTHREAD) to
catch missing checks elsewhere.

Thanks,
Mark.