Skip to content

Commit fab0761

Browse files
rnavmpe
authored andcommitted
powerpc32/bpf: Fix codegen for bpf-to-bpf calls
Pad instructions emitted for BPF_CALL so that the number of instructions generated does not change for different function addresses. This is especially important for calls to other bpf functions, whose address will only be known during extra pass. Fixes: 51c66ad ("powerpc/bpf: Implement extended BPF on PPC32") Cc: [email protected] # v5.13+ Signed-off-by: Naveen N. Rao <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/52d8fe51f7620a6f27f377791564d79d75463576.1641468127.git.naveen.n.rao@linux.vnet.ibm.com
1 parent b992f01 commit fab0761

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

arch/powerpc/net/bpf_jit_comp32.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,9 @@ void bpf_jit_emit_func_call_rel(u32 *image, struct codegen_context *ctx, u64 fun
191191

192192
if (image && rel < 0x2000000 && rel >= -0x2000000) {
193193
PPC_BL_ABS(func);
194+
EMIT(PPC_RAW_NOP());
195+
EMIT(PPC_RAW_NOP());
196+
EMIT(PPC_RAW_NOP());
194197
} else {
195198
/* Load function address into r0 */
196199
EMIT(PPC_RAW_LIS(_R0, IMM_H(func)));

0 commit comments

Comments
 (0)