aboutsummaryrefslogtreecommitdiff
path: root/include/linux/capability.h
diff options
context:
space:
mode:
authorAlexei Starovoitov <[email protected]>2020-05-06 17:12:44 -0700
committerAlexei Starovoitov <[email protected]>2020-05-06 17:12:44 -0700
commitf87b87a1c969f767b9938d435f0211d293e323db (patch)
treeb315d103bc610caf0682329320839ec8dc51fa59 /include/linux/capability.h
parenta085a1eeea5ed4ae7aa0c19031449ade145110fc (diff)
parent980737282232b752bb14dab96d77665c15889c36 (diff)
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/capability.h')
-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);