summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorChenbo Feng <fengc@google.com>2017-10-18 16:00:26 -0400
committerDavid S. Miller <davem@davemloft.net>2017-10-20 08:32:59 -0400
commitf66e448cfda021b0bcd884f26709796fe19c7cc1 (patch)
tree75ca1e0f1847c469ac9e6a6aed6cb0534d97a50b /kernel
parentec27c3568a34c7fe5fcf4ac0a354eda77687f7eb (diff)
selinux: bpf: Add addtional check for bpf object file receive
Introduce a bpf object related check when sending and receiving files through unix domain socket as well as binder. It checks if the receiving process have privilege to read/write the bpf map or use the bpf program. This check is necessary because the bpf maps and programs are using a anonymous inode as their shared inode so the normal way of checking the files and sockets when passing between processes cannot work properly on eBPF object. This check only works when the BPF_SYSCALL is configured. Signed-off-by: Chenbo Feng <fengc@google.com> Acked-by: Stephen Smalley <sds@tycho.nsa.gov> Reviewed-by: James Morris <james.l.morris@oracle.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/bpf/syscall.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c
index 5cb56d06b48d..323be2473c4b 100644
--- a/kernel/bpf/syscall.c
+++ b/kernel/bpf/syscall.c
@@ -315,7 +315,7 @@ static ssize_t bpf_dummy_write(struct file *filp, const char __user *buf,
315 return -EINVAL; 315 return -EINVAL;
316} 316}
317 317
318static const struct file_operations bpf_map_fops = { 318const struct file_operations bpf_map_fops = {
319#ifdef CONFIG_PROC_FS 319#ifdef CONFIG_PROC_FS
320 .show_fdinfo = bpf_map_show_fdinfo, 320 .show_fdinfo = bpf_map_show_fdinfo,
321#endif 321#endif
@@ -975,7 +975,7 @@ static void bpf_prog_show_fdinfo(struct seq_file *m, struct file *filp)
975} 975}
976#endif 976#endif
977 977
978static const struct file_operations bpf_prog_fops = { 978const struct file_operations bpf_prog_fops = {
979#ifdef CONFIG_PROC_FS 979#ifdef CONFIG_PROC_FS
980 .show_fdinfo = bpf_prog_show_fdinfo, 980 .show_fdinfo = bpf_prog_show_fdinfo,
981#endif 981#endif