Re: [PATCH RESEND bpf-next v10 7/8] bpf: allow non-owning list-node args via __nonown_allowed
From: Eduard Zingerman
Date: Wed May 13 2026 - 18:56:16 EST
On Wed, 2026-05-13 at 15:37 -0700, Eduard Zingerman wrote:
> On Tue, 2026-05-12 at 13:59 +0800, Kaitao cheng wrote:
> > From: Kaitao Cheng <chengkaitao@xxxxxxxxxx>
> >
> > KF_ARG_PTR_TO_LIST_NODE normally requires an owning reference
> > (PTR_TO_BTF_ID | MEM_ALLOC with ref_obj_id). Introduce and use
> > the __nonown_allowed annotation on selected list-node arguments
> > so non-owning references with ref_obj_id==0 are accepted as well.
> >
> > This enables passing bpf_list_front() / bpf_list_back() results to:
> >
> > bpf_list_add() as insertion point (prev)
> > bpf_list_del() as deletion target (node)
> > bpf_list_is_first/last() as query target (node)
> >
> > Verifier keeps existing owning-ref checks by default; only arguments
> > annotated with __nonown_allowed bypass MEM_ALLOC/ref_obj_id checks
> > and then follow the same list-node validation path.
> >
> > Signed-off-by: Kaitao Cheng <chengkaitao@xxxxxxxxxx>
> > ---
Also, I think it is worthwhile to move this patch before the patches
that introduce kfuncs that use the __nonown_allowed annotation.
(In case if this series goes to v11).