]> git.ipfire.org Git - thirdparty/linux.git/commit
selftests/bpf: add regression test for bpf_d_path()
authorShuran Liu <electronlsr@gmail.com>
Sat, 6 Dec 2025 14:12:10 +0000 (22:12 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 10 Dec 2025 09:36:26 +0000 (01:36 -0800)
commit79e247d6608848c09038d0b1e7d256432624fd84
treef9e8465d16c593b1c345407724303a753a1b6e57
parentac44dcc788b950606793e8f9690c30925f59df02
selftests/bpf: add regression test for bpf_d_path()

Add a regression test for bpf_d_path() to cover incorrect verifier
assumptions caused by an incorrect function prototype. The test
attaches to the fallocate hook, calls bpf_d_path() and verifies that
a simple prefix comparison on the returned pathname behaves correctly
after the fix in patch 1. It ensures the verifier does not assume
the buffer remains unwritten.

Co-developed-by: Zesen Liu <ftyg@live.com>
Signed-off-by: Zesen Liu <ftyg@live.com>
Co-developed-by: Peili Gao <gplhust955@gmail.com>
Signed-off-by: Peili Gao <gplhust955@gmail.com>
Co-developed-by: Haoran Ni <haoran.ni.cs@gmail.com>
Signed-off-by: Haoran Ni <haoran.ni.cs@gmail.com>
Signed-off-by: Shuran Liu <electronlsr@gmail.com>
Link: https://lore.kernel.org/r/20251206141210.3148-3-electronlsr@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/d_path.c
tools/testing/selftests/bpf/progs/test_d_path.c