Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751170AbbEDTdP (ORCPT ); Mon, 4 May 2015 15:33:15 -0400 Received: from mail-oi0-f41.google.com ([209.85.218.41]:34494 "EHLO mail-oi0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751334AbbEDTc5 (ORCPT ); Mon, 4 May 2015 15:32:57 -0400 MIME-Version: 1.0 In-Reply-To: <20150501125955.GF5029@twins.programming.kicks-ass.net> References: <20150501125955.GF5029@twins.programming.kicks-ass.net> Date: Mon, 4 May 2015 12:32:56 -0700 Message-ID: Subject: Re: perf: fuzzer triggers NULL pointer derefreence in x86_schedule_events From: Stephane Eranian To: Peter Zijlstra Cc: Vince Weaver , LKML , Arnaldo Carvalho de Melo , Jiri Olsa , Ingo Molnar , Paul Mackerras 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: 1550 Lines: 41 On Fri, May 1, 2015 at 5:59 AM, Peter Zijlstra wrote: > > On Thu, Apr 30, 2015 at 03:08:56PM -0400, Vince Weaver wrote: > > > > So the perf_fuzzer caught this after about a week of fuzzing on a Haswell > > machine running a recent git kernel (pre 4.1-rc1 though). > > > > We've seen this BUG before and various fixes were applied but apparently > > it wasn't enough. > > > > Sadly it doesn't seem to be reproducible. > > > > validate_group() -> x86_pmu.schedule_events() -> ???? -> variable_test_bit() > > (hard to tell which test bit with all the inlining going on). > > Assuming you build with debug info addr2line -i can help, but I think I > found it by comparing the Code section below with my objdump -D output. > > Its: > /* constraint still honored */ > if (!test_bit(hwc->idx, c->idxmsk)) > break; > > Which would seem to suggest c is NULL. > But then, you'd crash in the previous loop, because after get_event_contraint(), you touch c->weight. I think it is more likely related to the bitmask (idxmsk). But then it is always allocated with the constraint even with the HT bug workaround. So most, likely the index is bogus and you touch outside the idxmsk[] array. > > Lemme go figure out how that could happen. -- 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/