Repository navigation
Conversation
In both uncollectable and collectables we would iterate through gc items using `GC_NEXT(gc)`. However in the case the current item was cleaned during iteration this would reuslt in UAF when fetching the next step in the loop. The fix is to move each item to a temporary `seen` list before printing it, and always take the next item from the head of the original list, so the loop never reads from a freed item. This takes a similar approach to `finalize_garbage()`.
|
Wonder if we just call |
sergey-miryanov
left a comment
There was a problem hiding this comment.
Same notes about tests and list traversal.
|
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
This comment was marked as resolved.
This comment was marked as resolved.
|
@johng Could you please fix a cast warning in debug_cycles? |
|
@nascheme Could you please take a look? |
|
As mentioned on the other issue, my inclination would be to have a way to output debug info without the GIL drop. Likely we can't be using OTOH, if we look what's done for resource warnings, they do get written to Another possible solution: write the debugging output to a buffer while GC is in the middle of its work. Then, write that buffer to |
|
Happy to explore those suggestions, thanks @nascheme ! |
|
I think the buffer is the cleanest approach, it does result in iterating twice through the loop since we need to know the length ahead of time for buffer allocations unless we have something quite a bit more complex (I believe) |
In both uncollectable and collectables we would
iterate through gc items using
GC_NEXT(gc).However in the case the current item was cleaned
during iteration this would reuslt in UAF when
fetching the next step in the loop.
The fix is to move each item to a temporary
seenlistbefore printing it, and always take the next
item from the head of the original list, so the
loop never reads from a freed item. This takes
a similar approach to
finalize_garbage().