Skip to content

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

Closed
@LoongT4o

Description

@LoongT4o

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions