Re: [PATCH bpf-next v3 5/9] selftests/bpf: Add kfunc __arena and __arena_nullable argument tests

Eduard Zingerman <[email protected]> Tue, 04 Aug 2026 13:24:28 -0700
Newsgroups org.kernel.vger.bpf
Message-ID <[email protected]>
On Tue, 2026-08-04 at 22:14 +0200, Kumar Kartikeya Dwivedi wrote:

...

> > Which leads to several conclusions:
> > - We should reach a consensus regarding KF_ARENA* usage, as these
> >   kfuncs would clearly benefit from having __arena annotations on
> >   parameters (on the BPF side, on the host side these should be
> >   declared as plain pointers).
> 
> Yes, but even if we do, for the time begin, we won't have support for
> automatically emitting it until resolve_btfids changes are done. That said, I
> can manually add the annotation for now.

We can fast-track resolve_btfids.

> > - In patch #1, it appears that there is no need to allow PTR_TO_ARENA
> >   for parameters passed to such a function. At-least I don't see a C
> >   code not involving manual casts that would require such support.
> 
> This one I don't understand. Why wouldn't we get PTR_TO_ARENA typed paramters as
> arguments?

`(u64 *)val` is translated as an address space cast instruction.
This instruction yields PTR_TO_ARENA. Except for explicit casts,
how else can you pass PTR_TO_ARENA to such a function?

...