From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752399AbcAGNkQ (ORCPT ); Thu, 7 Jan 2016 08:40:16 -0500 Received: from casper.infradead.org ([85.118.1.10]:42776 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752170AbcAGNkO (ORCPT ); Thu, 7 Jan 2016 08:40:14 -0500 Date: Thu, 7 Jan 2016 14:40:08 +0100 From: Peter Zijlstra To: Eric Dumazet Cc: syzkaller , LKML , acme@redhat.com, Linus Torvalds , Alexander Potapenko , Kostya Serebryany , Dmitry Vyukov , Sasha Levin , "H. Peter Anvin" , jolsa@redhat.com, Ingo Molnar , vincent.weaver@maine.edu, Thomas Gleixner , acme@kernel.org, Stephane Eranian , linux-tip-commits@vger.kernel.org, Paul McKenney Subject: Re: [tip:perf/core] perf: Fix race in perf_event_exec() Message-ID: <20160107134008.GZ6344@twins.programming.kicks-ass.net> References: <20151210195740.GG6357@twins.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2012-12-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > 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.