From: Jiri Olsa Date: Sun, 2 Mar 2014 15:56:39 +0000 (+0100) Subject: perf: Disallow user-space stack dumps for function trace events X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=63c45f4ba533e9749da16298db53e491c25d805b;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git perf: Disallow user-space stack dumps 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'. The user space stack dump is just another source of the this issue. 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 Signed-off-by: Jiri Olsa Cc: Paul Mackerras Cc: Arnaldo Carvalho de Melo Cc: Vince Weaver Cc: Steven Rostedt Cc: Paul Mackerras Cc: H. Peter Anvin Signed-off-by: Peter Zijlstra Link: http://lkml.kernel.org/r/1393775800-13524-3-git-send-email-jolsa@redhat.com Signed-off-by: Ingo Molnar --- diff --git a/kernel/trace/trace_event_perf.c b/kernel/trace/trace_event_perf.c index d5e01c3f4e69..c894614de14d 100644 --- a/kernel/trace/trace_event_perf.c +++ b/kernel/trace/trace_event_perf.c @@ -42,6 +42,13 @@ static int perf_trace_event_perm(struct ftrace_event_call *tp_event, */ if (!p_event->attr.exclude_callchain_user) return -EINVAL; + + /* + * Same reason to disable user stack dump as for user space + * callchains above. + */ + if (p_event->attr.sample_type & PERF_SAMPLE_STACK_USER) + return -EINVAL; } /* No tracing, just counting, so no obvious leak */