php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66934 PHP compiled with Sun Studio dies with a SIGILL
Submitted: 2014-03-19 14:26 UTC Modified: 2021-09-05 04:22 UTC
Votes:4
Avg. Score:4.5 ± 0.9
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:4 (100.0%)
From: eric dot w dot sprague dot ctr at navy dot mil Assigned: cmb (profile)
Status: No Feedback Package: *Compile Issues
PHP Version: 5.5.10 OS: Solaris 10 SPARC
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: eric dot w dot sprague dot ctr at navy dot mil
New email:
PHP Version: OS:

 

 [2014-03-19 14:26 UTC] eric dot w dot sprague dot ctr at navy dot mil
Description:
------------
When building PHP 5.5.10 with the Sun Studio 12 compiler on Solaris 10 Update 11 SPARC, the compile succeeds but "make test" or "make install" fail due to the PHP binary crashing with a bus error.

CFLAGS/CXXFLAGS tested: "-xO0 -xarch=generic -m32" for testing and debugging, "-xO3 -xarch=sparcvis2 -m32" for production build; symptoms identical in both cases.

=====================================================================
PHP         : /export/home/jade/php-5.5.10/sapi/cli/php 
PHP_SAPI    : cli
PHP_VERSION : 5.5.10
ZEND_VERSION: 2.5.0
PHP_OS      : SunOS - SunOS daedalus 5.10 Generic_150400-09 sun4u
INI actual  : /export/home/jade/php-5.5.10/tmp-php.ini
More .INIs  :  
CWD         : /export/home/jade/php-5.5.10
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
TIME START 2014-03-19 13:47:55
=====================================================================
PASS EXPECT [tests/run-test/test001.phpt] 
/bin/bash: line 21:  9295 Bus Error               (core dumped) TEST_PHP_EXECUTABLE=/export/home/jade/php-5.5.10/sapi/cli/php TEST_PHP_SRCDIR=/export/home/jade/php-5.5.10 CC="cc" /export/home/jade/php-5.5.10/sapi/cli/php -n -c /export/home/jade/php-5.5.10/tmp-php.ini -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' /export/home/jade/php-5.5.10/run-tests.php -n -c /export/home/jade/php-5.5.10/tmp-php.ini -d extension_dir=/export/home/jade/php-5.5.10/modules/ ` if test "x" != "x"; then for i in ""; do . $i; /export/home/jade/php-5.5.10/build/shtool echo -n -- " -d extension=$dlname"; done; fi; if test "x" != "x"; then for i in ""; do . $i; /export/home/jade/php-5.5.10/build/shtool echo -n -- " -d zend_extension=/export/home/jade/php-5.5.10/modules/$dlname"; done; fi`
gmake: *** [test] Error 138


When running in gdb I see a SEGV, not a bus error.

PHP 5.5.9 does not suffer from this issue, with the same compiler, same configure options.

Expected result:
----------------
make test or make install should succeed.

Actual result:
--------------
(gdb) backtrace
#0  0x0013b284 in compare_opcodes (code=0x134d3cc "\035\nn", utf=0, cd=0xffbfe8e8, base_list=0xffbfd704, base_end=0x134d3ca "W\a\035\nn")
    at /export/home/jade/php-5.5.10/ext/pcre/pcrelib/pcre_compile.c:3266
#1  0x0013cef8 in auto_possessify (code=0x134d3a8 "n", utf=0, cd=0xffbfe8e8) at /export/home/jade/php-5.5.10/ext/pcre/pcrelib/pcre_compile.c:3649
#2  0x00149f44 in php_pcre_compile2 (
    pattern=0x1116040 "^\\d+\n[+-]?\\d+\n[+-]?\\d+\n[+-]?\\.?\\d+\\.?\\d*(?:[Ee][+-]?\\d+)?\n[^\\r\\n]+\n[0-9a-fA-F]+\n.$", options=4, 
    errorcodeptr=0x0, errorptr=0xffbfeae0, erroroffset=0xffbfeadc, tables=0x134cf20 "")
    at /export/home/jade/php-5.5.10/ext/pcre/pcrelib/pcre_compile.c:9210
#3  0x001485d8 in php_pcre_compile (
    pattern=0x1116040 "^\\d+\n[+-]?\\d+\n[+-]?\\d+\n[+-]?\\.?\\d+\\.?\\d*(?:[Ee][+-]?\\d+)?\n[^\\r\\n]+\n[0-9a-fA-F]+\n.$", options=4, 
    errorptr=0xffbfeae0, erroroffset=0xffbfeadc, tables=0x134cf20 "") at /export/home/jade/php-5.5.10/ext/pcre/pcrelib/pcre_compile.c:8686
#4  0x0017dbe0 in pcre_get_compiled_regex_cache (
    regex=0x1375358 "/^\\d+\n[+-]?\\d+\n[+-]?\\d+\n[+-]?\\.?\\d+\\.?\\d*(?:[Ee][+-]?\\d+)?\n[^\\r\\n]+\n[0-9a-fA-F]+\n.$/s", regex_len=85)
    at /export/home/jade/php-5.5.10/ext/pcre/php_pcre.c:403
#5  0x0017e4e4 in php_do_pcre_match (ht=2, return_value=0x16dd1c0, return_value_ptr=0x0, this_ptr=0x0, return_value_used=1, global=0)
    at /export/home/jade/php-5.5.10/ext/pcre/php_pcre.c:549
#6  0x0017f65c in zif_preg_match (ht=2, return_value=0x16dd1c0, return_value_ptr=0x0, this_ptr=0x0, return_value_used=1)
    at /export/home/jade/php-5.5.10/ext/pcre/php_pcre.c:805
#7  0x00c0c534 in zend_do_fcall_common_helper_SPEC (execute_data=0x1100030) at /export/home/jade/php-5.5.10/Zend/zend_vm_execute.h:550
#8  0x00c14164 in ZEND_DO_FCALL_SPEC_CONST_HANDLER (execute_data=0x1100030) at /export/home/jade/php-5.5.10/Zend/zend_vm_execute.h:2329
#9  0x00c0b7dc in execute_ex (execute_data=0x1100030) at /export/home/jade/php-5.5.10/Zend/zend_vm_execute.h:363
#10 0x00c0b94c in zend_execute (op_array=0x1115038) at /export/home/jade/php-5.5.10/Zend/zend_vm_execute.h:388
#11 0x00b36fc8 in zend_execute_scripts (type=8, retval=0x0, file_count=3, ...=0x0) at /export/home/jade/php-5.5.10/Zend/zend.c:1316
#12 0x009659e8 in php_execute_script (primary_file=0xffbff8d4) at /export/home/jade/php-5.5.10/main/main.c:2506
#13 0x00ce76e4 in do_cli (argc=16, argv=0x10f6d18) at /export/home/jade/php-5.5.10/sapi/cli/php_cli.c:994
#14 0x00ce90b4 in main (argc=16, argv=0x10f6d18) at /export/home/jade/php-5.5.10/sapi/cli/php_cli.c:1378


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-03-19 16:10 UTC] eric dot w dot sprague dot ctr at navy dot mil
Amplifying information: PCRE 8.34 on its own compiles and 'make test' is successful. (Using Sun Studio 12, -xO0 -xarch=generic -m32)
 [2014-03-19 18:16 UTC] eric dot w dot sprague dot ctr at navy dot mil
Typo - Problem does not occur with 5.5.8.
 [2014-05-29 16:10 UTC] eric dot w dot sprague dot ctr at navy dot mil
Fault is due to PCRE bug #1427, misaligned memory access on SPARC. See: https://lists.exim.org/lurker/message/20131231.005837.c62b68a4.en.html

Working on a workaround now.
 [2014-05-29 19:25 UTC] eric dot w dot sprague dot ctr at navy dot mil
Problem can be worked around with Sun Studio by adding the -misalign CFLAG.

Looking for similar workaround for gcc.
 [2014-06-14 16:09 UTC] urs dot traber at gmail dot com
checked with 5.5.12 on Tru64 4.0F and 5.1B:

line 3266:

if ((*set1++ & *set2++) != 0) return FALSE;

of the compare_opcodes function in pcre_compile.c also produces an "unaligned access". Tru64 can deal with it and doesn't die though.
 [2014-06-14 17:16 UTC] urs dot traber at gmail dot com
workaround is to build against an external PCRE library from ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/

e.g. 8.33 is fine for Tru64 4.0F 5.1B. The included tests don't produce any alignment errors.
 [2021-08-23 15:19 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2021-08-23 15:19 UTC] cmb@php.net
Is this still an issue with any of the actively supported PHP
versions[1]?

[1] <https://www.php.net/supported-versions.php>
 [2021-09-05 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: Tue Mar 19 05:01:29 2024 UTC