Skip to content

Commit 7db1c33

Browse files
github-actions[bot]Mike McLaughlin
and
Mike McLaughlin
authored
Fix multiple dumps from being generated (#80708)
Issue: #78956 After a core dump is generated because of a unhandled managed exception abort() is called but a SIGSEGV is generated in libpthread.so which is caught by the runtime and a second core dump is generated. The fix is to uninstall/uninitialize all the signal handlers, not just SIGABORT. Co-authored-by: Mike McLaughlin <[email protected]>
1 parent c8a73af commit 7db1c33

File tree

3 files changed

+3
-28
lines changed

3 files changed

+3
-28
lines changed

src/coreclr/pal/src/exception/signal.cpp

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -294,22 +294,6 @@ void SEHCleanupSignals()
294294
}
295295
}
296296

297-
/*++
298-
Function :
299-
SEHCleanupAbort()
300-
301-
Restore default SIGABORT signal handlers
302-
303-
(no parameters, no return value)
304-
--*/
305-
void SEHCleanupAbort()
306-
{
307-
if (g_registered_signal_handlers)
308-
{
309-
restore_signal(SIGABRT, &g_previous_sigabrt);
310-
}
311-
}
312-
313297
/* internal function definitions **********************************************/
314298

315299
/*++

src/coreclr/pal/src/include/pal/signal.hpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,14 +117,4 @@ Function :
117117
--*/
118118
void SEHCleanupSignals();
119119

120-
/*++
121-
Function :
122-
SEHCleanupAbort()
123-
124-
Restore default SIGABORT signal handlers
125-
126-
(no parameters, no return value)
127-
--*/
128-
void SEHCleanupAbort();
129-
130120
#endif /* _PAL_SIGNAL_HPP_ */

src/coreclr/pal/src/thread/process.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2677,8 +2677,9 @@ PROCAbort(int signal)
26772677

26782678
PROCCreateCrashDumpIfEnabled(signal);
26792679

2680-
// Restore the SIGABORT handler to prevent recursion
2681-
SEHCleanupAbort();
2680+
// Restore all signals; the SIGABORT handler to prevent recursion and
2681+
// the others to prevent multiple core dumps from being generated.
2682+
SEHCleanupSignals();
26822683

26832684
// Abort the process after waiting for the core dump to complete
26842685
abort();

0 commit comments

Comments
 (0)