From: "Kumar Kartikeya Dwivedi" <memxor@gmail.com>
To: "Xu Kuohai" <xukuohai@huaweicloud.com>,
"Puranjay Mohan" <puranjay@kernel.org>, <bpf@vger.kernel.org>
Cc: "Alexei Starovoitov" <ast@kernel.org>,
"Daniel Borkmann" <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>,
"Martin KaFai Lau" <martin.lau@linux.dev>,
"Eduard Zingerman" <eddyz87@gmail.com>,
"Song Liu" <song@kernel.org>,
"Yonghong Song" <yonghong.song@linux.dev>,
"Mark Rutland" <mark.rutland@arm.com>,
"Will Deacon" <will@kernel.org>,
"Catalin Marinas" <catalin.marinas@arm.com>,
"Puranjay Mohan" <puranjay12@gmail.com>
Subject: Re: [PATCH bpf-next 4/7] bpf, arm64: Convert struct_ops arena arguments in the trampoline
Date: Fri, 14 Aug 2026 05:27:12 +0200 [thread overview]
Message-ID: <DKOCI4Z5JJC5.24Z0Q14YKRX60@gmail.com> (raw)
In-Reply-To: <a6dde22e-47d1-4f5d-9ab9-284e9beefd56@huaweicloud.com>
On Fri Aug 14, 2026 at 4:10 AM CEST, Xu Kuohai wrote:
> 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?
>
I think we would expect the kernel caller passing the address to the struct_ops
callback to have something that points into the arena region. If that
expectation is broken it should be treated as a kernel bug and be dealt with
accordingly.
Does that clarify your concern, or did I miss what confused you here?
> [...]
next prev parent reply other threads:[~2026-08-14 3:27 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-10 19:09 [PATCH bpf-next 0/7] bpf, arm64: __arena kfunc and struct_ops arguments Puranjay Mohan
2026-08-10 19:09 ` [PATCH bpf-next 1/7] bpf, arm64: Fix stack-passed arguments for indirect trampolines Puranjay Mohan
2026-08-13 9:03 ` Xu Kuohai
2026-08-10 19:09 ` [PATCH bpf-next 2/7] arm64: insn: Add encoder for ADD/SUB (extended register) Puranjay Mohan
2026-08-10 19:19 ` sashiko-bot
2026-08-13 19:28 ` Puranjay Mohan
2026-08-13 10:11 ` Xu Kuohai
2026-08-13 19:21 ` Puranjay Mohan
2026-08-10 19:09 ` [PATCH bpf-next 3/7] bpf, arm64: JIT __arena kfunc argument rebasing Puranjay Mohan
2026-08-13 11:36 ` Xu Kuohai
2026-08-10 19:09 ` [PATCH bpf-next 4/7] bpf, arm64: Convert struct_ops arena arguments in the trampoline Puranjay Mohan
2026-08-13 11:51 ` Xu Kuohai
2026-08-13 19:20 ` Puranjay Mohan
2026-08-14 2:10 ` Xu Kuohai
2026-08-14 3:27 ` Kumar Kartikeya Dwivedi [this message]
2026-08-14 3:49 ` Xu Kuohai
2026-08-10 19:09 ` [PATCH bpf-next 5/7] selftests/bpf: Add arm64 JIT-sequence tests for __arena kfunc arguments Puranjay Mohan
2026-08-13 11:56 ` Xu Kuohai
2026-08-10 19:09 ` [PATCH bpf-next 6/7] selftests/bpf: Enable __arena argument tests on arm64 Puranjay Mohan
2026-08-13 11:57 ` Xu Kuohai
2026-08-10 19:09 ` [PATCH bpf-next 7/7] selftests/bpf: Test a multi-slot argument before a struct_ops arena argument Puranjay Mohan
2026-08-13 12:07 ` Xu Kuohai
2026-08-12 23:50 ` [PATCH bpf-next 0/7] bpf, arm64: __arena kfunc and struct_ops arguments Kumar Kartikeya Dwivedi
2026-08-13 2:33 ` Xu Kuohai
2026-08-13 3:32 ` Kumar Kartikeya Dwivedi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DKOCI4Z5JJC5.24Z0Q14YKRX60@gmail.com \
--to=memxor@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=catalin.marinas@arm.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=mark.rutland@arm.com \
--cc=martin.lau@linux.dev \
--cc=puranjay12@gmail.com \
--cc=puranjay@kernel.org \
--cc=song@kernel.org \
--cc=will@kernel.org \
--cc=xukuohai@huaweicloud.com \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.