linux/tools/bpf
Leon Hwang 4d99e509c1 bpf, bpftool: Fix incorrect disasm pc
This patch addresses the bpftool issue "Wrong callq address displayed"[0].

The issue stemmed from an incorrect program counter (PC) value used during
disassembly with LLVM or libbfd.

For LLVM: The PC argument must represent the actual address in the kernel
to compute the correct relative address.

For libbfd: The relative address can be adjusted by adding func_ksym within
the custom info->print_address_func to yield the correct address.

Links:
[0] https://github.com/libbpf/bpftool/issues/109

Changes:
v2 -> v3:
  * Address comment from Quentin:
    * Remove the typedef.

v1 -> v2:
  * Fix the broken libbfd disassembler.

Fixes: e1947c750f ("bpftool: Refactor disassembler for JIT-ed programs")
Signed-off-by: Leon Hwang <leon.hwang@linux.dev>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Tested-by: Quentin Monnet <qmo@kernel.org>
Reviewed-by: Quentin Monnet <qmo@kernel.org>
Acked-by: Yonghong Song <yonghong.song@linux.dev>
Link: https://lore.kernel.org/bpf/20241031152844.68817-1-leon.hwang@linux.dev
2024-11-01 12:31:44 -07:00
..
bpftool bpf, bpftool: Fix incorrect disasm pc 2024-11-01 12:31:44 -07:00
resolve_btfids resolve_btfids: Fix compiler warnings 2024-10-23 14:38:17 -07:00
runqslower tools/bpf: Remove unused variable from runqslower 2024-10-03 17:47:35 -07:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
bpf_asm.c docs: networking: convert filter.txt to ReST 2020-04-28 14:39:46 -07:00
bpf_dbg.c bpf: Simplify the calculation of variables 2021-03-04 19:24:53 -08:00
bpf_exp.l bpf: fix cbpf parser bug for octal numbers 2018-06-03 07:46:55 -07:00
bpf_exp.y tools, bpf_asm: Exit non-zero on errors 2021-02-26 22:53:50 +01:00
bpf_jit_disasm.c tools bpf_jit_disasm: Fix compilation error with new binutils 2022-08-01 15:30:48 -03:00
Makefile tools bpf_jit_disasm: Don't display disassembler-four-args feature test 2022-08-01 15:31:51 -03:00