Commit cfa77bc4 authored by Jiri Olsa's avatar Jiri Olsa Committed by Ingo Molnar

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=2Suggested-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: default avatarJiri 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: default avatarPeter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1393775800-13524-2-git-send-email-jolsa@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
parent ef11dadb
...@@ -31,10 +31,19 @@ static int perf_trace_event_perm(struct ftrace_event_call *tp_event, ...@@ -31,10 +31,19 @@ static int perf_trace_event_perm(struct ftrace_event_call *tp_event,
} }
/* The ftrace function trace is allowed only for root. */ /* The ftrace function trace is allowed only for root. */
if (ftrace_event_is_function(tp_event) && if (ftrace_event_is_function(tp_event)) {
perf_paranoid_tracepoint_raw() && !capable(CAP_SYS_ADMIN)) if (perf_paranoid_tracepoint_raw() && !capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
/*
* We don't allow user space callchains for function trace
* event, due to issues with page faults while tracing page
* fault handler and its overall trickiness nature.
*/
if (!p_event->attr.exclude_callchain_user)
return -EINVAL;
}
/* No tracing, just counting, so no obvious leak */ /* No tracing, just counting, so no obvious leak */
if (!(p_event->attr.sample_type & PERF_SAMPLE_RAW)) if (!(p_event->attr.sample_type & PERF_SAMPLE_RAW))
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment