forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
perf record --call-graph dwarf does not support ld.lld's default --rosegment -z noseparate-code layout #1646
Labels
[BUG] linux
A bug that should be fixed in the mainline kernel.
[FIXED][LINUX] 5.19
This bug was fixed in Linux 5.19
[TOOL] lld
The issue is relevant to LLD linker
Comments
intel-lab-lkp
pushed a commit
to intel-lab-lkp/linux
that referenced
this issue
May 27, 2022
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 => fail ld.lld --no-rosegment => ok ld.lld -z separate-code => ok ld.bfd -z separate-code (default for Linux/x86) => ok ld.bfd -z noseparate-code => ok To fix the issue, compute segbase as dso's base address plus PT_GNU_EH_FRAME's p_vaddr. Reported-by: Sebastian Ullrich <sebasti@nullri.ch> Link: ClangBuiltLinux#1646 Signed-off-by: Fangrui Song <maskray@google.com> Cc: Ian Rogers <irogers@google.com>
nickdesaulniers
added
[BUG] linux
A bug that should be fixed in the mainline kernel.
[PATCH] Submitted
A patch has been submitted for review
[TOOL] lld
The issue is relevant to LLD linker
labels
May 27, 2022
cc @captain5050 |
intel-lab-lkp
pushed a commit
to intel-lab-lkp/linux
that referenced
this issue
May 27, 2022
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: ClangBuiltLinux#1646 Signed-off-by: Fangrui Song <maskray@google.com> Cc: Ian Rogers <irogers@google.com> -- Changes from v1: * Fix elf_base_address to use the first PT_LOAD * Use dso::elf_base_addr which is a constant even if the dso is loaded into multiple processes
Patch accepted: https://git.kernel.org/acme/c/dc2cf4ca866f571590b65f5e4de06b8c9a302808 No idea if the SHA is stable though. |
nathanchance
added
[PATCH] Accepted
A submitted patch has been accepted upstream
and removed
[PATCH] Submitted
A patch has been submitted for review
labels
Jun 3, 2022
A message |
nickdesaulniers
removed
the
[PATCH] Accepted
A submitted patch has been accepted upstream
label
Jun 6, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
[BUG] linux
A bug that should be fixed in the mainline kernel.
[FIXED][LINUX] 5.19
This bug was fixed in Linux 5.19
[TOOL] lld
The issue is relevant to LLD linker
Move llvm/llvm-project#53156 here since it is a perf bug.
@Kha reported that ld.lld linked objects do not symbolize correctly:
Tips: to build perf with debug info:
make O=/tmp/linux/perf ARCH=x86_64 -j60 -C tools/perf DEBUG=1 EXTRA_CFLAGS='-O0 -g'
It is due to perf not supporting ld.lld's default --rosegment -z noseparate-code layout (since 10.0)
The text was updated successfully, but these errors were encountered: