Skip to content

Commit cfa77bc

Browse files
Jiri Olsaingomolnar
authored andcommitted
perf: Disallow user-space callchains for function trace events
Recent issues with user space callchains processing within page fault handler tracing showed as Peter said 'there's just too much fail surface'. Related list discussions: http://marc.info/?t=139302086500001&r=1&w=2 http://marc.info/?t=139301437300003&r=1&w=2 Suggested-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Jiri Olsa <jolsa@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Vince Weaver <vincent.weaver@maine.edu> Cc: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1393775800-13524-2-git-send-email-jolsa@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
1 parent ef11dad commit cfa77bc

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

‎kernel/trace/trace_event_perf.c‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,18 @@ static int perf_trace_event_perm(struct ftrace_event_call *tp_event,
3131
}
3232

3333
/* The ftrace function trace is allowed only for root. */
34-
if (ftrace_event_is_function(tp_event) &&
35-
perf_paranoid_tracepoint_raw() && !capable(CAP_SYS_ADMIN))
36-
return -EPERM;
34+
if (ftrace_event_is_function(tp_event)) {
35+
if (perf_paranoid_tracepoint_raw() && !capable(CAP_SYS_ADMIN))
36+
return -EPERM;
37+
38+
/*
39+
* We don't allow user space callchains for function trace
40+
* event, due to issues with page faults while tracing page
41+
* fault handler and its overall trickiness nature.
42+
*/
43+
if (!p_event->attr.exclude_callchain_user)
44+
return -EINVAL;
45+
}
3746

3847
/* No tracing, just counting, so no obvious leak */
3948
if (!(p_event->attr.sample_type & PERF_SAMPLE_RAW))

0 commit comments

Comments
 (0)