bpo-46561: Ensure operands to __get__ survive the call#30979
bpo-46561: Ensure operands to __get__ survive the call#30979tekknolagi wants to merge 3 commits into
Conversation
Callees can assume their parameters survive for the entire call. This violates that assumption and can cause a use-after-free. This is not an issue in CPython right now because later on in the interpreter __get__ fastcall path, the whole vector of arguments get INCREFed. However, if a program provides a different entrypoint for a vectorcall, it may crash.
8729722 to
a47eaac
Compare
|
The changes look good, could you add some test cases? |
|
I am working on making a C-API equivalent for your sample Python test code. Unfortunately, it is not so easy as making a C extension class with |
Summary: Callees can assume their parameters survive for the entire call. This violates that assumption and can cause a use-after-free. Similar to D27254519. See python/cpython#30979. Reviewed By: swtaarrs Differential Revision: D33699901 fbshipit-source-id: 677d97d
|
Lol, did this finally bite someone else? |
|
I am on a mission to review old PRs that were not reviewed by anybody. LGTM, but please fix the NEWS entry (and its text is not very clear, it could be improved). It would be nice to add tests, but if it is too complicated, it is not necessary. |
|
This PR is stale because it has been open for 30 days with no activity. |
|
@tekknolagi, please sign the CLA. This is needed to merge this PR. |
|
Well, it was fixed by GH-118454. |
|
I feel like I've signed the CLA like 3 times. I'll sign it again if needed. But also, I'm not sure if Dino's patch does address it? It looks like a SETREF after the call. |
|
Oh. I had signed the old CLA. I signed the new one. |
|
Thank you. That bug has been fixed in other PR after I approved this PR and before I have opportunity to return to it (and I didn't because you didn't update the entry in the NEWS section). But this will help with your other PRs. |
Before your patch, |
Callees can assume their parameters survive for the entire call. This
violates that assumption and can cause a use-after-free.
https://bugs.python.org/issue46561