Skip to content

Commit de3b7c9

Browse files
Abseil Teamcopybara-github
authored andcommitted
Avoid reentrancy of the same thread in AbslFailureSignalHandler()
PiperOrigin-RevId: 947787991 Change-Id: Ic5f07a6f76e28545d61535c9215462bfd57c355c
1 parent 49ea0f9 commit de3b7c9

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

absl/debugging/failure_signal_handler.cc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -383,10 +383,16 @@ static void AbslFailureSignalHandler(int signo, siginfo_t*, void* ucontext) {
383383
// a bit for it to finish. If the other thread doesn't kill us,
384384
// we do so after sleeping.
385385
PortableSleepForSeconds(3);
386-
RaiseToDefaultHandler(signo);
387-
// The recursively raised signal may be blocked until we return.
388-
return;
386+
} else {
387+
// Same thread re-entered: the handler itself faulted. Do NOT fall through
388+
// and re-run the body (which would recurse under SA_NODEFER, resetting
389+
// the alarm each time and consuming the unguarded altstack). Instead,
390+
// terminate now.
389391
}
392+
393+
RaiseToDefaultHandler(signo);
394+
// The recursively raised signal may be blocked until we return.
395+
return;
390396
}
391397

392398
// Increase the chance that the CPU we report was the same CPU on which the

0 commit comments

Comments
 (0)