Re: [PATCH bpf-next 4/7] bpf, arm64: Convert struct_ops arena arguments in the trampoline

Xu Kuohai <[email protected]>
Newsgroups org.kernel.vger.bpf
Message-ID <[email protected]>
On 8/14/2026 3:20 AM, Puranjay Mohan wrote:

[...]

>>> +static void emit_arena_arg_conv(struct jit_ctx *ctx, u8 dst, u8 src, bool nullable, u8 base_lo)
>>> +{
>>> +	if (nullable) {
>>> +		if (dst != src)
>>> +			emit(A64_MOV(1, dst, src), ctx);
>>> +		/* skip the subtraction so that NULL stays NULL */
>>> +		emit(A64_CBZ(1, dst, 2), ctx);
>>> +		src = dst;
>>> +	}
>>> +	emit(A64_SUB(0, dst, src, base_lo), ctx);
>> Maybe I'm missing something, do we need to validate whether the
>> address in the src register is really inside the current bpf
>> prog's arena?
> The JIT can assume that it is a kernel address into the arena as it
> comes from struct ops.

Thanks for the clarification, but I'm still confused. What makes the
assumption hold? How does struct_ops ensure the address passed is
inside the arena used by the current prog?

[...]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.