Skip to contentSkip to conversation

powerpc32/bpf: return false from bpf_jit_supports_fsession() on ppc32

PATCH Applied Karl Mehltretter 3 participants 4 messages Oct 3 – Nov 22

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

PATCH 1/1 powerpc32/bpf: return false from bpf_jit_supports_fsession() on ppc32

bpf_jit_supports_fsession() returns bool. Commit 92258b5bf1ec ("powerpc32/bpf: Add fsession support") made it return -EOPNOTSUPP on ppc32 until fsession is validated there. The negative value converts to true, so the verifier does not reject fsession programs on ppc32. Such a program loads, and only attaching it fails because __arch_prepare_bpf_trampoline() returns -EOPNOTSUPP on ppc32.

Return false instead. The load then fails with "JIT does not support fsession". Tested with a ppc32 kernel on QEMU g3beige.

Fixes 92258b5bf1ec ("powerpc32/bpf: Add fsession support")
Assisted-by LLM
---
 arch/powerpc/net/bpf_jit_comp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/net/bpf_jit_comp.c +1 -1
index 7a612688e7a2..64e70f3226b2 100644
@@ -539,7 +539,7 @@ bool bpf_jit_supports_fsession(void)
 	 * for fsession and trampoline on ppc32.
 	 */
 	if (IS_ENABLED(CONFIG_PPC32))
-		return -EOPNOTSUPP;
+		return false;
 	return true;
 }
 

base-commit: e767a4ea70a3992c37ed604157d32f0dfbf9b1e3

Signature · 1 line
2.53.0
#1 lore raw
Quoted 7 lines · Karl Mehltretter

bpf_jit_supports_fsession() returns bool. Commit 92258b5bf1ec ("powerpc32/bpf: Add fsession support") made it return -EOPNOTSUPP on ppc32 until fsession is validated there. The negative value converts to true, so the verifier does not reject fsession programs on ppc32. Such a program loads, and only attaching it fails because __arch_prepare_bpf_trampoline() returns -EOPNOTSUPP on ppc32.

Quoted 7 lines

Return false instead. The load then fails with "JIT does not support fsession". Tested with a ppc32 kernel on QEMU g3beige.

Fixes 92258b5bf1ec ("powerpc32/bpf: Add fsession support")

A friendly ping on this ppc32 BPF fsession fix. Patchwork on netdevbpf marks it awaiting-upstream for the powerpc tree. Is anything else needed from my side?

Thanks,
Karl

reviewer Reviewed-by on v1 1/1
#2 lore raw
In reply to Karl Mehltretter
Quoted 10 lines · Karl Mehltretter

bpf_jit_supports_fsession() returns bool. Commit 92258b5bf1ec ("powerpc32/bpf: Add fsession support") made it return -EOPNOTSUPP on ppc32 until fsession is validated there. The negative value converts to true, so the verifier does not reject fsession programs on ppc32. Such a program loads, and only attaching it fails because __arch_prepare_bpf_trampoline() returns -EOPNOTSUPP on ppc32.

Return false instead. The load then fails with "JIT does not support fsession". Tested with a ppc32 kernel on QEMU g3beige.

Fair enough.

Quoted 9 lines
Fixes 92258b5bf1ec ("powerpc32/bpf: Add fsession support")
Assisted-by LLM
---
 arch/powerpc/net/bpf_jit_comp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Sorry, I guess, this must have falled through the cracks. Should mostly get queued for next -rc release.

LGTM. Feel free to add:

maintainer Applied
#3 lore raw
In reply to Karl Mehltretter
Quoted 8 lines · Karl Mehltretter

bpf_jit_supports_fsession() returns bool. Commit 92258b5bf1ec ("powerpc32/bpf: Add fsession support") made it return -EOPNOTSUPP on ppc32 until fsession is validated there. The negative value converts to true, so the verifier does not reject fsession programs on ppc32. Such a program loads, and only attaching it fails because __arch_prepare_bpf_trampoline() returns -EOPNOTSUPP on ppc32.

[...]

Applied to powerpc/fixes.

[1/1] powerpc32/bpf: return false from bpf_jit_supports_fsession() on ppc32

      https://git.kernel.org/powerpc/c/ba4564fc66ae796f5070925b803e8f3039423ffb

cheers