aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include/linux
diff options
context:
space:
mode:
authorAlexei Starovoitov <ast@kernel.org>2020-05-06 17:12:44 -0700
committerAlexei Starovoitov <ast@kernel.org>2020-05-06 17:12:44 -0700
commitf87b87a1c969f767b9938d435f0211d293e323db (patch)
treeb315d103bc610caf0682329320839ec8dc51fa59 /include/linux
parentMerge branch 'bpf-rv64-jit' (diff)
parentcapabilities: Introduce CAP_PERFMON to kernel and user space (diff)
downloadwireguard-linux-f87b87a1c969f767b9938d435f0211d293e323db.tar.xz
wireguard-linux-f87b87a1c969f767b9938d435f0211d293e323db.zip
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/linux')
-rw-r--r--include/linux/capability.h4
1 files changed, 4 insertions, 0 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);