selftests/bpf: Add verifier test for PTR_TO_MEM spill
authorGilad Reti <gilad.reti@gmail.com>
Wed, 13 Jan 2021 05:38:08 +0000 (07:38 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 14 Jan 2021 03:47:44 +0000 (19:47 -0800)
commit4237e9f4a96228ccc8a7abe5e4b30834323cd353
treec51f271b9d313f4b557fbc8f472dabe68da473e7
parent744ea4e3885eccb6d332a06fae9eb7420a622c0f
selftests/bpf: Add verifier test for PTR_TO_MEM spill

Add a test to check that the verifier is able to recognize spilling of
PTR_TO_MEM registers, by reserving a ringbuf buffer, forcing the spill
of a pointer holding the buffer address to the stack, filling it back
in from the stack and writing to the memory area pointed by it.

The patch was partially contributed by CyberArk Software, Inc.

Signed-off-by: Gilad Reti <gilad.reti@gmail.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Acked-by: KP Singh <kpsingh@kernel.org>
Link: https://lore.kernel.org/bpf/20210113053810.13518-2-gilad.reti@gmail.com
tools/testing/selftests/bpf/test_verifier.c
tools/testing/selftests/bpf/verifier/spill_fill.c