]> www.infradead.org Git - users/dwmw2/linux.git/commit
selftests/bpf: add negative tests for new VFS based BPF kfuncs
authorMatt Bobrowski <mattbobrowski@google.com>
Wed, 31 Jul 2024 11:08:32 +0000 (11:08 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 6 Aug 2024 16:01:41 +0000 (09:01 -0700)
commitff358ada070fa1b64a6368147b2b56cc6a921847
treeb8a59e28c096fd6ddc51c41d8ee7b19d192cd378
parentd08e2045ebf0f5f2a97ad22cc7dae398b35354ba
selftests/bpf: add negative tests for new VFS based BPF kfuncs

Add a bunch of negative selftests responsible for asserting that the
BPF verifier successfully rejects a BPF program load when the
underlying BPF program misuses one of the newly introduced VFS based
BPF kfuncs.

The following VFS based BPF kfuncs are extensively tested within this
new selftest:

* struct file *bpf_get_task_exe_file(struct task_struct *);
* void bpf_put_file(struct file *);
* int bpf_path_d_path(struct path *, char *, size_t);

Acked-by: Christian Brauner <brauner@kernel.org>
Acked-by: Song Liu <song@kernel.org>
Signed-off-by: Matt Bobrowski <mattbobrowski@google.com>
Link: https://lore.kernel.org/r/20240731110833.1834742-3-mattbobrowski@google.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/bpf_experimental.h
tools/testing/selftests/bpf/prog_tests/verifier.c
tools/testing/selftests/bpf/progs/verifier_vfs_reject.c [new file with mode: 0644]