[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190529163854.GN31777@lakrids.cambridge.arm.com>
Date: Wed, 29 May 2019 17:38:54 +0100
From: Mark Rutland <mark.rutland@....com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Will Deacon <will.deacon@....com>,
Young Xiao <92siuyang@...il.com>, linux@...linux.org.uk,
mingo@...hat.com, bp@...en8.de, hpa@...or.com, x86@...nel.org,
kan.liang@...ux.intel.com, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, ravi.bangoria@...ux.vnet.ibm.com,
mpe@...erman.id.au, acme@...hat.com, eranian@...gle.com,
fweisbec@...il.com, jolsa@...hat.com
Subject: Re: [PATCH] perf: Fix oops when kthread execs user process
On Wed, May 29, 2019 at 05:24:36PM +0100, Mark Rutland wrote:
> On Wed, May 29, 2019 at 06:19:55PM +0200, Peter Zijlstra wrote:
> > On Wed, May 29, 2019 at 03:35:10PM +0100, Will Deacon wrote:
> > > On Wed, May 29, 2019 at 03:25:15PM +0200, Peter Zijlstra wrote:
> > > > On Wed, May 29, 2019 at 02:05:21PM +0100, Will Deacon wrote:
> > > > > On Wed, May 29, 2019 at 02:55:57PM +0200, Peter Zijlstra wrote:
> > > >
> > > > > > if (user_mode(regs)) {
> > > > >
> > > > > Hmm, so it just occurred to me that Mark's observation is that the regs
> > > > > can be junk in some cases. In which case, should we be checking for
> > > > > kthreads first?
> > > >
> > > > task_pt_regs() can return garbage, but @regs is the exception (or
> > > > perf_arch_fetch_caller_regs()) regs, and for those user_mode() had
> > > > better be correct.
> > >
> > > So what should we report for the idle task?
> >
> > If an interrupt hits the idle task, @regs would be !user_mode(regs),
> > we'll find current->flags & PF_KTHREAD (idle not having passed through
> > exec()) and therefore we'll take ABI_NONE for the user regs.
> >
> > Or am I not getting it?
>
> If the contents of task_pt_regs(current) is garbage, then the result of
> user_mode(task_pt_regs(current)) is also garbage, no?
Ugh; I was being thick here and assuming regs was the result of
task_pt_regs() when it's actually the interrupted regs.
Sorry for the noise.
Generally speaking though, if we ever task task_pt_regs() of an idle
task we'll get junk, and user_mode() could be true.
Thanks,
Mark.
Powered by blists - more mailing lists