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:33:42 -0700
| Newsgroups | org.kernel.vger.bpf |
|---|---|
| Message-ID | <[email protected]> |
On Tue, 2026-08-04 at 22:28 +0200, Kumar Kartikeya Dwivedi wrote: > On Tue Aug 4, 2026 at 10:26 PM CEST, Eduard Zingerman wrote: > > On Tue, 2026-08-04 at 13:24 -0700, Eduard Zingerman wrote: > > > 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? > > > > For example, `foo->ptr` yields a scalar from the verifier point of view. > > > > Sure, but I don't think we should reject the case where someone does explicit > cast. See e.g. the global function __arena tag, which also accepts both cases. PTR_TO_ARENA is already a valid kernel space pointer, it does not need additional conversion. > > > > > > > ...