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)
Wed, Nov 6, 2:39 AM
Unknown Object (File)
Wed, Nov 6, 2:39 AM
Unknown Object (File)
Oct 2 2024, 10:05 PM
Unknown Object (File)
Sep 28 2024, 1:58 PM
Unknown Object (File)
Sep 24 2024, 11:04 PM
Unknown Object (File)
Sep 22 2024, 6:56 PM
Unknown Object (File)
Sep 22 2024, 4:25 PM
Unknown Object (File)
Sep 20 2024, 3:00 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