GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||
GeezerVison is showing github.com — gh-150157: fix: critical section for `PyDict_Next` in `_pickle.c` by KowalskiThomas · Pull Request #150158 · python/cpython Conversation
| |||||||||||||||||
| @@ -0,0 +1,2 @@ | |||
| Fix a heap use-after-free in :mod:`pickle`\'s ``whichmodule`` on | |||
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
whichmodule is an internal detail not visible to users. Describe the cause in general words, like it looks from user's point.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
How does the following sound? (I pushed it for now.)
Fix a potential crash occurring when pickling objects
concurrently in free-threaded builds.
Tried to make it clear from and end-user perspective while not sounding too scary (since it's a rare race condition), hence the potential.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It's not just a matter of luck. There have to be several conditions for this to happen. First, we must pickle by name an object without the __module__ attribute. Second, sys.modules should be concurrently modified (in a specific way, but we will leave this).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Okay, I feared this might be a little bit too detail-y. I'll rephrase it again 😅
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Updated to this.
Fix a crash in free-threaded builds that occurs when pickling
an object without a ``__module__`` attribute while :data:`sys.modules`
is concurrently being modified.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
eb71e46 to
88e8cb8
Compare
88e8cb8 to
3981cfc
Compare
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Technically, this is not correct, most objects do not have such issue even without having __module__, only objects pickled by name (some singletons, named constants or enum-like objects). But if you think that the current wording is enough, we can leave it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@serhiy-storchaka Right... Thanks for bearing with me; I've updated it again and I think it should be clear and accurate now 😅 Latest version is: |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@serhiy-storchaka: I will leave it to you to do the final review :-)
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
LGTM. 👍
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Thanks @KowalskiThomas for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @KowalskiThomas for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thanks @KowalskiThomas for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-150710 is a backport of this pull request to the 3.14 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Sorry, @KowalskiThomas and @serhiy-storchaka, I could not cleanly backport this to |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
GH-150711 is a backport of this pull request to the 3.15 branch. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…GH-150158) (GH-150710) (cherry picked from commit c5516e7) Co-authored-by: Thomas Kowalski <[email protected]>
…GH-150158) (#150711) (cherry picked from commit c5516e7) Co-authored-by: Thomas Kowalski <[email protected]>
|
@KowalskiThomas are you able to do the backport to 3.13 (see bot comment above)? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I meant to do it but then it slipped my mind. I'll take care of it today, thanks for reminding me! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Created #150951 where I believe I correctly handled the conflict (pretty much had to re-make the change from scratch but I believe it's good). |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Missing critical section forPyDict_Next in _pickle.c
There was an error while loading. Please reload this page.