Skip to contentSkip to conversation

ARM: disable broken eBPF JIT on the Risc PC

PATCH In review Ethan Nelson-Moore 4 participants 8 messages May 18 – Jun 15

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: disable broken eBPF JIT on the Risc PC

The eBPF JIT unconditionally generates ldrh/strh instructions, which do not function correctly on the Risc PC because its bus is unable to signal half-word accesses. Work around this issue by disabling the eBPF JIT when building for ARMv3 (the Risc PC is the only currently supported ARMv3 machine).

Fixes 39c13c204bb1 ("arm: eBPF JIT compiler")
---
 arch/arm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/Kconfig +1 -1
index 1155c78bb6aa..8185d013e5d1 100644
@@ -98,7 +98,7 @@ config ARM
 	select HAVE_ARCH_TRACEHOOK
 	select HAVE_ARCH_TRANSPARENT_HUGEPAGE if ARM_LPAE
 	select HAVE_ARM_SMCCC if CPU_V7
-	select HAVE_EBPF_JIT if !CPU_ENDIAN_BE32
+	select HAVE_EBPF_JIT if !CPU_ENDIAN_BE32 && !CPU_32v3
 	select HAVE_CONTEXT_TRACKING_USER
 	select HAVE_C_RECORDMCOUNT
 	select HAVE_BUILDTIME_MCOUNT_SORT
Signature · 1 line
2.43.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Ethan Nelson-Moore

The eBPF JIT unconditionally generates ldrh/strh instructions, which do not function correctly on the Risc PC because its bus is unable to signal half-word accesses. Work around this issue by disabling the eBPF JIT when building for ARMv3 (the Risc PC is the only currently supported ARMv3 machine).

Fixes 39c13c204bb1 ("arm: eBPF JIT compiler")

Looks correct to me.

Please put this into Russell's patch tracker!

Yours,
Linus Walleij

#5 lore raw
In reply to Ethan Nelson-Moore
Quoted 5 lines · On Sun, 17 May 2026 18:49:17 -0700 Ethan Nelson-Moore <[email protected]>…

The eBPF JIT unconditionally generates ldrh/strh instructions, which do not function correctly on the Risc PC because its bus is unable to signal half-word accesses. Work around this issue by disabling the eBPF JIT when building for ARMv3 (the Risc PC is the only currently supported ARMv3 machine).

Isn't it more the case that the ldrh/strh instructions were added for armv4. Whether the bus supports 16bit accesses is entirely different.

I'm guessing that WRITE_ONCE() gets implemented as two 8-bit writes and the code 'just hopes' than an ISR won't care and won't do an update.

David

Quoted 21 lines
Fixes 39c13c204bb1 ("arm: eBPF JIT compiler")
---
 arch/arm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/Kconfig +1 -1
index 1155c78bb6aa..8185d013e5d1 100644
@@ -98,7 +98,7 @@ config ARM
 	select HAVE_ARCH_TRACEHOOK
 	select HAVE_ARCH_TRANSPARENT_HUGEPAGE if ARM_LPAE
 	select HAVE_ARM_SMCCC if CPU_V7
-	select HAVE_EBPF_JIT if !CPU_ENDIAN_BE32
+	select HAVE_EBPF_JIT if !CPU_ENDIAN_BE32 && !CPU_32v3
 	select HAVE_CONTEXT_TRACKING_USER
 	select HAVE_C_RECORDMCOUNT
 	select HAVE_BUILDTIME_MCOUNT_SORT
#6 lore raw

Hi, David,

Quoted 2 lines · David Laight

Isn't it more the case that the ldrh/strh instructions were added for armv4. Whether the bus supports 16bit accesses is entirely different.

No, it is in fact the bus. While the Risc PC initially shipped with ARMv3 CPUs, which the kernel no longer supports, it was later upgraded to an ARMv4 StrongARM CPU. However, its bus was designed for ARMv3 CPUs and has no way to represent a half-word access to memory. This means that ldrh/strh will execute (because the CPU supports them) but do not function as intended.

Ethan

#3 lore raw
In reply to Ethan Nelson-Moore
Quoted 9 lines · Ethan Nelson-Moore
Quoted 4 lines · Linus Walleij

Looks correct to me.

Please put this into Russell's patch tracker!

Done!

https://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=9477/1

Should be s/arm\./arm/

Also, you can use:

in the attributions in the commit message to indicate where more patch context can be found.

Lastly, too late for v7.1 as a fix, I already sent the pull request for that, sorry.

Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#4 lore raw

Hi, Russell,

Quoted 3 lines · Russell King (Oracle)
Quoted 1 line

https://www.arm.linux.org.uk/developer/patches/viewpatch.php?id=9477/1

Should be s/arm\./arm/

Got it. Would it make sense to make the domain with the dot 301 redirect to the same URL at the one without the dot? Right now, Google is indexing both, and this would remedy that.

Quoted 6 lines

Also, you can use:

in the attributions in the commit message to indicate where more patch context can be found.

Thanks. I knew that but didn't think of it at the time I submitted.

Quoted 2 lines

Lastly, too late for v7.1 as a fix, I already sent the pull request for that, sorry.

That's okay. It's not a particularly high priority :p

Ethan

#7 lore raw
In reply to Ethan Nelson-Moore
Quoted 7 lines · On Sun, 14 Jun 2026 14:44:38 -0700 Ethan Nelson-Moore <[email protected]>…

Hi, David,

Quoted 2 lines · David Laight

Isn't it more the case that the ldrh/strh instructions were added for armv4. Whether the bus supports 16bit accesses is entirely different.

Quoted 6 lines

No, it is in fact the bus. While the Risc PC initially shipped with ARMv3 CPUs, which the kernel no longer supports, it was later upgraded to an ARMv4 StrongARM CPU. However, its bus was designed for ARMv3 CPUs and has no way to represent a half-word access to memory. This means that ldrh/strh will execute (because the CPU supports them) but do not function as intended.

Ok, so they work fine for cached accesses.
The only issue will be with uncached ones?
(Or do I remember the strongarm having a write-through cache?)

It just seems odd because byte writes are usually handled with four byte-enable lines; so the targets support all 16 combinations even though a cpu will (normally) only be able to generate 8 of them.

David

Quoted 2 lines

Ethan