]> git.baikalelectronics.ru Git - kernel.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)
commitbdcf064f43ced02b1600c10bd69fad98f8051a1f
tree103ae279bd9619b0f6bf7e33de8cd09784db9a12
parent224c47aa90a939395c7b2db51c4f429adaa9fb1d
bpf: disallow direct packet access for unpriv in cg_skb

Commit 5143e8b978d6 ("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: 5143e8b978d6 ("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