ianlancetaylor / libbacktrace

A C library that may be linked into a C/C++ program to produce symbolic backtraces
Other
977 stars 228 forks source link

No backtrace info for x86_64 binary on AArch64 Windows 11 #82

Closed cme closed 3 months ago

cme commented 2 years ago

I'm trying to get backtrace information for x86_64 executables on Windows, but the only Windows development environment I can really use to test this at the moment is Windows Insider Preview for AArch64 (running on an AArch64 Mac). It's an odd environment so there could be multiple reasons for this.

image

Some initial digging shows that libbacktrace is getting the same symbol addresses visible in objdump, but at run-time the function addresses are at higher memory locations.

Address space layout randomisation? x86 emulation?

cme commented 2 years ago

Some further digging shows that the code at the higher addresses is indeed the same x86 code as the linked binary, at different page addresses, so it certainly looks like ASLR of some sort.

BrettDong commented 2 years ago

I tried adding -Wl,--disable-dynamicbase -Wl,--disable-high-entropy-va linker flags and then backtrace info returns normal: image

So I guess it is ASLR.

HazardyKnusperkeks commented 1 year ago

I've created a patch series at https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608031.html which solves this issue.

ianlancetaylor commented 3 months ago

The patch series was committed, so this should be fixed.