[PATCH 1/3] perf: Disallow user space callchains for function trace event
Disabling user callchains for function trace event. 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=13930208651=1=2 http://marc.info/?t=13930143733=1=2 Suggested-by: Peter Zijlstra Signed-off-by: Jiri Olsa Cc: Peter Zijlstra Cc: Paul Mackerras Cc: Ingo Molnar Cc: Arnaldo Carvalho de Melo Cc: H. Peter Anvin Cc: Vince Weaver Cc: Steven Rostedt --- kernel/trace/trace_event_perf.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c index e854f42..d5e01c3 100644 --- a/kernel/trace/trace_event_perf.c +++ b/kernel/trace/trace_event_perf.c @@ -31,9 +31,18 @@ static int perf_trace_event_perm(struct ftrace_event_call *tp_event, } /* The ftrace function trace is allowed only for root. */ - if (ftrace_event_is_function(tp_event) && - perf_paranoid_tracepoint_raw() && !capable(CAP_SYS_ADMIN)) - return -EPERM; + if (ftrace_event_is_function(tp_event)) { + if (perf_paranoid_tracepoint_raw() && !capable(CAP_SYS_ADMIN)) + 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 */ if (!(p_event->attr.sample_type & PERF_SAMPLE_RAW)) -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3] perf: Disallow user space callchains for function trace event
Disabling user callchains for function trace event. 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=13930208651r=1w=2 http://marc.info/?t=13930143733r=1w=2 Suggested-by: Peter Zijlstra a.p.zijls...@chello.nl Signed-off-by: Jiri Olsa jo...@redhat.com Cc: Peter Zijlstra a.p.zijls...@chello.nl Cc: Paul Mackerras pau...@samba.org Cc: Ingo Molnar mi...@redhat.com Cc: Arnaldo Carvalho de Melo a...@ghostprotocols.net Cc: H. Peter Anvin h...@zytor.com Cc: Vince Weaver vincent.wea...@maine.edu Cc: Steven Rostedt rost...@goodmis.org --- kernel/trace/trace_event_perf.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c index e854f42..d5e01c3 100644 --- a/kernel/trace/trace_event_perf.c +++ b/kernel/trace/trace_event_perf.c @@ -31,9 +31,18 @@ static int perf_trace_event_perm(struct ftrace_event_call *tp_event, } /* The ftrace function trace is allowed only for root. */ - if (ftrace_event_is_function(tp_event) - perf_paranoid_tracepoint_raw() !capable(CAP_SYS_ADMIN)) - return -EPERM; + if (ftrace_event_is_function(tp_event)) { + if (perf_paranoid_tracepoint_raw() !capable(CAP_SYS_ADMIN)) + 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 */ if (!(p_event-attr.sample_type PERF_SAMPLE_RAW)) -- 1.8.3.1 -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/