bpf: restrict unknown scalars of mixed signed bounds for unprivileged
authorDaniel Borkmann <daniel@iogearbox.net>
Mon, 28 Jan 2019 20:28:26 +0000 (21:28 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 31 Jan 2019 07:14:41 +0000 (08:14 +0100)
commit44f8fc6499807c03d30921486e059b951dcea63d
tree01f34fdaa950071aca932e9ad1dca686393b9b93
parent5332dda94f632e56444d1c081e4683463dd64278
bpf: restrict unknown scalars of mixed signed bounds for unprivileged

[ commit 9d7eceede769f90b66cfa06ad5b357140d5141ed upstream ]

For unknown scalars of mixed signed bounds, meaning their smin_value is
negative and their smax_value is positive, we need to reject arithmetic
with pointer to map value. For unprivileged the goal is to mask every
map pointer arithmetic and this cannot reliably be done when it is
unknown at verification time whether the scalar value is negative or
positive. Given this is a corner case, the likelihood of breaking should
be very small.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/bpf/verifier.c