On Wed, Oct 7, 2026 at 9:25 AM Yiyang Chen <[email protected]> wrote: > > Extend verifier_global_ptr_args.c with calls that pass bare and > RCU-protected task pointers to a global __arg_trusted parameter. Both > calls must be rejected because neither pointer is referenced or trusted. > > Add paired test-module kfuncs that return and accept a nullable trusted > task pointer. Passing the return value directly must succeed, covering > PTR_TRUSTED | PTR_MAYBE_NULL handling in the common argument checker. > > Signed-off-by: Yiyang Chen <[email protected]>
Reviewed-by: Amery Hung <[email protected]> > --- > tools/testing/selftests/bpf/progs/iters_testmod.c | 11 +++++++ > .../selftests/bpf/progs/verifier_global_ptr_args.c | 35 > ++++++++++++++++++++++ > .../testing/selftests/bpf/test_kmods/bpf_testmod.c | 11 +++++++ > .../selftests/bpf/test_kmods/bpf_testmod_kfunc.h | 2 ++ > 4 files changed, 59 insertions(+) > > diff --git a/tools/testing/selftests/bpf/progs/iters_testmod.c > b/tools/testing/selftests/bpf/progs/iters_testmod.c > index f65cc9766633e..145750bb64ef8 100644 > --- a/tools/testing/selftests/bpf/progs/iters_testmod.c > +++ b/tools/testing/selftests/bpf/progs/iters_testmod.c > @@ -46,6 +46,17 @@ int iter_next_trusted_or_null(const void *ctx) > return 0; > } > > +SEC("syscall") > +__success > +int trusted_nullable_kfunc(const void *ctx) > +{ > + struct task_struct *task; > + > + task = bpf_kfunc_trusted_null_test(); > + bpf_kfunc_trusted_nullable_test(task); > + return 0; > +} > + nit: tools/testing/selftests/bpf/progs/test_kfunc_param_nullable.c feels like a better place than iters_testmod.c for the test.

