Bug #69823 [Asn->Opn]: PHP 7.0.0alpha1 segmentation fault when exactly 33 extensions are loaded

From: Date: Sun, 14 Jun 2015 04:26:45 +0000
Subject: Bug #69823 [Asn->Opn]: PHP 7.0.0alpha1 segmentation fault when exactly 33 extensions are loaded
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-193445@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69823&edit=1 ID: 69823 Updated by: yohgaki@php.net Reported by: andy at webtatic dot com Summary: PHP 7.0.0alpha1 segmentation fault when exactly 33 extensions are loaded -Status: Assigned +Status: Open Type: Bug Package: Reproducible crash Operating System: CentOS 7 PHP Version: 7.0.0alpha1 -Assigned To: laruence +Assigned To: Block user comment: N Private report: N New Comment: functions: OK constants: OK by define() constants: OK by const classes: OK It seems only module registry is affected. By the way, default function hash seems too small. It's way over 1024 functions even with relatively few modules. Previous Comments: ------------------------------------------------------------------------ [2015-06-13 22:09:32] andy at webtatic dot com module_registry is initialized with a size of 32. https://github.com/php/php-src/blob/master/Zend/zend.c#L704 I wonder if this is causing further bugs in all zend hashes with data added +1 above their initialized size. ------------------------------------------------------------------------ [2015-06-13 21:38:41] andy at webtatic dot com "This doesn't appear to be any combination of 33 extensions." I mean, this isn't caused by the extensions themselves whichever ones are loaded, only that the total is 33 ------------------------------------------------------------------------ [2015-06-13 21:36:25] andy at webtatic dot com Description: ------------ When 33 extensions would be loaded (either dynamic or static), PHP 7.0.0alpha1 segmentation faults. This doesn't appear to be any combination of 33 extensions. gdb gives the following error: Program received signal SIGSEGV, Segmentation fault. zend_startup_module_ex (module=0xa) at /home/vagrant/rpmbuild/BUILD/test/Zend/zend_API.c:1818 1818 if (module->module_started) and backtrace: (gdb) backtrace #0 zend_startup_module_ex (module=0xa) at /home/vagrant/rpmbuild/BUILD/test/Zend/zend_API.c:1818 #1 0x00000000005eb499 in zend_hash_apply (ht=ht@entry=0xa7ede0 <module_registry>, apply_func=apply_func@entry=0x5de100 <zend_startup_module_zval>) at /home/vagrant/rpmbuild/BUILD/test/Zend/zend_hash.c:1434 #2 0x00000000005de3aa in zend_startup_modules () at /home/vagrant/rpmbuild/BUILD/test/Zend/zend_API.c:1986 #3 0x000000000057d34e in php_module_startup (sf=<optimized out>, additional_modules=additional_modules@entry=0x0, num_additional_modules=num_additional_modules@entry=0) at /home/vagrant/rpmbuild/BUILD/test/main/main.c:2198 #4 0x0000000000661b9d in php_cli_startup (sapi_module=<optimized out>) at /home/vagrant/rpmbuild/BUILD/test/sapi/cli/php_cli.c:419 #5 0x0000000000428260 in main (argc=1, argv=0xa824f0) at /home/vagrant/rpmbuild/BUILD/test/sapi/cli/php_cli.c:1314 Test script: --------------- ./configure --disable-phpdbg --libdir=/usr/lib64/php --without-readline --with-libedit --cache-file=../config.cache \ --with-libdir=lib64 \ --with-config-file-path=/etc \ --with-config-file-scan-dir=/etc/php.d \ --disable-debug \ --with-pic \ --disable-rpath \ --without-pear \ --with-freetype-dir=/usr \ --with-png-dir=/usr \ --with-xpm-dir=/usr \ --enable-gd-native-ttf \ --without-gdbm \ --with-jpeg-dir=/usr \ --with-openssl \ --with-pcre-regex \ --with-zlib \ --with-layout=GNU \ --with-kerberos \ --with-libxml-dir=/usr \ --with-mhash \ --enable-dtrace \ --with-imap=shared --with-imap-ssl \ --enable-mbstring=shared \ --enable-mbregex \ --with-gd=shared \ --with-gmp=shared \ --enable-calendar=shared \ --enable-bcmath=shared \ --with-bz2=shared \ --enable-ctype=shared \ --enable-dba=shared --with-db4=/usr \ --enable-exif=shared \ --enable-ftp=shared \ --with-gettext=shared \ --with-iconv=shared \ --enable-sockets=shared \ --enable-tokenizer=shared \ --with-xmlrpc=shared \ --with-ldap=shared --with-ldap-sasl \ --enable-mysqlnd=shared \ --with-mysqli=shared,mysqlnd \ --with-interbase=shared,/usr/lib64/firebird \ --with-pdo-firebird=shared,/usr/lib64/firebird \ --enable-dom=shared \ --with-pgsql=shared \ --enable-simplexml=shared \ --enable-xml=shared \ --enable-wddx=shared \ --with-snmp=shared,/usr \ --enable-soap=shared \ --with-xsl=shared,/usr \ --enable-xmlreader=shared --enable-xmlwriter=shared \ --with-curl=shared,/usr \ --enable-pdo=shared \ --with-pdo-odbc=shared,unixODBC,/usr \ --with-pdo-mysql=shared,mysqlnd \ --with-pdo-pgsql=shared,/usr \ --with-pdo-sqlite=shared,/usr \ --with-pdo-dblib=shared,/usr \ --with-sqlite3=shared,/usr \ --enable-json=shared \ --enable-zip=shared \ --with-pspell=shared \ --enable-phar=shared \ --with-mcrypt=shared,/usr \ --with-tidy=shared,/usr \ --enable-sysvmsg=shared --enable-sysvshm=shared --enable-sysvsem=shared \ --enable-shmop=shared \ --enable-posix=shared \ --with-unixODBC=shared,/usr \ --enable-fileinfo=shared \ --enable-intl=shared \ --with-icu-dir=/usr \ --with-enchant=shared,/usr \ --enable-opcache make sudo make install cp php.ini-production /etc/php.ini mkdir /etc/php.d for mod in bz2 calendar ctype curl exif file info get text gap iconv son phar shmop simplexml sockets tokenizer xml zip; do cat > /etc/php.d/${mod} <<EOF extension=${mod}.so EOF done php -m Expected result: ---------------- [PHP Modules] bz2 calendar Core ctype curl date exif fileinfo filter ftp gettext gmp hash iconv json libxml mbstring mhash openssl pcre Phar readline Reflection session shmop SimpleXML sockets SPL standard tokenizer xml zip zlib [Zend Modules] Actual result: -------------- Segmentation fault ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69823&edit=1

« previous php.bugs (#193445) next »