Skip to content

Conversation

@markuspf
Copy link

This could be used to make our fork of abseil-cpp compile with clang21

kvahed pushed a commit that referenced this pull request Jan 22, 2026
In case of two nested back-to-back signals (such as what happens in NestedSignal test) we could end up erroneously using the frame pointer from ucontext_t twice, leading to premature backtrace termination.

In the situation where this happens, the call stack looks like
#0 <unwinder frames>
#1 SigUsr2Handler
#2 __kernel_rt_sigreturn
#3 raise
abseil#4 SigUsr1Handler
abseil#5 __kernel_rt_sigreturn
abseil#6 raise
abseil#7 RaiseSignal
...

When unwinding from #2, we get the fp value from the ucontext (as we should). However, because raise does not modify the fp and because SigUsr1Handler is also a signal handler, when we try to unwind from abseil#4 (#3 is skipped), NextStackFrame ends up looking at the ucontext fp again, and comparing it with the previous (identical) FP value. Non-strict equality accepts this as a valid frame, but the unwinder later bails out due to a zero-sized frame.

Using a strict equality causes NextStackFrame to reject the ucontext fp and use the FP from FP chain instead. This causes us to skip a few more frames, but at least we continue to unwind instead of giving up.

In this case, the computed backtrace skips functions #3, abseil#4 and abseil#6.

PiperOrigin-RevId: 804308754
Change-Id: I5d43e6bea80e4abff1075ada03782ae11c599161
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.

2 participants