Skip to content

Commit 84b1c40

Browse files
puranjaymohanAlexei Starovoitov
authored andcommitted
bpf: arm64: Add support for instructions array
Add support for the instructions array map type in the arm64 JIT by calling bpf_prog_update_insn_ptrs() with the offsets that map xlated_offset to the jited_offset in the final image. arm64 JIT already has this offset array which was being used for bpf_prog_fill_jited_linfo() and can be used directly for bpf_prog_update_insn_ptrs. Signed-off-by: Puranjay Mohan <[email protected]> Reviewed-by: Anton Protopopov <[email protected]> Acked-by: Xu Kuohai <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 792f258 commit 84b1c40

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

arch/arm64/net/bpf_jit_comp.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2231,6 +2231,13 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
22312231
for (i = 0; i <= prog->len; i++)
22322232
ctx.offset[i] *= AARCH64_INSN_SIZE;
22332233
bpf_prog_fill_jited_linfo(prog, ctx.offset + 1);
2234+
/*
2235+
* The bpf_prog_update_insn_ptrs function expects offsets to
2236+
* point to the first byte of the jitted instruction (unlike
2237+
* the bpf_prog_fill_jited_linfo above, which, for historical
2238+
* reasons, expects to point to the next instruction)
2239+
*/
2240+
bpf_prog_update_insn_ptrs(prog, ctx.offset, ctx.ro_image);
22342241
out_off:
22352242
if (!ro_header && priv_stack_ptr) {
22362243
free_percpu(priv_stack_ptr);

0 commit comments

Comments
 (0)