The current default perf paranoid level is "1" which has "perf_paranoid_kernel()" return false, and giving any operations that use it, access to normal users. Unfortunately, this includes function tracing and normal users should not be allowed to enable function tracing by default. The proper level is defined at "-1" (full perf access), which "perf_paranoid_tracepoint_raw()" will only give access to. Use that check instead for enabling function tracing.
Showing the changes to kernel/trace (1 of 1 file). Show all
Unified · Split
| @@ -26,7 +26,7 @@ static int perf_trace_event_perm(struct ftrace_event_call *tp_event, · 25 unmodified lines | ||
| 26 | 26 | { |
| 27 | 27 | /* The ftrace function trace is allowed only for root. */ |
| 28 | 28 | if (ftrace_event_is_function(tp_event) && |
| 29 | − perf_paranoid_kernel() && !capable(CAP_SYS_ADMIN)) | |
| 29 | + perf_paranoid_tracepoint_raw() && !capable(CAP_SYS_ADMIN)) | |
| 30 | 30 | return -EPERM; |
| 31 | 31 | |
| 32 | 32 | /* No tracing, just counting, so no obvious leak */ |