]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/bpf: Check map in map pruning
authorLorenz Bauer <lmb@cloudflare.com>
Thu, 11 Nov 2021 16:14:52 +0000 (16:14 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 13 Nov 2021 01:23:04 +0000 (17:23 -0800)
commit4e785be293af5e859f0e0b36269ade5a713b8257
tree5f713d2b79f8e0b850461291dfb4d2dcf81014b2
parent86563912aca542acd845ab858191fe5d138c34db
selftests/bpf: Check map in map pruning

Ensure that two registers with a map_value loaded from a nested
map are considered equivalent for the purpose of state pruning
and don't cause the verifier to revisit a pruning point.

This uses a rather crude match on the number of insns visited by
the verifier, which might change in the future. I've therefore
tried to keep the code as "unpruneable" as possible by having
the code paths only converge on the second to last instruction.

Should you require to adjust the test in the future, reducing the
number of processed instructions should always be safe. Increasing
them could cause another regression, so proceed with caution.

Suggested-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Lorenz Bauer <lmb@cloudflare.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/CACAyw99hVEJFoiBH_ZGyy=+oO-jyydoz6v1DeKPKs2HVsUH28w@mail.gmail.com
Link: https://lore.kernel.org/bpf/20211111161452.86864-1-lmb@cloudflare.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/verifier/map_in_map.c