Bug 19653 – Memory addresses in stacktraces for x86-64 ELFs are only 4 bytes long and don't fall on instruction boundary

Status
NEW
Severity
trivial
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2019-02-06T11:01:15Z
Last change time
2024-12-13T19:02:19Z
Assigned to
No Owner
Creator
[email protected]
Moved to GitHub: dmd#19536 →

Comments

Comment #0 by johannes.riecken — 2019-02-06T11:01:15Z
I compile the file stacktrace.d: void main(){assert(false);} with ASLR turned off and when running I get: [email protected](2): Assertion failure ---------------- ??:? _d_assertp [0x55586ed8] ??:? _Dmain [0x55586e20] objdump -t stacktrace|grep _Dmain gives 0000000000032e0c w F .text 0000000000000019 _Dmain And if I run gdb -q -nx -ex start -ex 'disas /rs _Dmain' -ex q stacktrace: ... Dump of assembler code for function _Dmain: 0x0000555555586e0c <+0>: 55 push %rbp 0x0000555555586e0d <+1>: 48 8b ec mov %rsp,%rbp => 0x0000555555586e10 <+4>: be 02 00 00 00 mov $0x2,%esi 0x0000555555586e15 <+9>: 48 8d 3d 44 c0 02 00 lea 0x2c044(%rip),%rdi # 0x5555555b2e60 <_TMP0> 0x0000555555586e1c <+16>: e8 47 00 00 00 callq 0x555555586e68 <_d_assertp> 0x0000555555586e21 <+21>: 31 c0 xor %eax,%eax 0x0000555555586e23 <+23>: 5d pop %rbp 0x0000555555586e24 <+24>: c3 retq So even if the first two 0x55 bytes were just truncated off, 0x...86e20 given in the stack trace doesn't match the start of an instruction.
Comment #1 by kinke — 2019-02-06T21:09:56Z
The address truncation would be fixed in https://github.com/dlang/druntime/pull/2151, which doesn't find any reviewer.
Comment #2 by robert.schadek — 2024-12-13T19:02:19Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19536 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB