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

Restrict stack 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 stack pointer as a destination we simulate a check_stack_access()
of 1 byte on the destination and once that fails the program is
rejected for unprivileged program loads. This is analog to map
value pointer arithmetic and needed for masking later on.

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