diff options
author | Alexei Starovoitov <ast@kernel.org> | 2020-05-07 03:12:44 +0300 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-05-07 03:12:44 +0300 |
commit | f87b87a1c969f767b9938d435f0211d293e323db (patch) | |
tree | b315d103bc610caf0682329320839ec8dc51fa59 /include | |
parent | a085a1eeea5ed4ae7aa0c19031449ade145110fc (diff) | |
parent | 980737282232b752bb14dab96d77665c15889c36 (diff) | |
download | linux-f87b87a1c969f767b9938d435f0211d293e323db.tar.xz |
Merge tag 'perf-for-bpf-2020-05-06' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip into bpf-next
CAP_PERFMON for BPF
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/capability.h | 4 | ||||
-rw-r--r-- | include/uapi/linux/capability.h | 8 |
2 files changed, 11 insertions, 1 deletions
diff --git a/include/linux/capability.h b/include/linux/capability.h index ecce0f43c73a..027d7e4a853b 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h @@ -251,6 +251,10 @@ extern bool privileged_wrt_inode_uidgid(struct user_namespace *ns, const struct extern bool capable_wrt_inode_uidgid(const struct inode *inode, int cap); extern bool file_ns_capable(const struct file *file, struct user_namespace *ns, int cap); extern bool ptracer_capable(struct task_struct *tsk, struct user_namespace *ns); +static inline bool perfmon_capable(void) +{ + return capable(CAP_PERFMON) || capable(CAP_SYS_ADMIN); +} /* audit system wants to get cap info from files as well */ extern int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data *cpu_caps); diff --git a/include/uapi/linux/capability.h b/include/uapi/linux/capability.h index 272dc69fa080..e58c9636741b 100644 --- a/include/uapi/linux/capability.h +++ b/include/uapi/linux/capability.h @@ -367,8 +367,14 @@ struct vfs_ns_cap_data { #define CAP_AUDIT_READ 37 +/* + * Allow system performance and observability privileged operations + * using perf_events, i915_perf and other kernel subsystems + */ + +#define CAP_PERFMON 38 -#define CAP_LAST_CAP CAP_AUDIT_READ +#define CAP_LAST_CAP CAP_PERFMON #define cap_valid(x) ((x) >= 0 && (x) <= CAP_LAST_CAP) |