]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Relax return code check for subprograms
authorDmitrii Banshchikov <me@ubique.spb.ru>
Fri, 13 Nov 2020 17:17:56 +0000 (17:17 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 14 Nov 2020 16:17:27 +0000 (08:17 -0800)
commit5b005620f22da36bab2671cb4d10ec335e79ea19
tree7fa16ea50da2ef7daa298a339b156ef137224861
parent8a735a282090135dc67f19fc386ec5d0a7c47879
bpf: Relax return code check for subprograms

Currently verifier enforces return code checks for subprograms in the
same manner as it does for program entry points. This prevents returning
arbitrary scalar values from subprograms. Scalar type of returned values
is checked by btf_prepare_func_args() and hence it should be safe to
allow only scalars for now. Relax return code checks for subprograms and
allow any correct scalar values.

Fixes: 3eff86613e506 (bpf: Introduce function-by-function verification)
Signed-off-by: Dmitrii Banshchikov <me@ubique.spb.ru>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20201113171756.90594-1-me@ubique.spb.ru
kernel/bpf/verifier.c
tools/testing/selftests/bpf/prog_tests/test_global_funcs.c
tools/testing/selftests/bpf/progs/test_global_func8.c [new file with mode: 0644]