OSDN Git Service

BACKPORT: security: bpf: Add LSM hooks for bpf object related syscall
authorChenbo Feng <fengc@google.com>
Wed, 18 Oct 2017 20:00:24 +0000 (13:00 -0700)
committerChenbo Feng <fengc@google.com>
Tue, 7 Nov 2017 20:59:20 +0000 (12:59 -0800)
commitf3ad3766a9e8173db72dce69fa8abb5be5f6cb61
tree4e21de115ec808536cbdfa00d220a7bfd5374a25
parent4672ded3ece51dfca56ae120c06830794bf9ca59
BACKPORT: security: bpf: Add LSM hooks for bpf object related syscall

Introduce several LSM hooks for the syscalls that will allow the
userspace to access to eBPF object such as eBPF programs and eBPF maps.
The security check is aimed to enforce a per object security protection
for eBPF object so only processes with the right priviliges can
read/write to a specific map or use a specific eBPF program. Besides
that, a general security hook is added before the multiplexer of bpf
syscall to check the cmd and the attribute used for the command. The
actual security module can decide which command need to be checked and
how the cmd should be checked.

Signed-off-by: Chenbo Feng <fengc@google.com>
Acked-by: James Morris <james.l.morris@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Added the LIST_HEAD_INIT call for security hooks, it nolonger exist in
uptream code.
(cherry-pick from net-next: afdb09c720b62b8090584c11151d856df330e57d)
Bug: 30950746

Change-Id: Ieb3ac74392f531735fc7c949b83346a5f587a77b
include/linux/bpf.h
include/linux/lsm_hooks.h
include/linux/security.h
kernel/bpf/syscall.c
security/security.c