Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b62e615a authored by Hou Tao's avatar Hou Tao Committed by Greg Kroah-Hartman
Browse files

bpf, arm64: Feed byte-offset into bpf line info



[ Upstream commit dda7596c109fc382876118627e29db7607cde35d ]

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: 37ab566c ("bpf: arm64: Enable arm64 jit to provide bpf_line_info")
Suggested-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20220226121906.5709-3-houtao1@huawei.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 8f3192a2
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -986,6 +986,11 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog)
	prog->jited_len = image_size;

	if (!prog->is_func || extra_pass) {
		int i;

		/* offset[prog->len] is the size of program */
		for (i = 0; i <= prog->len; i++)
			ctx.offset[i] *= AARCH64_INSN_SIZE;
		bpf_prog_fill_jited_linfo(prog, ctx.offset + 1);
out_off:
		kfree(ctx.offset);