]> asedeno.scripts.mit.edu Git - linux.git/commit
bpf: disallow direct packet access for unpriv in cg_skb
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 24 Oct 2018 20:05:44 +0000 (22:05 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 26 Oct 2018 00:02:06 +0000 (17:02 -0700)
commitab21c1b5f799395232b838e98981cfed6d647905
tree103ae279bd9619b0f6bf7e33de8cd09784db9a12
parent36641ad61db5ce9befd5eb0071abb36eaff16cfc
bpf: disallow direct packet access for unpriv in cg_skb

Commit b39b5f411dcf ("bpf: add cg_skb_is_valid_access for
BPF_PROG_TYPE_CGROUP_SKB") added support for returning pkt pointers
for direct packet access. Given this program type is allowed for both
unprivileged and privileged users, we shouldn't allow unprivileged
ones to use it, e.g. besides others one reason would be to avoid any
potential speculation on the packet test itself, thus guard this for
root only.

Fixes: b39b5f411dcf ("bpf: add cg_skb_is_valid_access for BPF_PROG_TYPE_CGROUP_SKB")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Cc: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
net/core/filter.c
tools/testing/selftests/bpf/test_verifier.c