Skip to content

Commit 6a8a75f

Browse files
author
Ingo Molnar
committed
Revert "perf/core: Drop kernel samples even though :u is specified"
This reverts commit cc1582c. 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 <[email protected]> Acked-by: Kyle Huey <[email protected]> Acked-by: Peter Zijlstra <[email protected]> Cc: Jin Yao <[email protected]> Cc: Vince Weaver <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Will Deacon <[email protected]> Cc: Arnaldo Carvalho de Melo <[email protected]> Cc: Alexander Shishkin <[email protected]> Cc: Stephane Eranian <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: <[email protected]> Link: http://lkml.kernel.org/r/20170628105600.GC5981@leverpostej Signed-off-by: Ingo Molnar <[email protected]>
1 parent 1922eec commit 6a8a75f

File tree

1 file changed

+0
-21
lines changed

1 file changed

+0
-21
lines changed

kernel/events/core.c

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -7308,21 +7308,6 @@ int perf_event_account_interrupt(struct perf_event *event)
73087308
return __perf_event_account_interrupt(event, 1);
73097309
}
73107310

7311-
static bool sample_is_allowed(struct perf_event *event, struct pt_regs *regs)
7312-
{
7313-
/*
7314-
* Due to interrupt latency (AKA "skid"), we may enter the
7315-
* kernel before taking an overflow, even if the PMU is only
7316-
* counting user events.
7317-
* To avoid leaking information to userspace, we must always
7318-
* reject kernel samples when exclude_kernel is set.
7319-
*/
7320-
if (event->attr.exclude_kernel && !user_mode(regs))
7321-
return false;
7322-
7323-
return true;
7324-
}
7325-
73267311
/*
73277312
* Generic event overflow handling, sampling.
73287313
*/
@@ -7343,12 +7328,6 @@ static int __perf_event_overflow(struct perf_event *event,
73437328

73447329
ret = __perf_event_account_interrupt(event, throttle);
73457330

7346-
/*
7347-
* For security, drop the skid kernel samples if necessary.
7348-
*/
7349-
if (!sample_is_allowed(event, regs))
7350-
return ret;
7351-
73527331
/*
73537332
* XXX event_limit might not quite work as expected on inherited
73547333
* events

0 commit comments

Comments
 (0)