Bug #74526 [Opn->Dup]: Segfault generating phar.php
| From: | danack@php.net | Date: | Tue, 02 May 2017 10:11:45 +0000 |
| Subject: | Bug #74526 [Opn->Dup]: Segfault generating phar.php | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-208896@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74526&edit=1
ID: 74526
Updated by: danack@php.net
Reported by: coypu at sdf dot org
Summary: Segfault generating phar.php
-Status: Open
+Status: Duplicate
Type: Bug
Package: Compile Failure
Operating System: NetBSD
PHP Version: 7.1.4
Block user comment: N
Private report: N
New Comment:
Closing as a duplicate of https://bugs.php.net/bug.php?id=74527
Previous Comments:
------------------------------------------------------------------------
[2017-05-02 03:30:11] coypu at sdf dot org
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 this bug report at https://bugs.php.net/bug.php?id=74526&edit=1