Bug #79917 [NEW]: Segfault with a static variable
| From: | m at renton dot name | Date: | Thu, 30 Jul 2020 12:41:55 +0000 |
| Subject: | Bug #79917 [NEW]: Segfault with a static variable | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-228345@lists.php.net to get a copy of this message | ||
From: m at renton dot name
Operating system: Linux x86_64
PHP version: 7.4.8
Package: opcache
Bug Type: Bug
Bug description:Segfault with a static variable
Description:
------------
While researching joomla update issue, I came across an error that
causes the Apache worker process to crash with a segfault. Digging
deeper, I found that the error only appears with the following opcache
settings,
opcache.file_cache="somefile"
opcache.file_cache_only=1
Segfault happens on:
https://github.com/joomla/joomla-cms/blob/1dceaf228a25100963ee044e7c886244742ca0af/administrator/components/com_joomlaupdate/restore.php#L1110
if I replace s/static $baseextension;/$baseextension;/ the error goes
away. If I remove some functions from restore.php or I add some new code
the error goes away, so that is why that is a problem for me to write
simple test code.
However the error is 100% reproducible as the code is.
xdebug here:
[skip]
0.0142 1995744 -> fwrite(resource(7) of type
(stream), 'Preparing to scan archives\n')
/administrator/components/com_joomlaupdate/restore.php:146
0.0142 1995744 >=> 27
0.0142 1995688 -> fclose(resource(7) of type
(stream)) /administrator/components/com_joomlaupdate/restore.php:147
0.0143 1995256 >=> TRUE
0.0143 1995232 ->
dirname('/tmp/Joomla_3.9.20-Stable-Update_Package.zip')
/administrator/components/com_joomlaupdate/restore.php:1052
0.0143 1995360 >=> '/tmp'
0.0143 1995360 -> AKUnarchiverZIP->getBaseExtension()
/administrator/components/com_joomlaupdate/restore.php:1054
gdb:
Program terminated with signal 11, Segmentation fault.
#0 0x000079e12a3773f5 in
ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER () at
/usr/src/tmp.UWHRMKf3Xq/php-7.4.8.swn/Zend/zend_vm_execute.h:31847
31847 if (EXPECTED(fbc->type == ZEND_USER_FUNCTION) &&
UNEXPECTED(!RUN_TIME_CACHE(&fbc->op_array))) {
(gdb) bt
#0 0x000079e12a3773f5 in
ZEND_INIT_METHOD_CALL_SPEC_UNUSED_CONST_HANDLER () at
/usr/src/tmp.UWHRMKf3Xq/php-7.4.8.swn/Zend/zend_vm_execute.h:31847
#1 0x000079e12a39d1cb in execute_ex (ex=0x79e120218020) at
/usr/src/tmp.UWHRMKf3Xq/php-7.4.8.swn/Zend/zend_vm_execute.h:56526
#2 0x000079e12a39e888 in zend_execute (op_array=0x79e12025e400,
return_value=0x0) at
/usr/src/tmp.UWHRMKf3Xq/php-7.4.8.swn/Zend/zend_vm_execute.h:57920
#3 0x000079e12a2c1a93 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /usr/src/tmp.UWHRMKf3Xq/php-7.4.8.swn/Zend/zend.c:1678
#4 0x000079e12a2207c6 in php_execute_script
(primary_file=0x7e2247747e10) at
/usr/src/tmp.UWHRMKf3Xq/php-7.4.8.swn/main/main.c:2621
#5 0x000079e12a3a15c9 in php_handler (r=0x32d9c90) at
/usr/src/tmp.UWHRMKf3Xq/php-7.4.8.swn/sapi/apache2handler/sapi_apache2.c:700
#6 0x000000000045ef76 in ap_run_handler (r=0x32d9c90) at config.c:170
#7 0x000000000045fa9e in ap_invoke_handler (r=0x32d9c90) at
config.c:444
#8 0x00000000004973ba in ap_process_async_request (r=0x32d9c90) at
http_request.c:508
#9 0x000000000049768c in ap_process_request (r=0x32d9c90) at
http_request.c:586
#10 0x00000000004934b6 in ap_process_http_sync_connection (c=0x32943f0)
at http_core.c:214
#11 0x00000000004935d8 in ap_process_http_connection (c=0x32943f0) at
http_core.c:255
#12 0x000000000046da1d in ap_run_process_connection (c=0x32943f0) at
connection.c:42
#13 0x000000000046e0ec in ap_process_connection (c=0x32943f0,
csd=0x3294200) at connection.c:219
#14 0x00000000004e96c6 in child_main (child_num_arg=0, child_bucket=0)
at prefork.c:615
#15 0x00000000004e9922 in make_child (s=0x2fd9b00, slot=0) at
prefork.c:717
#16 0x00000000004e9983 in startup_children (number_to_start=1) at
prefork.c:735
#17 0x00000000004e9f65 in prefork_run (_pconf=0x2fac978, plog=0x2fe4388,
s=0x2fd9b00) at prefork.c:897
#18 0x000000000043911e in ap_run_mpm (pconf=0x2fac978, plog=0x2fe4388,
s=0x2fd9b00) at mpm_common.c:94
#19 0x000000000042f49f in main (argc=11, argv=0x7e22477488f8) at
main.c:819
--
Edit bug report at https://bugs.php.net/bug.php?id=79917&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=79917&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=79917&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=79917&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=79917&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=79917&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=79917&r=support
Expected behavior: https://bugs.php.net/fix.php?id=79917&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=79917&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=79917&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=79917&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=79917&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=79917&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=79917&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=79917&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=79917&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=79917&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=79917&r=mysqlcfg