]> www.infradead.org Git - users/dwmw2/linux.git/commit
bpf: Unify resource leak checks
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Sun, 3 Nov 2024 22:59:39 +0000 (14:59 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 4 Nov 2024 00:52:06 +0000 (16:52 -0800)
commitd402755ced2ea8fc1f0513136f074002d509bfa0
treedfa2b8d13318abf888384053c2b2850df8cdfc12
parent46f7ed32f7a873d6675ea72e1d6317df41a55f81
bpf: Unify resource leak checks

There are similar checks for covering locks, references, RCU read
sections and preempt_disable sections in 3 places in the verifer, i.e.
for tail calls, bpf_ld_[abs, ind], and exit path (for BPF_EXIT and
bpf_throw). Unify all of these into a common check_resource_leak
function to avoid code duplication.

Also update the error strings in selftests to the new ones in the same
change to ensure clean bisection.

Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20241103225940.1408302-3-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c
tools/testing/selftests/bpf/progs/exceptions_fail.c
tools/testing/selftests/bpf/progs/preempt_lock.c
tools/testing/selftests/bpf/progs/verifier_ref_tracking.c
tools/testing/selftests/bpf/progs/verifier_spin_lock.c