Skip to content

gh-146102: Fix use-after-free and exception leak in crossinterp subsystem#154278

Closed
ghost wants to merge 1 commit into
mainfrom
unknown repository
Closed

gh-146102: Fix use-after-free and exception leak in crossinterp subsystem#154278
ghost wants to merge 1 commit into
mainfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Jul 20, 2026

Copy link
Copy Markdown

Three bugs in the cross-interpreter data subsystem are fixed by this patch: a use-after-free in _ensure_notshareableerror where control falls through to code that dereferences a ctx pointer after ownership of the referenced object was transferred to the thread state via _PyErr_SetRaisedException, a leaked exception in _PyXI_UnwrapNotShareableError where _PyXI_InitFailure can fail under low-memory conditions leaving the exception removed from the thread error indicator and never restored, and a use-after-free in _get_xidata where obj is passed to _set_xid_lookup_failure for error-string formatting after it has already been released with Py_DECREF, meaning a concurrent deallocation would dereference a freed pointer.

@ghost
ghost requested a review from ericsnowcurrently as a code owner July 20, 2026 17:18
@bedevere-app

bedevere-app Bot commented Jul 20, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@python-cla-bot

python-cla-bot Bot commented Jul 20, 2026

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@bedevere-app

bedevere-app Bot commented Jul 20, 2026

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@ghost
ghost force-pushed the fix-crossinterp-and-ast-bugs branch 3 times, most recently from 6994197 to 500c952 Compare July 20, 2026 17:28
@ghost
ghost force-pushed the fix-crossinterp-and-ast-bugs branch from 500c952 to 63bfa83 Compare July 20, 2026 18:38
Repository owner closed this by deleting the head repository Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant