Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755667AbbEUNHY (ORCPT ); Thu, 21 May 2015 09:07:24 -0400 Received: from mail-oi0-f49.google.com ([209.85.218.49]:32793 "EHLO mail-oi0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753908AbbEUNHU (ORCPT ); Thu, 21 May 2015 09:07:20 -0400 MIME-Version: 1.0 In-Reply-To: <20150521125615.GO3644@twins.programming.kicks-ass.net> References: <20150521111710.475482798@infradead.org> <20150521111932.592505273@infradead.org> <20150521125615.GO3644@twins.programming.kicks-ass.net> Date: Thu, 21 May 2015 06:07:20 -0700 Message-ID: Subject: Re: [PATCH 01/10] perf,x86: Fix event/group validation From: Stephane Eranian To: Peter Zijlstra Cc: Ingo Molnar , Vince Weaver , Jiri Olsa , "Liang, Kan" , LKML , Andrew Hunter , Maria Dimakopoulou Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1392 Lines: 35 On Thu, May 21, 2015 at 5:56 AM, Peter Zijlstra wrote: > On Thu, May 21, 2015 at 05:35:02AM -0700, Stephane Eranian wrote: >> > Commit e979121b1b15 ("perf/x86/intel: Implement cross-HT corruption >> > bug workaround") made the situation much worse by actually setting the >> > event->hw.constraint value to NULL, so when validation and actual >> > scheduling interact we get NULL ptr derefs. >> > >> >> But x86_schedule_events() does reset the hw.constraint for each invocation: >> >> c = x86_pmu.get_event_constraints(cpuc, i, cpuc->event_list[i]); >> hwc->constraint = c; > > Yes, so if you have: > > validate_group() > > hwc->constraint = c; > Ok, you get that because validate_group() invokes x6_schedule_events() but on the fake_cpuc. This on fake_cpuc->event_list[]->hwc. > > > c = hwc->constraint; > > The second c might not be the first. And where does this assignment come from? For actual scheduling, we are using the actual cpuc, not fake_cpuc. Validate_group() does not modify global cpuc state. Or am I missing something? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/