[php-src] PR #20948: Fix segfault in Tracing JIT with object reference
| From: | khasinski | Date: | Fri, 16 Jan 2026 02:40:05 +0000 |
| Subject: | [php-src] PR #20948: Fix segfault in Tracing JIT with object reference | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-34575@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/20948
Author: khasinski
## Summary
- Fixes #20818 - Segfault in Tracing JIT with object reference
The bug occurs when
FE_RESET_RW creates a reference from an object, but the reference
information is not properly propagated to side traces.
When a trace compiles FE_RESET_RW, the result variable becomes a reference
(MAY_BE_REF flag is set in SSA). However, when storing the type to the stack, only the
concrete type (e.g., IS_OBJECT) was stored without the IS_TRACE_REFERENCE
flag. When a side trace starts and reads from the parent trace's stack, it would see
IS_OBJECT without the reference info, causing the JIT to generate code that treats the
value as a direct object rather than a reference to an object. This leads to a segfault when
zend_objects_store_del is called with a zend_reference pointer instead of
a zend_object pointer.
## The fix
1. When storing a concrete type to the stack, if the SSA type has MAY_BE_REF set, add
IS_TRACE_REFERENCE flag to the stack type.
2. When reading from parent trace's stack to initialize TSSA variables, if
IS_TRACE_REFERENCE is set, preserve MAY_BE_REF in the type info.
## Test plan
- [x] Reproducer from #20818 no longer crashes
- [ ] Run full test suite