Skip to content

Commit 0df226d

Browse files
Hou TaoNobody
Hou Tao
authored and
Nobody
committed
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 its free, so convert the offset into byte-offset before call bpf_prog_fill_jited_linfo(). 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]>
1 parent b2a7f67 commit 0df226d

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)