Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755597AbdGKJHR (ORCPT ); Tue, 11 Jul 2017 05:07:17 -0400 Received: from terminus.zytor.com ([65.50.211.136]:58191 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755222AbdGKJHP (ORCPT ); Tue, 11 Jul 2017 05:07:15 -0400 Date: Tue, 11 Jul 2017 02:03:52 -0700 From: tip-bot for Ingo Molnar Message-ID: Cc: jolsa@redhat.com, mingo@kernel.org, namhyung@kernel.org, me@kylehuey.com, eranian@google.com, a.p.zijlstra@chello.nl, alexander.shishkin@linux.intel.com, will.deacon@arm.com, yao.jin@linux.intel.com, linux-kernel@vger.kernel.org, hpa@zytor.com, vincent.weaver@maine.edu, torvalds@linux-foundation.org, acme@redhat.com, stable@vger.kernel.org, tglx@linutronix.de Reply-To: me@kylehuey.com, namhyung@kernel.org, a.p.zijlstra@chello.nl, eranian@google.com, mingo@kernel.org, jolsa@redhat.com, vincent.weaver@maine.edu, torvalds@linux-foundation.org, stable@vger.kernel.org, acme@redhat.com, tglx@linutronix.de, will.deacon@arm.com, alexander.shishkin@linux.intel.com, linux-kernel@vger.kernel.org, yao.jin@linux.intel.com, hpa@zytor.com In-Reply-To: <20170628105600.GC5981@leverpostej> References: <20170628105600.GC5981@leverpostej> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/urgent] Revert "perf/core: Drop kernel samples even though :u is specified" Git-Commit-ID: 6a8a75f3235724c5941a33e287b2f98966ad14c5 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2682 Lines: 76 Commit-ID: 6a8a75f3235724c5941a33e287b2f98966ad14c5 Gitweb: http://git.kernel.org/tip/6a8a75f3235724c5941a33e287b2f98966ad14c5 Author: Ingo Molnar AuthorDate: Tue, 11 Jul 2017 10:56:54 +0200 Committer: Ingo Molnar CommitDate: Tue, 11 Jul 2017 10:56:54 +0200 Revert "perf/core: Drop kernel samples even though :u is specified" This reverts commit cc1582c231ea041fbc68861dfaf957eaf902b829. This commit introduced a regression that broke rr-project, which uses sampling events to receive a signal on overflow (but does not care about the contents of the sample). These signals are critical to the correct operation of rr. There's been some back and forth about how to fix it - but to not keep applications in limbo queue up a revert. Reported-by: Kyle Huey Acked-by: Kyle Huey Acked-by: Peter Zijlstra Cc: Jin Yao Cc: Vince Weaver Cc: Linus Torvalds Cc: Will Deacon Cc: Arnaldo Carvalho de Melo Cc: Alexander Shishkin Cc: Stephane Eranian Cc: Namhyung Kim Cc: Jiri Olsa Cc: Link: http://lkml.kernel.org/r/20170628105600.GC5981@leverpostej Signed-off-by: Ingo Molnar --- kernel/events/core.c | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/kernel/events/core.c b/kernel/events/core.c index 4d2c32f..9747e42 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -7308,21 +7308,6 @@ int perf_event_account_interrupt(struct perf_event *event) return __perf_event_account_interrupt(event, 1); } -static bool sample_is_allowed(struct perf_event *event, struct pt_regs *regs) -{ - /* - * Due to interrupt latency (AKA "skid"), we may enter the - * kernel before taking an overflow, even if the PMU is only - * counting user events. - * To avoid leaking information to userspace, we must always - * reject kernel samples when exclude_kernel is set. - */ - if (event->attr.exclude_kernel && !user_mode(regs)) - return false; - - return true; -} - /* * Generic event overflow handling, sampling. */ @@ -7344,12 +7329,6 @@ static int __perf_event_overflow(struct perf_event *event, ret = __perf_event_account_interrupt(event, throttle); /* - * For security, drop the skid kernel samples if necessary. - */ - if (!sample_is_allowed(event, regs)) - return ret; - - /* * XXX event_limit might not quite work as expected on inherited * events */