History

Merge tag 'perf-core-for-mingo-5.8-20200420' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core

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.

Ingo Molnar committed 6 years ago

Commit 87cfeb12 parents 18bf340 12e89e685 files · +1851 −513Browse files

Showing the changes to include/linux (2 of 85 files). Show all

Unified · Split

2 files
  1. include/linux/capability.h +4 −0
  2. include/linux/perf_event.h +3 −3
include/linux/capability.h+4−0
@@ -251,6 +251,10 @@ extern bool privileged_wrt_inode_uidgid(struct user_namespace *ns, const struct · 250 unmodified lines
251251 extern bool capable_wrt_inode_uidgid(const struct inode *inode, int cap);
252252 extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap);
253253 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+}
254258
255259 /* audit system wants to get cap info from files as well */
256260 extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps);
include/linux/perf_event.h+3−3
@@ -1305,7 +1305,7 @@ static inline int perf_is_paranoid(void) · 1304 unmodified lines
13051305
13061306 static inline int perf_allow_kernel(struct perf_event_attr *attr)
13071307 {
1308− if (sysctl_perf_event_paranoid > 1 && !capable(CAP_SYS_ADMIN))
1308+ if (sysctl_perf_event_paranoid > 1 && !perfmon_capable())
13091309 return -EACCES;
13101310
13111311 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
13131313
13141314 static inline int perf_allow_cpu(struct perf_event_attr *attr)
13151315 {
1316− if (sysctl_perf_event_paranoid > 0 && !capable(CAP_SYS_ADMIN))
1316+ if (sysctl_perf_event_paranoid > 0 && !perfmon_capable())
13171317 return -EACCES;
13181318
13191319 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
13211321
13221322 static inline int perf_allow_tracepoint(struct perf_event_attr *attr)
13231323 {
1324− if (sysctl_perf_event_paranoid > -1 && !capable(CAP_SYS_ADMIN))
1324+ if (sysctl_perf_event_paranoid > -1 && !perfmon_capable())
13251325 return -EPERM;
13261326
13271327 return security_perf_event_open(attr, PERF_SECURITY_TRACEPOINT);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t