|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71438 Segmentation fault encountered when building PHP 7 in QEMU MIPS chroot jail
Submitted: 2016-01-23 23:32 UTC Modified: 2021-01-17 04:22 UTC
From: Assigned: cmb (profile)
Status: No Feedback Package: Compile Failure
PHP Version: 7.0.2 OS: Debian Wheezy
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2016-01-23 23:32 UTC]
I am encountering a segmentation fault when attempting to build PHP 7.0.2 in a chroot jail that is using QEMU to emulate a MIPS architecture.

Using the same script with identical settings and configuration, I am able to build PHP 5.4.45, 5.5.31, and 5.6.17 without any segmentation faults.

The segmentation fault occurs toward the end of the `make` command, immediately after the "Generating phar.php" line (see "Actual result" below for error output).


For those wondering why I am building PHP in an emulated MIPS environment: I am creating Docker images on which Travis CI runs tests for my ramsey/uuid library. I want to ensure consistent generation of UUIDs on 64-bit, 32-bit, little-endian, and big-endian systems. If interested, see the following:


Test script:
Here is a Gist that will allow you to reproduce this issue within a Vagrant VM:

See the comments at the top of the script, but in short, once you're ready to run the script in the VM, you can run it like this to build different chroot jails with different PHP versions:

sudo ./ 7.0.2 mips mips wheezy
sudo ./ 5.6.17 mips mips wheezy
sudo ./ 5.5.31 mips mips wheezy

The 7.0.2 version is the one where I am encountering the segmentation fault.

Actual result:
Generating phar.php
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
/bin/bash: line 1: 23824 Segmentation fault      (core dumped) ` if test -x "/php-src/php-7.0.2/sapi/cli/php"; then /php-src/php-7.0.2/build/shtool echo -n -- "/php-src/php-7.0.2/sapi/cli/php -n"; if test "x" != "x"; then /php-src/php-7.0.2/build/shtool echo -n -- " -d extension_dir=/php-src/php-7.0.2/modules"; for i in bz2 zlib phar; do if test -f "/php-src/php-7.0.2/modules/$"; then . /php-src/php-7.0.2/modules/$; /php-src/php-7.0.2/build/shtool echo -n -- " -d extension=$dlname"; fi; done; fi; else /php-src/php-7.0.2/build/shtool echo -n -- "/php-src/php-7.0.2/sapi/cli/php"; fi;` -n -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' -d phar.readonly=0 -d 'safe_mode=0' /php-src/php-7.0.2/ext/phar/build_precommand.php > ext/phar/phar.php
make: *** [ext/phar/phar.php] Error 139


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2016-01-25 04:15 UTC]
-Status: Open +Status: Feedback
 [2016-01-25 04:15 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read for *NIX and for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

 [2016-01-25 17:42 UTC]
-Status: Feedback +Status: Open
 [2016-01-25 17:42 UTC]
This is odd. If I build PHP 7.0.2 with --enable-debug, it builds perfectly fine with no segmentation fault. All other parameters of my build script remain the same.

If I build PHP 7.0.2 without --enable-debug, I get the segmentation fault.

I've updated my Gist to include the --enable-debug config option, but at this point, I'm not sure how to generate a backtrace, if it builds fine with --enable-debug.
 [2016-01-25 18:32 UTC]
I was able to get a core dump without using --enable-debug. The segmentation fault, as I said earlier, occurs when generating phar.php towards the end of the make process. Here is my full terminal output when using gdb to show the backtrace:

root@vagrant-ubuntu-trusty-64:/php-src/php-7.0.2# gdb /php-src/php-7.0.2/sapi/cli/php qemu_php_20160125-182638_24981.core
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
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 "mips-linux-gnu".
For bug reporting instructions, please see:
Reading symbols from /php-src/php-7.0.2/sapi/cli/php...done.
[New LWP 24981]
Core was generated by `/php-src/php-7.0.2/sapi/cli/php -n -n -d open_basedir= -d output_buffering=0 -d'.
Program terminated with signal 11, Segmentation fault.
#0  0x0067b624 in _zval_get_long_func (op=0x8ec1b8, op@entry=<error reading variable: Cannot access memory at address 0x76ffe2f4>) at /php-src/php-7.0.2/Zend/zend_operators.c:751
751					convert_object_to_type(op, &dst, IS_LONG, convert_to_long);
warning: not using untrusted file ".gdbinit"
(gdb) bt
#0  0x0067b624 in _zval_get_long_func (op=0x8ec1b8, op@entry=<error reading variable: Cannot access memory at address 0x76ffe2f4>) at /php-src/php-7.0.2/Zend/zend_operators.c:751
Cannot access memory at address 0x76ffe2f4
 [2021-01-08 16:52 UTC]
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-01-08 16:52 UTC]
Is that still an issue with any of the actively supported PHP

[1] <>
 [2021-01-17 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Feb 23 17:01:28 2024 UTC