]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/bpf: Add tests for bpf_find_vma
authorSong Liu <songliubraving@fb.com>
Fri, 5 Nov 2021 23:23:30 +0000 (16:23 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 7 Nov 2021 19:54:51 +0000 (11:54 -0800)
commitf108662b27c96cdadfadd39f0c0d650704cd593d
tree0adf410fb0caebdb0252f340a7fd0b27ff6c56e3
parent7c7e3d31e7856a8260a254f8c71db416f7f9f5a1
selftests/bpf: Add tests for bpf_find_vma

Add tests for bpf_find_vma in perf_event program and kprobe program. The
perf_event program is triggered from NMI context, so the second call of
bpf_find_vma() will return -EBUSY (irq_work busy). The kprobe program,
on the other hand, does not have this constraint.

Also add tests for illegal writes to task or vma from the callback
function. The verifier should reject both cases.

Signed-off-by: Song Liu <songliubraving@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20211105232330.1936330-3-songliubraving@fb.com
tools/testing/selftests/bpf/prog_tests/find_vma.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/find_vma.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/find_vma_fail1.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/find_vma_fail2.c [new file with mode: 0644]