Bug #74527 [NEW]: Segfault generating phar.php
| From: | coypu at sdf dot org | Date: | Tue, 02 May 2017 03:30:26 +0000 |
| Subject: | Bug #74527 [NEW]: Segfault generating phar.php | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-208892@lists.php.net to get a copy of this message | ||
From: coypu at sdf dot org
Operating system: NetBSD
PHP version: 7.1.4
Package: Compile Failure
Bug Type: Bug
Bug description:Segfault generating phar.php
Description:
------------
Hi,
NetBSD 7.0 i386 builds are consistently segfaulting generating phar.php
Example build log:
http://nyftp.netbsd.org/pub/pkgsrc/packages/reports/2017Q1/NetBSD-7.0-i386/20170430.0103/php-7.1.3nb1/build.log
(Sorry for reporting a bug against 7.1.3, I didn't notice as I was
experimenting, and this is in an extremely slow VM - I don't see
relevant changes in 7.1.4)
We have some local modifications to the package, you can view them
here:
https://github.com/NetBSD/pkgsrc/tree/trunk/lang/php71
(None of them touch deep PHP internals)
A backtrace of such a segfault is:
(gdb) core ./work/php-7.1.3/php.core
[New process 1]
Core was generated by `php'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0857b17b in zval_get_type (pz=0x7ae11780)
at /pkgsrc/lang/php71/work/php-7.1.3/Zend/zend_types.h:332
332 return pz->u1.v.type;
(gdb) bt
#0 0x0857b17b in zval_get_type (pz=0x7ae11780)
at /pkgsrc/lang/php71/work/php-7.1.3/Zend/zend_types.h:332
#1 ZEND_UNSET_DIM_SPEC_CV_CONST_HANDLER ()
at /pkgsrc/lang/php71/work/php-7.1.3/Zend/zend_vm_execute.h:39969
#2 0x084f5b20 in execute_ex (ex=0xbb214020)
at /pkgsrc/lang/php71/work/php-7.1.3/Zend/zend_vm_execute.h:429
#3 0x084f6237 in zend_execute (op_array=0xbb26d080, return_value=0x0)
at /pkgsrc/lang/php71/work/php-7.1.3/Zend/zend_vm_execute.h:474
#4 0x0847b116 in zend_execute_scripts (type=8, retval=0x0,
file_count=3)
at /pkgsrc/lang/php71/work/php-7.1.3/Zend/zend.c:1476
#5 0x083ec7e0 in php_execute_script (primary_file=0xbfbfdce0)
at /pkgsrc/lang/php71/work/php-7.1.3/main/main.c:2537
#6 0x085c034c in do_cli (argc=14, argv=0xbfbfded8)
at /pkgsrc/lang/php71/work/php-7.1.3/sapi/cli/php_cli.c:993
#7 0x085c1228 in main (argc=14, argv=0xbfbfded8)
at /pkgsrc/lang/php71/work/php-7.1.3/sapi/cli/php_cli.c:1381
I personally attempted to build the package in qemu-system-i386, using
GCC 4.8.5.
I've made the following change that made me able to build it:
--- configure.orig 2017-04-11 15:37:37.000000000 +0000
+++ configure
@@ -5737,10 +5737,7 @@ if test "$ZEND_GCC_GLOBAL_REGS" != "no";
#else
# define ZEND_GCC_VERSION 0
#endif
-#if defined(__GNUC__) && ZEND_GCC_VERSION >= 4008 && defined(i386)
-# define ZEND_VM_FP_GLOBAL_REG "%esi"
-# define ZEND_VM_IP_GLOBAL_REG "%edi"
-#elif defined(__GNUC__) && ZEND_GCC_VERSION >= 4008 &&
defined(__x86_64__)
+#if defined(__GNUC__) && ZEND_GCC_VERSION >= 4008 &&
defined(__x86_64__)
# define ZEND_VM_FP_GLOBAL_REG "%r14"
# define ZEND_VM_IP_GLOBAL_REG "%r15"
#elif defined(__GNUC__) && ZEND_GCC_VERSION >= 4008 &&
defined(__powerpc64__)
Disabling the use of a global register for i386 (I think).
I don't have a rationale for it, I just found it unbelievable that such
a thing works, and disabling it did the trick.
This may be a GCC bug if you believe it should work.
--
Edit bug report at https://bugs.php.net/bug.php?id=74527&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74527&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74527&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74527&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=74527&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=74527&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=74527&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=74527&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=74527&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=74527&r=support
Expected behavior: https://bugs.php.net/fix.php?id=74527&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=74527&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=74527&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=74527&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74527&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=74527&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=74527&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=74527&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74527&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=74527&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=74527&r=mysqlcfg