Skip to content

native tracer: fix unwinding eh_frame entries ending in a call instuction#1382

Merged
fabled merged 1 commit into
open-telemetry:mainfrom
fabled:tt-return-address-lookup
May 4, 2026
Merged

native tracer: fix unwinding eh_frame entries ending in a call instuction#1382
fabled merged 1 commit into
open-telemetry:mainfrom
fabled:tt-return-address-lookup

Conversation

@fabled
Copy link
Copy Markdown
Contributor

@fabled fabled commented May 1, 2026

It seems compilers can fairly often generate .eh_frame entries ending in a 'call' instruction. The unwinder would match the immediate next eh_frame in this case as it was not taking into account unwinding state. Since we now have 'return_address' state available, use that to adjust the lookup address to be able to match the CALL instruction at the end of FDE.

The problem this introduces is unwinding signal frame handlers. Those are injected to the stack, and the FDE typically does not cover the preceding byte (which is not a CALL instruction or even part of the FDE). To keep things working, adjust the signal frame command address by -1 so that unwindier will find the signal handler FDE.

@fabled fabled force-pushed the tt-return-address-lookup branch 2 times, most recently from 23ac131 to 597c437 Compare May 1, 2026 11:22
…ction

It seems compilers can fairly often generate .eh_frame entries ending in
a 'call' instruction. The unwinder would match the immediate next eh_frame
in this case as it was not taking into account unwinding state. Since we
now have 'return_address' state available, use that to adjust the lookup
address to be able to match the CALL instruction at the end of FDE.

The problem this introduces is unwinding signal frame handlers. Those are
injected to the stack, and the FDE typically does not cover the preceding
byte (which is not a CALL instruction or even part of the FDE). To keep
things working, adjust the signal frame command address by -1 so that
unwindier will find the signal handler FDE.
@fabled fabled force-pushed the tt-return-address-lookup branch from 597c437 to 85e79be Compare May 1, 2026 11:25
@fabled fabled marked this pull request as ready for review May 1, 2026 11:30
@fabled fabled requested review from a team as code owners May 1, 2026 11:30
@fabled fabled merged commit 15060a8 into open-telemetry:main May 4, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants