]> www.infradead.org Git - users/jedix/linux-maple.git/commit
bpf: Drop special callback reference handling
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Sat, 9 Nov 2024 23:14:30 +0000 (15:14 -0800)
committerAndrii Nakryiko <andrii@kernel.org>
Mon, 11 Nov 2024 16:18:55 +0000 (08:18 -0800)
commitae6e3a273f590a2b64f14a9fab3546c3a8f44ed4
treebb926d00e5d37fec39645fab3b71a950848c45c7
parentf6b9a69a9e56b2083aca8a925fc1a28eb698e3ed
bpf: Drop special callback reference handling

Logic to prevent callbacks from acquiring new references for the program
(i.e. leaving acquired references), and releasing caller references
(i.e. those acquired in parent frames) was introduced in commit
9d9d00ac29d0 ("bpf: Fix reference state management for synchronous callbacks").

This was necessary because back then, the verifier simulated each
callback once (that could potentially be executed N times, where N can
be zero). This meant that callbacks that left lingering resources or
cleared caller resources could do it more than once, operating on
undefined state or leaking memory.

With the fixes to callback verification in commit
ab5cfac139ab ("bpf: verify callbacks as if they are called unknown number of times"),
all of this extra logic is no longer necessary. Hence, drop it as part
of this commit.

Cc: Eduard Zingerman <eddyz87@gmail.com>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20241109231430.2475236-3-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
include/linux/bpf_verifier.h
kernel/bpf/verifier.c
tools/testing/selftests/bpf/prog_tests/cb_refs.c