Skip to content

Commit 522f198

Browse files
Hou Taosmb49
authored andcommitted
bpf, arm64: Feed byte-offset into bpf line info
BugLink: https://bugs.launchpad.net/bugs/1969110 [ Upstream commit dda7596 ] 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] Signed-off-by: Sasha Levin <[email protected]> (cherry picked from commit c08f23081c9bddc4a53e14481d3cd273fa16fe88) Signed-off-by: Paolo Pisati <[email protected]>
1 parent 124462b commit 522f198

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
@@ -1126,6 +1126,11 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
11261126
prog->jited_len = prog_size;
11271127

11281128
if (!prog->is_func || extra_pass) {
1129+
int i;
1130+
1131+
/* offset[prog->len] is the size of program */
1132+
for (i = 0; i <= prog->len; i++)
1133+
ctx.offset[i] *= AARCH64_INSN_SIZE;
11291134
bpf_prog_fill_jited_linfo(prog, ctx.offset + 1);
11301135
out_off:
11311136
kfree(ctx.offset);

0 commit comments

Comments
 (0)