lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Yppf0ZOhRWZunQDx@kernel.org>
Date:   Fri, 3 Jun 2022 21:24:01 +0200
From:   Arnaldo Carvalho de Melo <acme@...nel.org>
To:     Ian Rogers <irogers@...gle.com>
Cc:     Fangrui Song <maskray@...gle.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        linux-perf-users@...r.kernel.org, linux-kernel@...r.kernel.org,
        llvm@...ts.linux.dev, Sebastian Ullrich <sebasti@...lri.ch>
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@...gle.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@...lri.ch>
> > Link: https://github.com/ClangBuiltLinux/linux/issues/1646
> > Signed-off-by: Fangrui Song <maskray@...gle.com>
> > Cc: Ian Rogers <irogers@...gle.com>
> 
> Reviewed-by: Ian Rogers <irogers@...gle.com>

Thanks, applied.

- Arnaldo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ