Skip to content

Commit dda7596

Browse files
Hou Taoborkmann
authored andcommitted
bpf, arm64: Feed byte-offset into bpf line info
insn_to_jit_off passed to bpf_prog_fill_jited_linfo() is calculated in instruction granularity instead of bytes granularity, but BPF line info requires byte offset. bpf_prog_fill_jited_linfo() will be the last user of ctx.offset before it is freed, so convert the offset into byte-offset before calling into bpf_prog_fill_jited_linfo() in order to fix the line info dump on arm64. Fixes: 37ab566 ("bpf: arm64: Enable arm64 jit to provide bpf_line_info") Suggested-by: Daniel Borkmann <[email protected]> Signed-off-by: Hou Tao <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 68e4f23 commit dda7596

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

arch/arm64/net/bpf_jit_comp.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,11 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
11331133
prog->jited_len = prog_size;
11341134

11351135
if (!prog->is_func || extra_pass) {
1136+
int i;
1137+
1138+
/* offset[prog->len] is the size of program */
1139+
for (i = 0; i <= prog->len; i++)
1140+
ctx.offset[i] *= AARCH64_INSN_SIZE;
11361141
bpf_prog_fill_jited_linfo(prog, ctx.offset + 1);
11371142
out_off:
11381143
kfree(ctx.offset);

0 commit comments

Comments
 (0)