mirror of
https://github.com/python/cpython.git
synced 2025-11-01 14:11:41 +00:00
gh-137185: Fix _Py_DumpStack() async signal safety (gh-137187)
Call backtrace() once when installing the signal handler to ensure that libgcc is dynamically loaded outside the signal handler. This fixes a "signal-unsafe call inside of a signal" TSan error from test_faulthandler.test_enable_fd.
This commit is contained in:
parent
d7e12a362a
commit
11a8652e25
4 changed files with 18 additions and 0 deletions
|
|
@ -1326,3 +1326,13 @@ _Py_DumpStack(int fd)
|
|||
PUTS(fd, " <cannot get C stack on this system>\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
_Py_InitDumpStack(void)
|
||||
{
|
||||
#ifdef CAN_C_BACKTRACE
|
||||
// gh-137185: Call backtrace() once to force libgcc to be loaded early.
|
||||
void *callstack[1];
|
||||
(void)backtrace(callstack, 1);
|
||||
#endif
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue