Repository navigation
Conversation
Callback can free an object resulting in UAF if we have relied on the object for visiting the next item in the chain. Fix is to use `finalize_garbage` approach of walking the object gc generation list directly maintaing and moving it into a tempoary list before calling callback
Failure case is crashing the whole test suite, also may not be reliable
|
@nascheme Could you please take a look? |
|
IMHO, this is a bug the debug mode behavior, should likely not be using |
|
@nascheme just to clarify this issue is slightly different in that it's a user callback that exposed the bug rather than being specifically related to the debug_prints. Although you can use the debug_prints to expose a similar gap .PyUnstable_GC_VisitObjects accepts an arbitrary and is helping to protect against "bad" things callers can do in the callbacks. |
I would say we don't support callback doing that. It is quite limited what it is safe for the callback to. E.g. you can't run user level Python code from there and the APIs you are allowed to call is very limited. Basically the callback is meant for CPython to use, not for extensions to use. Oh, I see |
|
@nascheme IIUC we can run user level Python code from |
Callback can free an object resulting in UAF if we have relied on the object for visiting the next item in the chain.
Fix is to use
finalize_garbageapproach of walking the object gc generation list directly maintaing and moving it into a tempoary list before calling callbackvisit_generation()#160663