]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: restrict map value pointer arithmetic for unprivileged
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 2 Jan 2019 23:58:30 +0000 (00:58 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 3 Jan 2019 00:01:24 +0000 (16:01 -0800)
commit07f33f63a462649ec9b51cbed10fac8303b4520f
tree6b9b3ae39535460fef0d17fdb103279ddc726be3
parentbc7404f351c4400e35ea3111090b542945b0c940
bpf: restrict map value pointer arithmetic for unprivileged

Restrict map value pointer arithmetic for unprivileged users in that
arithmetic itself must not go out of bounds as opposed to the actual
access later on. Therefore after each adjust_ptr_min_max_vals() with a
map value pointer as a destination it will simulate a check_map_access()
of 1 byte on the destination and once that fails the program is rejected
for unprivileged program loads. We use this later on for masking any
pointer arithmetic with the remainder of the map value space. The
likelihood of breaking any existing real-world unprivileged eBPF
program is very small for this corner case.

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