You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Tachyon frame cache can write into freed thread-state memory #160267
Tachyon reads PyInterpreterState and PyThreadState objects asynchronously. Its frame cache also writes last_profiled_frame and last_profiled_frame_seq into the target thread state.
A thread can exit after Tachyon reads its thread-state address and before the cache write. free_threadstate() then returns the block to the raw allocator. The allocator can reuse that address for unrelated data, and Tachyon can overwrite the new allocation. The reads have the same lifetime problem.
This reproducer just churns short-lived threads with deep stacks:
On main at 39d7c0ff0d (GIL build) the target segfaulted in 6 of 11 runs. The crashes land in different places in the eval loop (_PyEval_EvalFrameDefault, PyObject_Size) on bad object pointers, which looks like heap corruption. Without the profiler the same program always finishes.
The profiler must not access a state after CPython can free or repurpose its storage.
Activity
pythongh-160267: Follow interpreter list changes in the sampling prof…
pythongh-160267: Keep thread and interpreter state memory alive for r…
fixup! pythongh-160267: Keep thread and interpreter state memory aliv…
gh-160267: Keep thread and interpreter state memory alive for remote …
[3.15] gh-160267: Keep thread and interpreter state memory alive for …