Skip to content

Commit 45c59e7

Browse files
ingomolnargregkh
authored andcommitted
Revert "perf/core: Drop kernel samples even though :u is specified"
commit 6a8a75f3235724c5941a33e287b2f98966ad14c5 upstream. 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 <me@kylehuey.com> Acked-by: Kyle Huey <me@kylehuey.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Jin Yao <yao.jin@linux.intel.com> Cc: Vince Weaver <vincent.weaver@maine.edu> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Will Deacon <will.deacon@arm.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Stephane Eranian <eranian@google.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Jiri Olsa <jolsa@redhat.com> Link: http://lkml.kernel.org/r/20170628105600.GC5981@leverpostej Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 569da0b commit 45c59e7

1 file changed

Lines changed: 0 additions & 21 deletions

File tree

kernel/events/core.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6410,21 +6410,6 @@ static void perf_log_itrace_start(struct perf_event *event)
64106410
perf_output_end(&handle);
64116411
}
64126412

6413-
static bool sample_is_allowed(struct perf_event *event, struct pt_regs *regs)
6414-
{
6415-
/*
6416-
* Due to interrupt latency (AKA "skid"), we may enter the
6417-
* kernel before taking an overflow, even if the PMU is only
6418-
* counting user events.
6419-
* To avoid leaking information to userspace, we must always
6420-
* reject kernel samples when exclude_kernel is set.
6421-
*/
6422-
if (event->attr.exclude_kernel && !user_mode(regs))
6423-
return false;
6424-
6425-
return true;
6426-
}
6427-
64286413
/*
64296414
* Generic event overflow handling, sampling.
64306415
*/
@@ -6471,12 +6456,6 @@ static int __perf_event_overflow(struct perf_event *event,
64716456
perf_adjust_period(event, delta, hwc->last_period, true);
64726457
}
64736458

6474-
/*
6475-
* For security, drop the skid kernel samples if necessary.
6476-
*/
6477-
if (!sample_is_allowed(event, regs))
6478-
return ret;
6479-
64806459
/*
64816460
* XXX event_limit might not quite work as expected on inherited
64826461
* events

0 commit comments

Comments
 (0)