]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: allow adjusted map element values to spill
authorGianluca Borello <g.borello@gmail.com>
Mon, 9 Jan 2017 18:19:48 +0000 (10:19 -0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 9 Jan 2017 21:56:27 +0000 (16:56 -0500)
commitf815a1f5ad297f0743eb96c9a0c340e7150322fa
treea5346893ba6a94ecab7394d57bbabd730e1bf59f
parent588ceae623c627f0b7571c14fc60f0ec1a9de60f
bpf: allow adjusted map element values to spill

commit a91a21eaf94f ("bpf: allow access into map value arrays")
introduces the ability to do pointer math inside a map element value via
the PTR_TO_MAP_VALUE_ADJ register type.

The current support doesn't handle the case where a PTR_TO_MAP_VALUE_ADJ
is spilled into the stack, limiting several use cases, especially when
generating bpf code from a compiler.

Handle this case by explicitly enabling the register type
PTR_TO_MAP_VALUE_ADJ to be spilled. Also, make sure that min_value and
max_value are reset just for BPF_LDX operations that don't result in a
restore of a spilled register from stack.

Signed-off-by: Gianluca Borello <g.borello@gmail.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
kernel/bpf/verifier.c
tools/testing/selftests/bpf/test_verifier.c