Re: [tip:perf/core] perf: Fix race in perf_event_exec()

From: Peter Zijlstra
Date: Thu Jan 07 2016 - 08:40:21 EST


On Wed, Jan 06, 2016 at 01:56:56PM -0500, Eric Dumazet wrote:
> On Wed, Jan 6, 2016 at 1:46 PM, tip-bot for Peter Zijlstra
> <tipbot@xxxxxxxxx> wrote:
>
> >
> > This is because context switches can swap the task_struct::perf_event_ctxp[]
> > pointer around. Therefore you have to either disable preemption when looking
> > at current, or hold ctx->lock.
> >
>
>
> >
> > void perf_event_exec(void)
> > {
> > - struct perf_event_context *ctx;
> > int ctxn;
> >
> > rcu_read_lock();
>
> Do we still need this rcu_read_lock(), if perf_event_enable_on_exec()
> uses local_irq_save( ?

Strictly speaking we should not rely on the fact that RCU grace periods
do not progress with IRQs disabled, so yes.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/