Fix GH-21639: Keep frameless call args stable during reentry#21815
Fix GH-21639: Keep frameless call args stable during reentry#21815prateekbhujel wants to merge 1 commit intophp:masterfrom
Conversation
|
Thanks for the PR.
I'm afraid this will need a more general solution. My hope was to avoid overhead in the VM, but it might be unavoidable for a proper fix, even if this is a largely artificial issue. |
35148db to
15ec47b
Compare
15ec47b to
c818fa7
Compare
c818fa7 to
08cc08f
Compare
08cc08f to
38e2314
Compare
|
The other alternative would be checking inside the tostring handler whether the parent frame is currently at a frameless opcode and then safely copy its CV args to a buffer, set EG(vm_interrupt) and free them on the next EG(vm_interrupt), completely moving the overhead off the main paths and be a truly generic solution. Obviously comes at a small tostring handler cost, but I'd really rather see overhead there...? |
38e2314 to
163b9ef
Compare
163b9ef to
9ae220f
Compare
|
@bwoebi Yeah, agreed. That cost belongs on the I pushed a follow-up in that direction. It checks from I did not keep the cleanup on So the copy/dtor work is on actual |
28d83f6 to
2671fc4
Compare
|
I reworked this on top of master and squashed the branch. The The updated patch keeps the reentry copies for already-parsed string/array CV args, but falls back to a normal internal call frame when a frameless call has a top-level object arg plus CV operands. JIT now avoids direct frameless lowering for the same maybe-object+CV shape, so it goes through the same VM path. Also retargeted this to master. |
Fixes GH-21639.
Frameless internal calls can borrow operands directly from the caller frame. If an argument is converted through
__toString(), userland can mutate those CVs while the frameless handler is still reading them.This keeps the fix on the reentry path instead of copying every frameless call:
__toString()reentry keeps copies of string/array CV args for the active frameless opcode and releases them after the handler returns.Tests run: