gh-142829: Fix use-after-free in Context.__eq__ via re-entrant ContextVar.set#142905
Conversation
sobolevn
left a comment
There was a problem hiding this comment.
This is what we commonly do to solve such issues.
|
Can you add a test which does the same but with |
@kumaraditya303 I think |
@kumaraditya303 Gentle reminder on this. |
|
Thanks @abdoulrasheed for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
|
Thanks @abdoulrasheed for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
|
Sorry, @abdoulrasheed and @kumaraditya303, I could not cleanly backport this to |
…t `ContextVar.set` (pythonGH-142905) (cherry picked from commit a4086d7) Co-authored-by: A.Ibrahim <abdulrasheedibrahim47@gmail.com>
|
GH-143627 is a backport of this pull request to the 3.14 branch. |
|
Looks like backport to 3.13 failed. @kumaraditya303 |
…t `ContextVar.set` (python#142905)
…-entrant `ContextVar.set` (pythonGH-142905) (cherry picked from commit a4086d7) Co-authored-by: A.Ibrahim <abdulrasheedibrahim47@gmail.com>
|
GH-143871 is a backport of this pull request to the 3.13 branch. |
…t `ContextVar.set` (python#142905)
This fix holds strong references to the HAMT objects and their keys/values during comparison in
_PyHamt_Eq, preventing premature deallocation.Context.__eq__via re-entrantContextVar.set#142829