Messages in this thread | | | Date | Fri, 3 Jun 2022 21:24:01 +0200 | From | Arnaldo Carvalho de Melo <> | Subject | Re: [PATCH v2] perf: Fix segbase for ld.lld linked objects |
| |
Em Fri, May 27, 2022 at 11:51:54AM -0700, Ian Rogers escreveu: > On Fri, May 27, 2022 at 11:20 AM Fangrui Song <maskray@google.com> wrote: > > > > segbase is the address of .eh_frame_hdr and table_data is segbase plus > > the header size. find_proc_info computes segbase as `map->start + > > segbase - map->pgoff` which is wrong when > > > > * .eh_frame_hdr and .text are in different PT_LOAD program headers > > * and their p_vaddr difference does not equal their p_offset difference > > > > Since 10.0, ld.lld's default --rosegment -z noseparate-code layout has > > such R and RX PT_LOAD program headers. > > > > ld.lld (default) => perf report fails to unwind `perf record > > --call-graph dwarf` recorded data > > ld.lld --no-rosegment => ok (trivial, no R PT_LOAD) > > ld.lld -z separate-code => ok but by luck: there are two PT_LOAD but > > their p_vaddr difference equals p_offset difference > > > > ld.bfd -z noseparate-code => ok (trivial, no R PT_LOAD) > > ld.bfd -z separate-code (default for Linux/x86) => ok but by luck: > > there are two PT_LOAD but their p_vaddr difference equals p_offset > > difference > > > > To fix the issue, compute segbase as dso's base address plus > > PT_GNU_EH_FRAME's p_vaddr. The base address is computed by iterating > > over all dso-associated maps and then subtract the first PT_LOAD p_vaddr > > (the minimum guaranteed by generic ABI) from the minimum address. > > > > In libunwind, find_proc_info transitively called by unw_step is cached, > > so the iteration overhead is acceptable. > > > > Reported-by: Sebastian Ullrich <sebasti@nullri.ch> > > Link: https://github.com/ClangBuiltLinux/linux/issues/1646 > > Signed-off-by: Fangrui Song <maskray@google.com> > > Cc: Ian Rogers <irogers@google.com> > > Reviewed-by: Ian Rogers <irogers@google.com>
Thanks, applied.
- Arnaldo
| |