patch 'bpf/arm64: fix offset type to allow a negative jump' has been queued to stable release 24.11.9
luca.boccassi at gmail.com
luca.boccassi at gmail.com
Tue Oct 27 12:51:25 CET 2026
Hi,
FYI, your patch has been queued to stable release 24.11.9
Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 10/29/26. So please
shout if anyone has objections.
Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.
Queued patches are on a temporary branch at:
https://github.com/bluca/dpdk-stable
This queued commit can be viewed at:
https://github.com/bluca/dpdk-stable/commit/bed47d177994e5b7d80cff5d5e47d477c14bb557
Thanks.
Luca Boccassi
---
>From bed47d177994e5b7d80cff5d5e47d477c14bb557 Mon Sep 17 00:00:00 2001
From: Christophe Fontaine <cfontain at redhat.com>
Date: Thu, 27 Aug 2026 14:41:45 -0700
Subject: [PATCH] bpf/arm64: fix offset type to allow a negative jump
[ upstream commit bb6b33cc498049377956a54a798871ea38ae5a5c ]
The DPDK BPF JIT standalone test test_ld_mbuf1 fails on arm64.
It does:
r6 = r1 // mbuf
r0 = *(u8 *)pkt[0] // BPF_ABS
if ((r0 & 0xf0) == 0x40)
goto parse
r0 = 0
exit // epilogue E0
parse:
r0 = *(u8 *)pkt[r0 + 3] // BPF_IND
...
exit
emit_return_zero_if_src_zero() returns 0 by branching to a function
epilogue. The target may be a previous epilogue so branch
might be backwards; therefore the offset needs to be negative.
The offset was stored in a uint16_t, so a negative value wrapped to a
large positive number; emit_b() then branched past the end of the
program and faulted at run time.
Fixes: 111e2a747a4f ("bpf/arm: add basic arithmetic operations")
Signed-off-by: Christophe Fontaine <cfontain at redhat.com>
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Marat Khalili <marat.khalili at huawei.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev at huawei.com>
---
lib/bpf/bpf_jit_arm64.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/bpf/bpf_jit_arm64.c b/lib/bpf/bpf_jit_arm64.c
index ca02067634b..9e351b8f1f7 100644
--- a/lib/bpf/bpf_jit_arm64.c
+++ b/lib/bpf/bpf_jit_arm64.c
@@ -965,10 +965,12 @@ static void
emit_return_zero_if_src_zero(struct a64_jit_ctx *ctx, bool is64, uint8_t src)
{
uint8_t r0 = ebpf_to_a64_reg(ctx, EBPF_REG_0);
- uint16_t jump_to_epilogue;
+ int32_t jump_to_epilogue;
emit_cbnz(ctx, is64, src, 3);
emit_mov_imm(ctx, is64, r0, 0);
+
+ /* maybe backwards branch to earlier epilogue */
jump_to_epilogue = (ctx->program_start + ctx->program_sz) - ctx->idx;
emit_b(ctx, jump_to_epilogue);
}
--
2.47.3
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-10-27 11:44:01.016140381 +0000
+++ 0191-bpf-arm64-fix-offset-type-to-allow-a-negative-jump.patch 2026-10-27 11:43:53.770067372 +0000
@@ -1 +1 @@
-From bb6b33cc498049377956a54a798871ea38ae5a5c Mon Sep 17 00:00:00 2001
+From bed47d177994e5b7d80cff5d5e47d477c14bb557 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit bb6b33cc498049377956a54a798871ea38ae5a5c ]
+
@@ -28 +29,0 @@
-Cc: stable at dpdk.org
@@ -39 +40 @@
-index 7582370062..51906c7f0d 100644
+index ca02067634b..9e351b8f1f7 100644
More information about the stable
mailing list