You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JIT SEGV on OOM in dtor when creating backtrace #17727
<?phpclass DestructableObject
{
publicfunction__destruct()
{
DestructableObject::__destruct();
}
}
class DestructorCreator
{
publicfunction__destruct()
{
$this->test = newDestructableObject;
}
}
class Test
{
publicstatic$mystatic;
}
Test::$mystatic = newDestructorCreator();
class B implements Serializable
{
publicfunctionserialize()
{
}
publicfunctionunserialize($data)
{
}
}
Resulted in this output:
/home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_builtin_functions.c:1910:9: runtime error: member access within null pointer of type 'const zend_op' (aka 'const struct _zend_op')
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/phpfuzz/WorkSpace/flowfusion/php-src/Zend/zend_builtin_functions.c:1910:9
@arnaud-lb I don't know if you have a patch for this in the queue or looked into this, but it's just that the opline should be set prior to calling the helper. This became visible after the fatal error backtrace RFC, but technically also exists on lower branches.
Patch would be trivial:
@nielsdos this looks right, and it mirrors the SAVE_OPLINE() in ZEND_INIT_STATIC_METHOD_CALL() as well as jit_SET_EX_OPLINE(jit, opline) calls in zend_jit_push_call_frame(). I looked into it briefly and didn't have a patch for this yet, so feel free to submit one :)
Activity
arnaud-lb commentedon Feb 7, 2025
Smaller reproducer:
Backtrace:
We OOM in
zend_vm_stack_push_call_frame(), butEG(current_execute_data)->oplineis0, so we crash when fetching the backtrace.ndossche commentedon Feb 7, 2025
@arnaud-lb I don't know if you have a patch for this in the queue or looked into this, but it's just that the opline should be set prior to calling the helper. This became visible after the fatal error backtrace RFC, but technically also exists on lower branches.
Patch would be trivial:
arnaud-lb commentedon Feb 7, 2025
@nielsdos this looks right, and it mirrors the
SAVE_OPLINE()inZEND_INIT_STATIC_METHOD_CALL()as well asjit_SET_EX_OPLINE(jit, opline)calls inzend_jit_push_call_frame(). I looked into it briefly and didn't have a patch for this yet, so feel free to submit one :)[-]SEGV zend_builtin_functions.c[/-][+]JIT SEGV on OOM in dtor when creating backtrace[/+]Fix phpGH-17727: JIT SEGV on OOM in dtor when creating backtrace
ndossche commentedon Feb 7, 2025
Yeah I took your test, added you to the credit section, and I can credit you in NEWS after a merge.
arnaud-lb commentedon Feb 10, 2025
Thank you, but it's not necessary :)
Fix phpGH-17727: JIT SEGV on OOM in dtor when creating backtrace