From: sashiko-bot@kernel.org
To: "Daniel Borkmann" <daniel@iogearbox.net>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v3 24/24] selftests/bpf: Extend the JIT instruction tests for arm64 encodings
Date: Sun, 08 Nov 2026 19:45:04 +0000 [thread overview]
Message-ID: <sashiko-outbox-203993@kernel.org> (raw)
In-Reply-To: <f16feeec21ead88b0459d967f976fad4f60b750b.1794165614.git.daniel@iogearbox.net>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] selftests/bpf: misaligned XDP packet load in test_tail_call()
--
commit 3e5456182ae6e38cbc6f04091b8df4d4e305b794
Author: Daniel Borkmann <daniel@iogearbox.net>
selftests/bpf: Extend the JIT instruction tests for arm64 encodings
This commit extends the BPF JIT instruction selftests with additional test
cases covering compares, bit tests, constant arithmetic, immediates, sign
jumps, arena and PROBE_MEM accesses, and tail calls.
> diff --git a/tools/testing/selftests/bpf/prog_tests/jit_insns.c b/tools/testing/selftests/bpf/prog_tests/jit_insns.c
> index 5fd1c856ded72..0aaab23a2eef8 100644
> --- a/tools/testing/selftests/bpf/prog_tests/jit_insns.c
> +++ b/tools/testing/selftests/bpf/prog_tests/jit_insns.c
[ ... ]
> @@ -3093,6 +3598,94 @@ static void test_helper_calls(void)
> close(map_fd);
> }
>
> +/*
> + * A tail call with the index from the packet, which the JIT scales and takes
> + * the low 32 bits of: the entries return their index plus one, an empty one
> + * and an index from the array size on TAIL_FALL, the upper 32 bits ignored.
> + */
> +#define TAIL_ENTRIES 7
> +#define TAIL_FALL 0xfa11
> +
> +static void test_tail_call(void)
> +{
[ ... ]
> + LIBBPF_OPTS(bpf_prog_load_opts, lopts,
> + .log_buf = log,
> + .log_size = sizeof(log),
> + );
[ ... ]
> + /* The index from the packet, a call which comes back returns TAIL_FALL */
> + n = 0;
> + insns[n++] = BPF_MOV64_REG(BPF_REG_6, BPF_REG_1);
> + insns[n++] = BPF_LDX_MEM(BPF_W, BPF_REG_2, BPF_REG_1, offsetof(struct xdp_md, data));
> + insns[n++] = BPF_LDX_MEM(BPF_W, BPF_REG_3, BPF_REG_1, offsetof(struct xdp_md, data_end));
> + insns[n++] = BPF_MOV64_REG(BPF_REG_4, BPF_REG_2);
> + insns[n++] = BPF_ALU64_IMM(BPF_ADD, BPF_REG_4, 8);
> + insns[n++] = BPF_JMP_REG(BPF_JGT, BPF_REG_4, BPF_REG_3, 5);
> + insns[n++] = BPF_LDX_MEM(BPF_DW, BPF_REG_3, BPF_REG_2, 0);
> + insns[n++] = BPF_MOV64_REG(BPF_REG_1, BPF_REG_6);
> + insns[n++] = BPF_RAW_INSN(BPF_LD | BPF_DW | BPF_IMM, BPF_REG_2, BPF_PSEUDO_MAP_FD, 0,
> + map_fd);
> + insns[n++] = BPF_RAW_INSN(0, 0, 0, 0, 0);
> + insns[n++] = BPF_RAW_INSN(BPF_JMP | BPF_CALL, 0, 0, 0, BPF_FUNC_tail_call);
> + insns[n++] = BPF_MOV64_IMM(BPF_REG_0, TAIL_FALL);
> + insns[n++] = BPF_EXIT_INSN();
> + fd = bpf_prog_load(BPF_PROG_TYPE_XDP, NULL, "GPL", insns, n, &lopts);
> + if (!ASSERT_GE(fd, 0, "tail call")) {
[Severity: Medium]
As reported by bot+bpf-ci@kernel.org on v2 [1], will the verifier reject
this BPF_DW load from the XDP packet pointer on architectures without
CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS?
When strict alignment is enabled and lopts does not set
BPF_F_ANY_ALIGNMENT, check_pkt_ptr_alignment() adds NET_IP_ALIGN (2) to
the packet offset and rejects the 8-byte load at offset 0 with -EACCES,
causing the tail_call subtest to fail on strict-alignment targets.
[1] https://lore.kernel.org/r/eadd9b884e7ca42ebd241f55d6bfd3dd1c9628927b1425e46db2f7197efaeecc@mail.kernel.org
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1794165614.git.daniel@iogearbox.net?part=24
next prev parent reply other threads:[~2026-11-08 19:45 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-08 19:26 [PATCH bpf-next v3 00/24] bpf: Various arm64 BPF JIT improvements Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 01/24] bpf, arm64: Remove unused A64_BL, A64_BTI_C and A64_LDR32LIT Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 02/24] bpf, arm64: Free the offset table of a subprog in bpf_jit_free Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 03/24] bpf, arm64: Free the private stack when a pass over the image fails Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 04/24] bpf, arm64: Emit ISB SY in the speculation barriers Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 05/24] arm64, insn: Reject sign extending loads of 64 bits Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 06/24] bpf, arm64: Keep the ll/sc atomics address apart from the old value Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 07/24] bpf, arm64: Measure backward branches from the branch itself Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 08/24] arm64, insn: Reject invalid and unpredictable operands in the encoders Daniel Borkmann
2026-11-08 19:38 ` sashiko-bot
2026-11-08 19:53 ` Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 09/24] bpf, arm64: Widen the branch offsets before scaling them to bytes Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 10/24] arm64, insn: Add the LDUR/STUR and TBZ/TBNZ encodings Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 11/24] bpf: Divide by constants via uhmul and shmul in the verifier Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 12/24] bpf, arm64: Consolidate the load and store emission into a helper Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 13/24] bpf, arm64: Use the unscaled forms for negative and unaligned offsets Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 14/24] bpf, arm64: Store zero immediates from the zero register Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 15/24] bpf, arm64: Zero extend the arena offset in register offset accesses Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 16/24] bpf, arm64: Adjust compares with unencodable immediates by one Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 17/24] bpf, arm64: Materialize immediates with fewer instructions Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 18/24] bpf, arm64: Shorten the tail call sequence Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 19/24] bpf, arm64: Use mov or mvn for AND, OR and XOR with all ones Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 20/24] bpf, arm64: Use cbz, cbnz, tbz and tbnz for zero, sign and bit tests Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 21/24] bpf, arm64: Multiply by constants with shifts, adds and subs Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 22/24] selftests/bpf: Let the arm64 private stack check skip the BTI pad Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 23/24] selftests/bpf: Test the verifier's division by constants Daniel Borkmann
2026-11-08 19:26 ` [PATCH bpf-next v3 24/24] selftests/bpf: Extend the JIT instruction tests for arm64 encodings Daniel Borkmann
2026-11-08 19:45 ` sashiko-bot [this message]
2026-11-08 19:47 ` Daniel Borkmann
2026-11-09 1:26 ` [PATCH bpf-next v3 00/24] bpf: Various arm64 BPF JIT improvements patchwork-bot+netdevbpf
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=sashiko-outbox-203993@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=sashiko-reviews@lists.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox