-
Notifications
You must be signed in to change notification settings - Fork 8k
Open
Labels
Description
Description
Due to destructors and the cycle collector, zval_ptr_dtor()
may have more effects than just freeing the given zval. This is the cause of bugs and workarounds.
These bugs and workarounds could be avoided by delaying destructors and GC runs until a safepoint is reached. If we use vm interrupts as safepoints, this would delay destructors until the next branch/loop or function call (this should be defined more precisely), which seems reasonable.
I'm creating this ticket to aggregate issues that would not exist with delayed destructors and GC runs:
- 3d2b175
- 6f38acf
- https://bugs.php.net/bug.php?id=71020
- https://bugs.php.net/bug.php?id=73423
- heap-buffer-overflow at zval_undefined_cv #10168
- Use after free in SplDoublyLinkedList #16464
- Use after free in SplFixedArray #16478
- Use after free in SplObjectStorage #16479
- UAF when unsetting ArrayObject element #16646
- zend_array_try_init() with dtor can cause engine UAF #17162
- Use-after-free with extract() and EXTR_REFS #18209
- GC Reference Counting Assertion Failure via Object Destruction and Invalid Assignment #19999
#19787 delays GC runs, but not destructors.
iluuu1994 and bwoebi