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

Segmentation fault will be reported when JIT is off but JIT_debug is still on #13232

Closed
LoongT4o opened this issue Jan 23, 2024 · 0 comments
Closed

Comments

@LoongT4o
Copy link
Contributor

Description

When I set the JIT related php.ini configuration as

opcache.jit_debug=0xfffff
opcache.jit=off

or

opcache.jit_debug=0xfffff
opcache.jit=disable

execute ./sapi/cli/php -c php.ini test.php, the test.php code:

<?php
function add1($x){
    $x = $x + 1;
    return add2($x);
}

function add2($x){
    $x = $x + 2;
    return add3($x);
}

function add3($x){
    return $x + 3;
}

$x = 0;
for($i = 0; $i < 1000; $i++) {
    $x = add1($x);
}
echo("x=$x\n");
?>

Resulted in this output:

x=6000

Segmentation fault (core dumped)

But I expected this output instead:

x=6000

It was further found that when JIT is closed, this error will only be reported if the 0x200 bit of JIT_debug is turned on, such as

opcache.jit_debug=0x200
opcache.jit=disable

PHP Version

PHP 8.1.4 or later versions

Operating System

Ubuntu22.04

nielsdos added a commit to nielsdos/php-src that referenced this issue Jan 23, 2024
nielsdos added a commit that referenced this issue Jan 24, 2024
* PHP-8.2:
  Fix GH-13232: Segmentation fault will be reported when JIT is off but JIT_debug is still on
nielsdos added a commit that referenced this issue Jan 24, 2024
* PHP-8.3:
  Fix GH-13232: Segmentation fault will be reported when JIT is off but JIT_debug is still on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants