Page MenuHomeFreeBSD

rtld: Add a stop indicator to rtld_start to satisfy unwinders on x86_64
ClosedPublic

Authored by dchagin on Jun 29 2023, 10:03 AM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 15 2024, 5:59 AM
Unknown Object (File)
Mar 15 2024, 5:55 AM
Unknown Object (File)
Mar 15 2024, 5:55 AM
Unknown Object (File)
Mar 15 2024, 5:54 AM
Unknown Object (File)
Mar 15 2024, 5:53 AM
Unknown Object (File)
Mar 8 2024, 12:22 AM
Unknown Object (File)
Jan 3 2024, 10:55 PM
Unknown Object (File)
Dec 22 2023, 2:16 AM
Subscribers

Details

Summary

The right unwinding stop indicator should be CFI-undefined PC.
https://dwarfstd.org/doc/Dwarf3.pdf - page 118:
If a Return Address register is defined in the virtual unwind table,
and its rule is undefined (for example, by DW_CFA_undefined), then
there is no return address and no call address, and the virtual
unwind of stack activations is complete.

That is allows gdb and libunwind successfully stop when unwinding stack
from global constructors and destructors.

There is no need to annotate registers offsets due to rtld_start is the
latest frame in the call chain.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dchagin added a reviewer: kib.

What about adding proper annotations for CFA?

This revision is now accepted and ready to land.Jun 29 2023, 1:39 PM
This revision now requires review to proceed.Jun 29 2023, 6:31 PM
libexec/rtld-elf/amd64/rtld_start.S
43–44

pop changes the offset

This revision is now accepted and ready to land.Jun 30 2023, 12:40 PM