mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix GH-16829: Segmentation fault with opcache.jit=tracing enabled on aarch64
This commit is contained in:
commit
e55bf9a2ea
4 changed files with 62 additions and 1 deletions
|
@ -958,7 +958,15 @@ zend_jit_trace_stop ZEND_FASTCALL zend_jit_trace_execute(zend_execute_data *ex,
|
|||
(zend_jit_op_array_trace_extension*)ZEND_FUNC_INFO(op_array);
|
||||
if (UNEXPECTED(!jit_extension)
|
||||
|| UNEXPECTED(!(jit_extension->func_info.flags & ZEND_FUNC_JIT_ON_HOT_TRACE))) {
|
||||
stop = ZEND_JIT_TRACE_STOP_INTERPRETER;
|
||||
#ifdef HAVE_GCC_GLOBAL_REGS
|
||||
if (execute_data->prev_execute_data != prev_execute_data) {
|
||||
#else
|
||||
if (rc < 0) {
|
||||
#endif
|
||||
stop = ZEND_JIT_TRACE_STOP_RETURN;
|
||||
} else {
|
||||
stop = ZEND_JIT_TRACE_STOP_INTERPRETER;
|
||||
}
|
||||
break;
|
||||
}
|
||||
offset = jit_extension->offset;
|
||||
|
|
14
ext/opcache/tests/jit/gh16829.phpt
Normal file
14
ext/opcache/tests/jit/gh16829.phpt
Normal file
|
@ -0,0 +1,14 @@
|
|||
--TEST--
|
||||
GH-16829 (Segmentation fault with opcache.jit=tracing enabled on aarch64)
|
||||
--INI--
|
||||
opcache.jit_buffer_size=32M
|
||||
--EXTENSIONS--
|
||||
opcache
|
||||
--FILE--
|
||||
<?php
|
||||
touch('gh16829_1.inc');
|
||||
require_once('gh16829_1.inc');
|
||||
?>
|
||||
DONE
|
||||
--EXPECT--
|
||||
DONE
|
16
ext/opcache/tests/jit/gh16829_1.inc
Normal file
16
ext/opcache/tests/jit/gh16829_1.inc
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
# inline Reproducer class definition and segfaults will go away
|
||||
require_once('Reproducer.php');
|
||||
|
||||
# remove $someVar1\2 or $someVar3 and loop at the end of the file and segfaults will go away
|
||||
$someVar2 = null;
|
||||
$someVar1 = null;
|
||||
$someVar3 = [];
|
||||
|
||||
for ($i = 0; $i < 10; $i++) {
|
||||
Reproducer::loops();
|
||||
}
|
||||
|
||||
foreach ($someVar3 as $_) {
|
||||
}
|
||||
?>
|
23
ext/opcache/tests/jit/gh16829_2.inc
Normal file
23
ext/opcache/tests/jit/gh16829_2.inc
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
class Reproducer
|
||||
{
|
||||
/**
|
||||
* Remove $params arg and segfaults will go away
|
||||
*/
|
||||
public static function loops(array $params = []): int
|
||||
{
|
||||
$arrCount = 2000;
|
||||
# Replace `$arrCount % 16` with 0 and segfaults will go away
|
||||
$arrCount2 = $arrCount - $arrCount % 16;
|
||||
$result = 0;
|
||||
|
||||
for ($baseIdx = 0; $baseIdx < $arrCount2; $baseIdx++) {
|
||||
}
|
||||
|
||||
while ($baseIdx < $arrCount) {
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue