selftests/bpf: Add tests for open-coded task_vma iter
authorDave Marchevsky <davemarchevsky@fb.com>
Fri, 13 Oct 2023 20:44:25 +0000 (13:44 -0700)
committerAndrii Nakryiko <andrii@kernel.org>
Fri, 13 Oct 2023 22:48:58 +0000 (15:48 -0700)
commite0e1a7a5fc377d54bd792c6368a375d41fc316ef
treef8e5d4265acfb8d1a0d074ca8188cbd8e86c4105
parent4ac4546821584736798aaa9e97da9f6eaf689ea3
selftests/bpf: Add tests for open-coded task_vma iter

The open-coded task_vma iter added earlier in this series allows for
natural iteration over a task's vmas using existing open-coded iter
infrastructure, specifically bpf_for_each.

This patch adds a test demonstrating this pattern and validating
correctness. The vma->vm_start and vma->vm_end addresses of the first
1000 vmas are recorded and compared to /proc/PID/maps output. As
expected, both see the same vmas and addresses - with the exception of
the [vsyscall] vma - which is explained in a comment in the prog_tests
program.

Signed-off-by: Dave Marchevsky <davemarchevsky@fb.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20231013204426.1074286-5-davemarchevsky@fb.com
tools/testing/selftests/bpf/bpf_experimental.h
tools/testing/selftests/bpf/prog_tests/iters.c
tools/testing/selftests/bpf/progs/iters_task_vma.c [new file with mode: 0644]