From: Anton Protopopov <a.s.protopopov@gmail.com>
To: Puranjay Mohan <puranjay@kernel.org>
Cc: bpf@vger.kernel.org, Puranjay Mohan <puranjay12@gmail.com>,
Alexei Starovoitov <ast@kernel.org>,
Andrii Nakryiko <andrii@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <martin.lau@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Xu Kuohai <xukuohai@huaweicloud.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>,
kernel-team@meta.com
Subject: Re: [PATCH bpf-next 2/4] bpf: arm64: Add support for indirect jumps
Date: Mon, 17 Nov 2025 08:23:33 +0000 [thread overview]
Message-ID: <aRrbhVollFOf0d/A@mail.gmail.com> (raw)
In-Reply-To: <20251117004656.33292-3-puranjay@kernel.org>
On 25/11/17 12:46AM, Puranjay Mohan wrote:
> Add support for a new instruction
>
> BPF_JMP|BPF_X|BPF_JA, SRC=0, DST=Rx, off=0, imm=0
>
> which does an indirect jump to a location stored in Rx. The register
> Rx should have type PTR_TO_INSN. This new type assures that the Rx
> register contains a value (or a range of values) loaded from a
> correct jump table – map of type instruction array.
>
> ARM64 JIT supports indirect jumps to all registers through the A64_BR()
> macro, use it to implement this new instruction.
>
> Signed-off-by: Puranjay Mohan <puranjay@kernel.org>
> ---
> arch/arm64/net/bpf_jit_comp.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
> index 4a2afc0cefc4..4cfb549f2b43 100644
> --- a/arch/arm64/net/bpf_jit_comp.c
> +++ b/arch/arm64/net/bpf_jit_comp.c
> @@ -1452,6 +1452,10 @@ static int build_insn(const struct bpf_insn *insn, struct jit_ctx *ctx,
> emit(A64_ASR(is64, dst, dst, imm), ctx);
> break;
>
> + /* JUMP reg */
> + case BPF_JMP | BPF_JA | BPF_X:
> + emit(A64_BR(dst), ctx);
> + break;
> /* JUMP off */
> case BPF_JMP | BPF_JA:
> case BPF_JMP32 | BPF_JA:
> --
> 2.47.3
>
Reviewed-by: Anton Protopopov <a.s.protopopov@gmail.com>
next prev parent reply other threads:[~2025-11-17 8:16 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-17 0:46 [PATCH bpf-next 0/4] bpf: arm64: Indirect jumps Puranjay Mohan
2025-11-17 0:46 ` [PATCH bpf-next 1/4] bpf: arm64: Add support for instructions array Puranjay Mohan
2025-11-17 8:22 ` Anton Protopopov
2025-11-17 0:46 ` [PATCH bpf-next 2/4] bpf: arm64: Add support for indirect jumps Puranjay Mohan
2025-11-17 8:23 ` Anton Protopopov [this message]
2025-11-17 0:46 ` [PATCH bpf-next 3/4] libbpf: Ignore relocations for .jumptables sections Puranjay Mohan
2025-11-17 0:46 ` [PATCH bpf-next 4/4] selftests: bpf: Enable gotox tests from arm64 Puranjay Mohan
2025-11-17 8:24 ` Anton Protopopov
2025-11-17 8:08 ` [PATCH bpf-next 0/4] bpf: arm64: Indirect jumps Anton Protopopov
2025-11-17 13:01 ` Puranjay Mohan
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=aRrbhVollFOf0d/A@mail.gmail.com \
--to=a.s.protopopov@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=kernel-team@meta.com \
--cc=martin.lau@kernel.org \
--cc=puranjay12@gmail.com \
--cc=puranjay@kernel.org \
--cc=will@kernel.org \
--cc=xukuohai@huaweicloud.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox