Skip to content

Commit 1e4bac7

Browse files
Abhishek Dubeymaddy-kerneldev
authored andcommitted
powerpc/bpf: Add support for instruction array
On loading the BPF program, the verifier might adjust/omit some instructions. The adjusted instruction offset is accounted in the map containing original instruction -> xlated mapping. This patch add ppc64 JIT support to additionally build the xlated->jitted mapping for every instruction present in instruction array. This change is needed to enable support for indirect jumps, added in a subsequent patch. Invoke bpf_prog_update_insn_ptrs() with offset pair of xlated_offset and jited_offset. The offset mapping is already available, which is being used for bpf_prog_fill_jited_linfo() and can be directly used for bpf_prog_update_insn_ptrs() as well. Additional details present at: commit b4ce592 ("bpf, x86: add new map type: instructions array") Signed-off-by: Abhishek Dubey <adubey@linux.ibm.com> Acked-by: Hari Bathini <hbathini@linux.ibm.com> Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com> Link: https://patch.msgid.link/20260401152133.42544-2-adubey@linux.ibm.com
1 parent 92258b5 commit 1e4bac7

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

arch/powerpc/net/bpf_jit_comp.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,13 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *fp)
373373
goto out_addrs;
374374
}
375375
bpf_prog_fill_jited_linfo(fp, addrs);
376+
/*
377+
* On ABI V1, executable code starts after the function
378+
* descriptor, so adjust base accordingly.
379+
*/
380+
bpf_prog_update_insn_ptrs(fp, addrs,
381+
(void *)fimage + FUNCTION_DESCR_SIZE);
382+
376383
out_addrs:
377384
if (!image && priv_stack_ptr) {
378385
fp->aux->priv_stack_ptr = NULL;

0 commit comments

Comments
 (0)