Re: [PATCH] scripts/faddr2line: Fix regression in name resolution on ppc64le

From: Naveen N. Rao
Date: Fri Sep 30 2022 - 07:29:32 EST


Thadeu Lima de Souza Cascardo wrote:
On Tue, Sep 27, 2022 at 01:22:11PM +0530, Srikar Dronamraju wrote:
Commit 1d1a0e7c5100 ("scripts/faddr2line: Fix overlapping text section failures")
can cause scripts/faddr2line to fail on ppc64le machines on few
distributions, while working on other distributions. The failure can be
attributed to difference in readelf output on various distributions.

$ ./scripts/faddr2line vmlinux find_busiest_group+0x00
no match for find_busiest_group+0x00

Expected output was:
$ ./scripts/faddr2line vmlinux find_busiest_group+0x00
find_busiest_group+0x00/0x3d0:
find_busiest_group at kernel/sched/fair.c:9595

On ppc64le, readelf adds localentry tag before the symbol name on few
distributions and adds the localentry tag after the symbol name on few
other distributions. This problem has been discussed in the reference
URL given below. This problem can be overcome by filtering out
localentry tags in readelf output. Similar fixes are already present in
kernel by way of commits:

1fd6cee127e2 ("libbpf: Fix VERSIONED_SYM_COUNT number parsing")
aa915931ac3e ("libbpf: Fix readelf output parsing for Fedora")

Fixes: 1d1a0e7c5100 ("scripts/faddr2line: Fix overlapping text section failures")
Reference: https://lore.kernel.org/bpf/20191211160133.GB4580@calabresa/
Cc: "Naveen N. Rao" <naveen.n.rao@xxxxxxxxxxxxxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Thadeu Lima de Souza Cascardo <cascardo@xxxxxxxxxxxxx>

Reviewed-by: Thadeu Lima de Souza Cascardo <cascardo@xxxxxxxxxxxxx>

The other instances of readelf --wide on faddr2line use --section-headers and
should not required the same mangling.

There's one usage of readelf with --file-header in faddr2line which also doesn't need this. The extra information being printed is from st_other and is very specific to the symbol table.

Acked-by: Naveen N. Rao <naveen.n.rao@xxxxxxxxxxxxxxxxxx>


- Naveen