Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion failure in JIT trace exit with ZEND_FETCH_DIM_FUNC_ARG #17140

Open
YuanchengJiang opened this issue Dec 13, 2024 · 2 comments · May be fixed by #17148
Open

Assertion failure in JIT trace exit with ZEND_FETCH_DIM_FUNC_ARG #17140

YuanchengJiang opened this issue Dec 13, 2024 · 2 comments · May be fixed by #17148

Comments

@YuanchengJiang
Copy link

Description

The following code:

<?php
namespace Foo;
function test() {
$a['x'][1] = true;
for ($fusion = 0; $i < 3; $i++) {
var_dump($a['x'][0]);
}
}
test();

Resulted in this output:

php: ext/opcache/jit/zend_jit_trace.c:8657: int zend_jit_trace_exit(uint32_t, zend_jit_registers_buf *): Assertion `op->opcode == ZEND_FETCH_DIM_R || op->opcode == ZEND_FETCH_LIST_R || op->opcode == ZEND_FETCH_OBJ_R' failed.
Aborted (core dumped)

To reproduce:

-d "opcache.jit_hot_func=1" -d "opcache.jit_hot_side_exit=1" -d "zend_extension=/home/phpfuzz/WorkSpace/flowfusion/php-src/modules/opcache.so" -d "opcache.enable_cli=1" -d "opcache.jit=1254"

PHP Version

nightly

Operating System

ubuntu 22.04

@cmb69
Copy link
Member

cmb69 commented Dec 13, 2024

Only happens with opcache.jit_hot_func=1 and opcache.jit_hot_side_exit=1, so clearly is a JIT issue.

@nielsdos
Copy link
Member

ZEND_FETCH_DIM_FUNC_ARG is not handled, but I think in that case we also have to simply repeat that opline, we can't assume the value to be NULL...

@nielsdos nielsdos changed the title Assertion failure ext/opcache/jit/zend_jit_trace.c:8657 Assertion failure in JIT trace exit with ZEND_FETCH_DIM_FUNC_ARG Dec 13, 2024
nielsdos added a commit to nielsdos/php-src that referenced this issue Dec 13, 2024
…DIM_FUNC_ARG)

ZEND_FETCH_DIM_FUNC_ARG should also be repeated on undefined access,
consistent to how ZEND_FETCH_DIM_R is handled. The opcode was just
missing from the assertion list.
nielsdos added a commit to nielsdos/php-src that referenced this issue Dec 13, 2024
…DIM_FUNC_ARG)

ZEND_FETCH_DIM_FUNC_ARG should also be repeated on undefined access,
consistent to how ZEND_FETCH_DIM_R is handled. The opcode was just
missing from the assertion list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants