selftests/bpf: add a test for iter/task_vma for short-lived processes
authorKui-Feng Lee <kuifeng@meta.com>
Fri, 16 Dec 2022 22:18:55 +0000 (14:18 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 28 Dec 2022 22:11:48 +0000 (14:11 -0800)
commitb7793c8db7d9beb903bb42f52872b5b46abdcb88
tree5647f0a167f6d19d803bba618e0ba12eac578691
parent7ff94f276f8ea05df82eb115225e9b26f47a3347
selftests/bpf: add a test for iter/task_vma for short-lived processes

When a task iterator traverses vma(s), it is possible task->mm might
become invalid in the middle of traversal and this may cause kernel
misbehave (e.g., crash)

This test case creates iterators repeatedly and forks short-lived
processes in the background to detect this bug.  The test will last
for 3 seconds to get the chance to trigger the issue.

Signed-off-by: Kui-Feng Lee <kuifeng@meta.com>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/r/20221216221855.4122288-3-kuifeng@meta.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/bpf_iter.c