[php-src] Issue #13232: Segmentation fault will be reported when JIT is off but JIT_debug is still on
| From: | LoongT4o | Date: | Tue, 23 Jan 2024 17:50:27 +0000 |
| Subject: | [php-src] Issue #13232: Segmentation fault will be reported when JIT is off but JIT_debug is still on | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-246326@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/13232
Author: 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
<?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