Pull perf/core fixes and improvements from Arnaldo Carvalho de Melo: kernel + tools/perf: Alexey Budankov: - Introduce CAP_PERFMON to kernel and user space. callchains: Adrian Hunter: - Allow using Intel PT to synthesize callchains for regular events. Kan Liang: - Stitch LBR records from multiple samples to get deeper backtraces, there are caveats, see the csets for details. perf script: Andreas Gerstmayr: - Add flamegraph.py script BPF: Jiri Olsa: - Synthesize bpf_trampoline/dispatcher ksymbol events. perf stat: Arnaldo Carvalho de Melo: - Honour --timeout for forked workloads. Stephane Eranian: - Force error in fallback on :k events, to avoid counting nothing when the user asks for kernel events but is not allowed to. perf bench: Ian Rogers: - Add event synthesis benchmark. tools api fs: Stephane Eranian: - Make xxx__mountpoint() more scalable libtraceevent: He Zhe: - Handle return value of asprintf.
Showing the changes to include/linux (2 of 85 files). Show all
Unified · Split
| @@ -251,6 +251,10 @@ extern bool privileged_wrt_inode_uidgid(struct user_namespace *ns, const struct · 250 unmodified lines | ||
| 251 | 251 | extern bool capable_wrt_inode_uidgid(const struct inode *inode, int cap); |
| 252 | 252 | extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap); |
| 253 | 253 | extern bool ptracer_capable(struct task_struct *tsk, struct user_namespace *ns); |
| 254 | +static inline bool perfmon_capable(void) | |
| 255 | +{ | |
| 256 | + return capable(CAP_PERFMON) || capable(CAP_SYS_ADMIN); | |
| 257 | +} | |
| 254 | 258 | |
| 255 | 259 | /* audit system wants to get cap info from files as well */ |
| 256 | 260 | extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps); |
| @@ -1305,7 +1305,7 @@ static inline int perf_is_paranoid(void) · 1304 unmodified lines | ||
| 1305 | 1305 | |
| 1306 | 1306 | static inline int perf_allow_kernel(struct perf_event_attr *attr) |
| 1307 | 1307 | { |
| 1308 | − if (sysctl_perf_event_paranoid > 1 && !capable(CAP_SYS_ADMIN)) | |
| 1308 | + if (sysctl_perf_event_paranoid > 1 && !perfmon_capable()) | |
| 1309 | 1309 | return -EACCES; |
| 1310 | 1310 | |
| 1311 | 1311 | return security_perf_event_open(attr, PERF_SECURITY_KERNEL); |
| @@ -1313,7 +1313,7 @@ static inline int perf_allow_kernel(struct perf_event_attr *attr) · 1 unmodified line | ||
| 1313 | 1313 | |
| 1314 | 1314 | static inline int perf_allow_cpu(struct perf_event_attr *attr) |
| 1315 | 1315 | { |
| 1316 | − if (sysctl_perf_event_paranoid > 0 && !capable(CAP_SYS_ADMIN)) | |
| 1316 | + if (sysctl_perf_event_paranoid > 0 && !perfmon_capable()) | |
| 1317 | 1317 | return -EACCES; |
| 1318 | 1318 | |
| 1319 | 1319 | return security_perf_event_open(attr, PERF_SECURITY_CPU); |
| @@ -1321,7 +1321,7 @@ static inline int perf_allow_cpu(struct perf_event_attr *attr) · 1 unmodified line | ||
| 1321 | 1321 | |
| 1322 | 1322 | static inline int perf_allow_tracepoint(struct perf_event_attr *attr) |
| 1323 | 1323 | { |
| 1324 | − if (sysctl_perf_event_paranoid > -1 && !capable(CAP_SYS_ADMIN)) | |
| 1324 | + if (sysctl_perf_event_paranoid > -1 && !perfmon_capable()) | |
| 1325 | 1325 | return -EPERM; |
| 1326 | 1326 | |
| 1327 | 1327 | return security_perf_event_open(attr, PERF_SECURITY_TRACEPOINT); |