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
CPython 3.15: consolidated memory-safety and concurrency bugs #157198
This issue consolidates 13 reproducible CPython 3.15 bugs involving memory safety and concurrency.
The bugs resulted from Python security research using static analysis. Each entry has a concrete PoC in the linked version-specific Gist. Although the collection is large, these bugs warrant inspection, especially the cases producing interpreter crashes, sanitizer failures, memory corruption, or similarly concrete failures.
Bugs
AST initialization _field_types race — Concurrent descriptor replacement can reclaim a borrowed value and cause an impossible initialization decision.
The cross-version review identifies the following 78 bugs as shared across CPython 3.13, 3.14, and 3.15. Each item links to its detailed report and concrete PoC in the consolidated CPython 3.14 Gist.
structseq-type-metadata-borrow-race — Struct-sequence operations consume concurrently replaced type metadata through a borrowed dictionary value.
ElementTree is not currently not safe in FT so all issues are invalid as of now. Thdre is alsona separate issue about making etree FT-safe. So please in the future avoid dumping issues in a bulk if there is alredy an open one (or comment on that one directly)
Activity
Nievesjyl commentedon Sep 8, 2026
This issue is associated with #157197 and #157196
Nievesjyl commentedon Sep 8, 2026
The cross-version review identifies the following 78 bugs as shared across CPython 3.13, 3.14, and 3.15. Each item links to its detailed report and concrete PoC in the consolidated CPython 3.14 Gist.
structseq-type-metadata-borrow-race— Struct-sequence operations consume concurrently replaced type metadata through a borrowed dictionary value.frame-locals-proxy-items-race—FrameLocalsProxy.items()traverses a concurrently mutated extra-locals dictionary.type-subclasses-bases-race—type.__subclasses__()traverses a subclass registry concurrently modified by__bases__assignment.assemble-metadata-dict-race— Code assembly traverses caller-owned metadata dictionaries without a coherent snapshot.contextvars-hamt-shared-iterator-next— Concurrent advancement corrupts a sharedcontextvars.Contextiterator.elementtree-child-read-mutation—_elementtreechild readers race structural mutation.elementtree-get-dict-value-borrow-promotion—Element.get()promotes a concurrently removed attribute-dictionary value.itertools-tee-data-shared-values—_tee_dataobjectcopies an unlocked shared list.pickle-shared-unpickler-running-guard— Concurrent load calls bypass the Unpickler running guard.pickle-unpickler-memo-proxy-race— Concurrent Unpickler memo-proxy operations race.pyexpat-handler-slot-race—pyexpat.xmlparserhandler slots are unsynchronized.pyexpat-shared-parser-native-state-race— Sharedpyexpatparser native state races.pyfunction-getannotations-race—PyFunction_GetAnnotations()has an unlocked annotation-state race.pysys-getobject-borrowed-return—PySys_GetObject()can return a borrowed object concurrently removed fromsys.__dict__.ssl-weak-socket-borrow— The SSL weak-socket helper returns a referent after dropping its temporary owner.unicode-fromid-array-growth-race—_PyUnicode_FromId()identifier-array growth races readers.bytearray-init-unlocked-storage—bytearray.__init__()races storage replacement.ctypes-shared-anonymous-list— ctypes consumes a concurrently mutated_anonymous_list.ctypes-shared-fields-list— ctypes consumes a concurrently mutated_fields_list.dict-merge-seq2-borrow-promotion— Dictionary merge consumes borrowed sequence entries during mutation.elementtree-append-clear— Element append races clear on the child array.elementtree-child-write-mutation— Element child writers race structural mutation.elementtree-setevents-shared-input-list—XMLParser._setevents()consumes a concurrently mutated list.elementtree-shared-input-list— Element mutation consumes a concurrently mutated input list.instruction-sequence-cfg-race— CFG conversion traverses concurrently reallocatedInstructionSequencestorage.instruction-sequence-concurrent-mutation—InstructionSequenceoperations race internal storage mutation.pickle-bytearray-unpinned-storage— Pickle reads bytearray storage while it is resized.pickle-fix-imports-unpinned-mapping— Picklefix_importsborrows mutable mapping entries.pickle-load-extension-unpinned-registry— Pickle extension loading borrows mutable registry entries.pickle-memo-setter-shared-dict-iteration— A pickle memo setter iterates a concurrently mutated dictionary.pickle-dispatch-table-unpinned-reducer— Pickle promotes a reducer borrowed from the mutablecopyregdispatch table.pickle-extension-cache-borrow-promotion— Pickle promotes an object borrowed from the mutable extension cache.pickle-load-build-shared-state-iteration— Pickle BUILD iterates a concurrently mutated shared state dictionary.pickle-find-class-unpinned-mapping— Picklefind_classborrows mutable compatibility-mapping entries.posix-spawn-file-actions-list-race—posix_spawnconsumes a concurrently mutated file-actions list.prep-reraise-star-shared-list— Exception-group reraising consumes a concurrently mutated list.pyimport-getimporter-path-hooks-race—PyImport_GetImporter()borrows mutable path-hook entries.rawiobase-readinto-buffer-resize— ARawIOBase.read()buffer is resized during areadinto()callback.select-shared-fd-list—select()consumes a concurrently mutated descriptor list.source-bytearray-unpinned-storage— Source conversion reads bytearray storage while it is resized.sqlite-shared-connection-cursor-registry— SQLite cursor-registry cleanup races concurrent cursor creation.sqlite-shared-parameter-list— SQLite binds a concurrently mutated parameter list.sre-compile-shared-code-list— SRE compilation consumes a concurrently mutated code list.sre-template-shared-list— SRE template construction consumes a concurrently mutated list.structseq-list-borrow-promotion— Struct-sequence construction borrows concurrently replaced list entries.suggestions-shared-candidates-list— Suggestion generation consumes a concurrently mutated candidate list.syslog-argv0-borrow-promotion— Syslog borrowssys.argv[0]during concurrent replacement.termios-tcsetattr-shared-attributes—tcsetattr()consumes a concurrently mutated attributes list.tkinter-flatten-shared-list— Tkinter flattening consumes a concurrently mutated list.traceback-syspath-item-borrow— Traceback source lookup borrows mutablesys.pathentries.json-dict-borrow-promotion— JSON exact-dictionary traversal promotes concurrently removed entries.json-mapping-items-borrow-promotion— JSON custom-mapping traversal promotes entries from a concurrently mutated items list.json-sequence-borrow-promotion— JSON sequence traversal promotes concurrently removed list entries.memoryview-tobytes-release—memoryview.tobytes()copies released and resized exporter storage.unicode-encoder-shared-bytearray— Unicode encoding copies storage from a concurrently resized bytearray.crossinterp-shared-namespace-dict— Cross-interpreter namespace conversion traverses and borrows from a concurrently mutated dictionary.decimal-signal-dict-borrow-promotion— Decimal signal conversion consumes a value borrowed from a concurrently mutated dictionary.module-dir-borrow-promotion—module.__dir__()calls a value borrowed from a concurrently mutated module dictionary.gc-callback-borrow-promotion— GC callback iteration promotes a callable borrowed from the mutablegc.callbackslist.pyobject-call-shared-kwargs—PyObject_Call()traverses a concurrently mutated caller-supplied kwargs dictionary.marshal-dumps-shared-containers—marshal.dumps()traverses a concurrently mutated caller-supplied dictionary.float-bytearray-unpinned-storage— Float conversion parses bytearray storage concurrently resized between complete generations.pyarg-et-bytearray-resize—PyArgencoded-string conversion copies a bytearray concurrently resized between complete generations.pyexpat-parsefile-bytearray-resize—ParseFile()consumes a returned bytearray while another thread replaces its contents.pynumber-long-bytearray-storage— Integer conversion parses bytearray storage concurrently resized between complete digit generations.struct-pack-bytearray-unpinned-storage—struct.pack()copies bytearray storage concurrently resized between complete generations.array-fromlist-borrow-promotion—array.fromlist()consumes entries from a concurrently slice-replaced exact list.decimal-format-override-borrow-promotion— Decimal formatting consumes override strings borrowed from a concurrently mutated dictionary.ssl-password-bytearray-resize— SSL certificate password setup copies concurrently resized bytearray storage without a buffer lease.marshal-load-retained-readinto-view—marshal.load()exposes a memoryview of its reallocatable internal read buffer to callerreadinto()code.multibyte-streamreader-shared-read— Concurrent reads corrupt a shared multibyte stream reader's pending input and decoder state.codec-cache-item-borrow-promotion— Codec lookup returns an item borrowed from a cache tuple after dropping its sole local tuple owner.elementtree-entity-unpinned-value— ElementTree entity expansion uses a dictionary value borrowed across a callback while a peer replaces it.memoryview-hex-noncontiguous-release—memoryview.hex()copies non-contiguous backing storage after another thread releases the view.memoryview-hash-release— Memoryview hashing drops its temporary export before hashing the captured backing address.memoryview-cast-shape-borrow—memoryview.cast()consumes an element borrowed from a concurrently mutated shape list.flowgraph-consts-list-race— Flowgraph optimization borrows constants from a concurrently mutated caller list.pickle-donor-memo-copy-race— Assigning an Unpickler memo proxy copies slots from a concurrently cleared and reloaded donor memo.picnixz commentedon Sep 9, 2026
ElementTree is not currently not safe in FT so all issues are invalid as of now. Thdre is alsona separate issue about making etree FT-safe. So please in the future avoid dumping issues in a bulk if there is alredy an open one (or comment on that one directly)
picnixz commentedon Sep 9, 2026
There are also exisring issues for array.* i believe so clean up your list first please.
Nievesjyl commentedon Sep 9, 2026
Thanks for the response. We’ll do the cleanup ASAP.
Nievesjyl commentedon Sep 11, 2026
We are preparing a carefully screened report that complies with CPython policy, so we are closing this issue.