]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
powerpc64/bpf: fix kfunc call support
authorHari Bathini <hbathini@linux.ibm.com>
Tue, 3 Mar 2026 18:10:30 +0000 (23:40 +0530)
committerMadhavan Srinivasan <maddy@linux.ibm.com>
Sat, 7 Mar 2026 10:32:26 +0000 (16:02 +0530)
commit01b6ac72729610ae732ca2a66e3a642e23f6cd60
tree9c09c4ef65e46f1904da7cbcd650ec43155b4643
parent51b8de4b3d27ec12128fa2405e526c527a77ae65
powerpc64/bpf: fix kfunc call support

Commit 61688a82e047 ("powerpc/bpf: enable kfunc call") inadvertently
enabled kfunc call support for 32-bit powerpc but that support will
not be possible until ABI mismatch between 32-bit powerpc and eBPF is
handled in 32-bit powerpc JIT code. Till then, advertise support only
for 64-bit powerpc. Also, in powerpc ABI, caller needs to extend the
arguments properly based on signedness. The JIT code is responsible
for handling this explicitly for kfunc calls as verifier can't handle
this for each architecture-specific ABI needs. But this was not taken
care of while kfunc call support was enabled for powerpc. Fix it by
handling this with bpf_jit_find_kfunc_model() and using zero_extend()
& sign_extend() helper functions.

Fixes: 61688a82e047 ("powerpc/bpf: enable kfunc call")
Cc: stable@vger.kernel.org
Signed-off-by: Hari Bathini <hbathini@linux.ibm.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20260303181031.390073-7-hbathini@linux.ibm.com
arch/powerpc/net/bpf_jit_comp.c
arch/powerpc/net/bpf_jit_comp64.c