Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751855AbdF1RuB (ORCPT ); Wed, 28 Jun 2017 13:50:01 -0400 Received: from foss.arm.com ([217.140.101.70]:46730 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751501AbdF1Rtz (ORCPT ); Wed, 28 Jun 2017 13:49:55 -0400 Date: Wed, 28 Jun 2017 18:49:01 +0100 From: Mark Rutland To: Kyle Huey , Vince Weaver Cc: "Jin, Yao" , Ingo Molnar , "Peter Zijlstra (Intel)" , stable@vger.kernel.org, Alexander Shishkin , Arnaldo Carvalho de Melo , Jiri Olsa , Linus Torvalds , Namhyung Kim , Stephane Eranian , Thomas Gleixner , acme@kernel.org, jolsa@kernel.org, kan.liang@intel.com, Will Deacon , gregkh@linuxfoundation.org, "Robert O'Callahan" , open list Subject: Re: [PATCH] perf/core: generate overflow signal when samples are dropped (WAS: Re: [REGRESSION] perf/core: PMU interrupts dropped if we entered the kernel in the "skid" region) Message-ID: <20170628174900.GG8252@leverpostej> References: <2256f9b5-1277-c4b1-1472-61a10cd1db9a@linux.intel.com> <20170628101248.GB5981@leverpostej> <20170628105600.GC5981@leverpostej> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1155 Lines: 35 On Wed, Jun 28, 2017 at 09:48:27AM -0700, Kyle Huey wrote: > On Wed, Jun 28, 2017 at 3:56 AM, Mark Rutland wrote: > > @@ -6101,6 +6116,12 @@ void perf_prepare_sample(struct perf_event_header *header, > > struct perf_output_handle handle; > > struct perf_event_header header; > > > > + /* > > + * For security, drop the skid kernel samples if necessary. > > + */ > > + if (!sample_is_allowed(event, regs)) > > + return ret; > > Just a bare return here. Ugh, yes. Sorry about that. I'll fix that up. [...] > I can confirm that with that fixed to compile, this patch fixes rr. Thanks for giving this a go. Having thought about this some more, I think Vince does make a good point that throwing away samples is liable to break stuff, e.g. that which only relies on (non-sensitive) samples. It still seems wrong to make up data, though. Maybe for exclude_kernel && !exclude_user events we can always generate samples from the user regs, rather than the exception regs. That's going to be closer to what the user wants, regardless. I'll take a look tomorrow. Thanks, Mark.