Re: WARNING in event_function_local

From: Steven Rostedt
Date: Tue Feb 12 2019 - 22:46:48 EST


On Tue, 12 Feb 2019 19:40:12 -0800
Kees Cook <keescook@xxxxxxxxxxxx> wrote:


> > > Steve, what could possibly be happening here? Just adding more
> > > tracepoints causes some kind of race where the task vs current test
> > > trips in event_function_local():
> > >
> > > if (WARN_ON_ONCE(task != current))
> > > goto unlock;
> >
> > That's perf code. How are you getting there? What's special about this
> > run? You have perf running?
>
> Yes, the reproducer is in an 8-way parallel tight loop, doing:
>
> fd = syscall(__NR_perf_event_open, 0x20000140, 0, 0, -1, 0);
> syscall(__NR_ioctl, fd, 0x2402, 0x100000001);
>
> I haven't decoded the structures that are passed in, but I'm at a loss
> for how changing how many trace entries there are could impact the
> race timing... O_o
>
> > > Is this maybe just an unlucky condition with the event loop running in
> > > an IRQ? Should the WARN be expected, or is running under an IRQ
> > > unexpected?
>
> Is perf expected to fire during an IRQ? The task == current test seems
> suspicious if so...
>

That's a question for Peter.

-- Steve