]> git.ipfire.org Git - thirdparty/linux.git/commit
selftests/bpf: assert BPF kfunc default trusted pointer semantics
authorMatt Bobrowski <mattbobrowski@google.com>
Tue, 13 Jan 2026 08:39:49 +0000 (08:39 +0000)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 14 Jan 2026 03:19:13 +0000 (19:19 -0800)
commitbbdbed193bcf57f1e9c0d9d58c3ad3350bfd0bd1
treed847b839676b04a8e446261ebb0659113658f042
parente463b6de9da17995a2ddabf199cc00c65a8a5392
selftests/bpf: assert BPF kfunc default trusted pointer semantics

The BPF verifier was recently updated to treat pointers to struct types
returned from BPF kfuncs as implicitly trusted by default. Add a new
test case to exercise this new implicit trust semantic.

The KF_ACQUIRE flag was dropped from the bpf_get_root_mem_cgroup()
kfunc because it returns a global pointer to root_mem_cgroup without
performing any explicit reference counting. This makes it an ideal
candidate to verify the new implicit trusted pointer semantics.

Signed-off-by: Matt Bobrowski <mattbobrowski@google.com>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/r/20260113083949.2502978-3-mattbobrowski@google.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/bpf/prog_tests/verifier.c
tools/testing/selftests/bpf/progs/verifier_memcontrol.c [new file with mode: 0644]