[issue44449] Segfault in _PyTrash_begin when faulthandler tries to dump thread stacks

STINNER Victor report at bugs.python.org
Wed Aug 18 05:45:24 EDT 2021


STINNER Victor <vstinner at python.org> added the comment:

_Py_DumpTracebackThreads() should not use Py_DECREF(). It's a bug. It must only *read* memory, not *modify* memory since it's called from a signal handler. It's a regression in dump_traceback().

Python 3.9 and 3.10 use:

frame = PyThreadState_GetFrame(tstate);
...
Py_DECREF(frame);

The main branch (future 3.11) uses:

frame = tstate->frame;

Without Py_DECREF(): it's a borrowed reference.

It was changed by commit ae0a2b756255629140efcbe57fc2e714f0267aa3.

Python 3.9 and 3.10 should be fixed to use a borrowed reference.

----------
nosy: +vstinner

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44449>
_______________________________________


More information about the Python-bugs-list mailing list