Bug #80480 [NEW]: Segmentation fault with opcache enabled
| From: | felix dot brucker at pickware dot de | Date: | Thu, 03 Dec 2020 14:33:46 +0000 |
| Subject: | Bug #80480 [NEW]: Segmentation fault with opcache enabled | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-230825@lists.php.net to get a copy of this message | ||
From: felix dot brucker at pickware dot de
Operating system: Mac OS 11.0.1
PHP version: 8.0.0
Package: opcache
Bug Type: Bug
Bug description:Segmentation fault with opcache enabled
Description:
------------
The test script produces a segmentation fault with PHP 8.0.0 and opcache
enabled on Mac OS (tested with 11.0.1). On Ubuntu 20.04 with PHP 8.0.0
and opcache enabled the script does not produce a segmentation fault.
The segmentation fault happens on both CLI and when using php with
apache2.
Initially i used the PHP 8 install via
https://github.com/shivammathur/homebrew-php
and to try to get the
backtrace i built PHP locally via
```
PATH="/usr/local/opt/bison/bin:/usr/local/opt/re2c/bin:$PATH"
./configure --enable-debug
--with-os-sdkpath=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
--enable-bcmath --enable-calendar --enable-dba --enable-dtrace
--enable-exif --enable-ftp --enable-gd --enable-mbregex
--enable-mbstring --enable-mysqlnd --enable-pcntl --enable-phpdbg
--enable-phpdbg-readline --enable-phpdbg-webhelper --enable-shmop
--enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem
--enable-sysvshm
--with-bz2=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr
--with-curl --with-external-gd --with-external-pcre --with-ffi
--with-gettext=/usr/local/opt/gettext --with-gmp=/usr/local/opt/gmp
--with-iconv=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr
--with-layout=GNU --with-libxml --with-libedit
--with-mhash=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr
--with-pic --with-sodium --with-xsl --with-zip --with-zlib
--with-pspell=/usr/local/opt/aspell --sysconfdir=/usr/local/etc/php/8.0
--with-config-file-path=/usr/local/etc/php/8.0
--with-config-file-scan-dir=/usr/local/etc/php/8.0/conf.d
--enable-opcache
PATH="/usr/local/opt/bison/bin:/usr/local/opt/re2c/bin:$PATH" make -j 8
```
The resulting binary reports:
```
./sapi/cli/php -v
PHP 8.0.0-dev (cli) (built: Dec 3 2020 14:40:00) ( NTS DEBUG )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
with Zend OPcache v8.0.0-dev, Copyright (c), by Zend Technologies
./sapi/cli/php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
json
libxml
mbstring
mysqlnd
pcntl
pcre
PDO
pdo_sqlite
Phar
phpdbg_webhelper
posix
pspell
readline
Reflection
session
shmop
SimpleXML
soap
sockets
sodium
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
```
Using gdb to run the php test script results in no error being thrown,
it just hangs:
```
sudo gdb ./sapi/cli/php
Password:
GNU gdb (GDB) 10.1
Copyright (C) 2020 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin20.1.0".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./sapi/cli/php...
(gdb) run test_script.php
Starting program: /Users/felixbrucker/php-src/sapi/cli/php
test_script.php
[New Thread 0x2403 of process 86826]
```
At this point i can only kill the process via
kill.
So far i also tried to reduce the optimizations of opcache to zero like
so: opcache.optimization_level=0, but the segmentation fault persists.
Test script:
---------------
https://gist.github.com/felixbrucker/f8f4623f69b16fc873dbf654db699208
```
php test_script.php
```
Expected result:
----------------
No segmentation fault
Actual result:
--------------
```
./sapi/cli/php test_script.php
[1] 87335 segmentation fault ./sapi/cli/php test_script.php
```
--
Edit bug report at https://bugs.php.net/bug.php?id=80480&edit=1
--
Fix committed: https://bugs.php.net/fix.php?id=80480&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=80480&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=80480&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=80480&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=80480&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=80480&r=support
Expected behavior: https://bugs.php.net/fix.php?id=80480&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=80480&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=80480&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=80480&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=80480&r=phptooold
Daylight Savings: https://bugs.php.net/fix.php?id=80480&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=80480&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=80480&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=80480&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=80480&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=80480&r=mysqlcfg