OSDN Git Service

UPSTREAM: selinux: bpf: Add addtional check for bpf object file receive
authorChenbo Feng <fengc@google.com>
Wed, 18 Oct 2017 20:00:26 +0000 (13:00 -0700)
committerChenbo Feng <fengc@google.com>
Tue, 7 Nov 2017 20:59:54 +0000 (12:59 -0800)
commit0521e0b3fc2050fee30bcece9b7d09b4b6237360
tree1bcf6eccccc3142ac7f03aa54ffd22359cb4bd35
parent9b62913289fd4e7bb48d10a79b4a9a3313fe4618
UPSTREAM: 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>
(cherry-pick from net-next: f66e448cfda021b0bcd884f26709796fe19c7cc1)
Bug: 30950746

Change-Id: I5b2cf4ccb4eab7eda91ddd7091d6aa3e7ed9f2cd
include/linux/bpf.h
kernel/bpf/syscall.c
security/selinux/hooks.c