patch 'bpf: fix index register for classic BPF indirect loads' has been queued to stable release 24.11.9
luca.boccassi at gmail.com
luca.boccassi at gmail.com
Mon Nov 16 23:52:33 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 11/18/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/c645a063b8d8c54028123e9a7220be429bc056ca
Thanks.
Luca Boccassi
---
>From c645a063b8d8c54028123e9a7220be429bc056ca Mon Sep 17 00:00:00 2001
From: Stephen Hemminger <stephen at networkplumber.org>
Date: Tue, 27 Oct 2026 10:06:19 -0700
Subject: [PATCH] bpf: fix index register for classic BPF indirect loads
[ upstream commit 2e2f0d720cd8772cbfa96ee06049236bf7c547fc ]
Classic BPF filters using a variable offset into the packet, such as
"tcp[tcpflags] & tcp-syn != 0" or "tcp[0:4] = ...", read the wrong bytes.
The indirect loads ldb/ld [x + k] were handled in the same case as the
arithmetic instructions, which take the source register from
BPF_SRC(code), that is bit 0x08. In a load opcode that bit is part of
the size field, not a K/X selector, so BPF_LD|BPF_IND|BPF_B (0x50) and
BPF_LD|BPF_IND|BPF_W (0x40) both yield BPF_K and the index register
becomes R0 (A) instead of R7 (X). The halfword form works only because
BPF_H and BPF_X are both 0x08.
Give the indirect loads their own case next to the absolute loads and
emit X as the index register. The interpreter and the JITs already
take the index from src_reg, so this fixes all engines.
Bugzilla ID: 2085
Fixes: 2eccf6afbea9 ("bpf: add function to convert classic BPF to DPDK BPF")
Reported-by: Anthropic OSS scanner (ANT-2026-O029C471)
Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
Acked-by: Konstantin Ananyev <konstantin.v.ananyev at yandex.ru>
---
lib/bpf/bpf_convert.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/lib/bpf/bpf_convert.c b/lib/bpf/bpf_convert.c
index e7e298c9cb..4c1ec233f3 100644
--- a/lib/bpf/bpf_convert.c
+++ b/lib/bpf/bpf_convert.c
@@ -297,6 +297,13 @@ do_pass:
*insn = BPF_RAW_INSN(fp->code, 0, 0, 0, fp->k);
break;
+ /* Indirect loads index the packet with X: A = P[X + k] */
+ case BPF_LD | BPF_IND | BPF_W:
+ case BPF_LD | BPF_IND | BPF_H:
+ case BPF_LD | BPF_IND | BPF_B:
+ *insn = BPF_RAW_INSN(fp->code, 0, BPF_REG_X, 0, fp->k);
+ break;
+
case BPF_ALU | BPF_DIV | BPF_X:
case BPF_ALU | BPF_MOD | BPF_X:
/* For cBPF, don't cause floating point exception */
@@ -324,9 +331,6 @@ do_pass:
case BPF_ALU | BPF_DIV | BPF_K:
case BPF_ALU | BPF_MOD | BPF_K:
case BPF_ALU | BPF_NEG:
- case BPF_LD | BPF_IND | BPF_W:
- case BPF_LD | BPF_IND | BPF_H:
- case BPF_LD | BPF_IND | BPF_B:
/* All arithmetic insns map as-is. */
insn->code = fp->code;
insn->dst_reg = BPF_REG_A;
--
2.47.3
---
Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- - 2026-11-16 22:52:19.604599433 +0000
+++ 0079-bpf-fix-index-register-for-classic-BPF-indirect-load.patch 2026-11-16 22:52:16.540234862 +0000
@@ -1 +1 @@
-From 2e2f0d720cd8772cbfa96ee06049236bf7c547fc Mon Sep 17 00:00:00 2001
+From c645a063b8d8c54028123e9a7220be429bc056ca Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 2e2f0d720cd8772cbfa96ee06049236bf7c547fc ]
+
@@ -23 +24,0 @@
-Cc: stable at dpdk.org
@@ -33 +34 @@
-index 37095eea52..a32e1cdd8a 100644
+index e7e298c9cb..4c1ec233f3 100644
@@ -36 +37 @@
-@@ -301,6 +301,13 @@ do_pass:
+@@ -297,6 +297,13 @@ do_pass:
@@ -50 +51 @@
-@@ -328,9 +335,6 @@ do_pass:
+@@ -324,9 +331,6 @@ do_pass:
More information about the stable
mailing list