Edit report at https://bugs.php.net/bug.php?id=64836&edit=1
ID: 64836
Comment by: andrey at holey dot org
Reported by: r dot biegel at gmx dot at
Summary: segfault in softmagic.c
Status: Closed
Type: Bug
Package: Unknown/Other Function
Operating System: Gentoo Linux
PHP Version: 5.4.15
Assigned To: ab
Block user comment: N
Private report: N
New Comment:
Confirm this issue.
Any Gentoo system fail if:
* sys-apps/file>5.11
* you use mod_php
* and run the following code:
<?php
$realpath = realpath("extensions/Vector/modules/images/portal-break.png");
echo finfo_file( finfo_open( FILEINFO_MIME_TYPE ), $realpath );
?>
Note: this example for MediaWiki 1.19.11 root folder
PHP versions affected: 5.3, 5.4, 5.5 (any)
Previous Comments:
------------------------------------------------------------------------
[2013-07-26 14:21:36] james dot dingwall at zynstra dot com
I have observed the same issue on Gentoo with a combination of apache-2.4.6-r1 and php-5.4.17. With
sys-apps/file-5.11 things are ok, but with 5.12-r1 I get a segfault in libphp5.so. Recompiling
5.12-r1 did not solve the issue for me so I am sticking with 5.11 for now.
Program received signal SIGSEGV, Segmentation fault.
0x00007fffeb924658 in ?? () from /usr/lib64/apache2/modules/libphp5.so
(gdb) bt
#0 0x00007fffeb924658 in ?? () from /usr/lib64/apache2/modules/libphp5.so
#1 0x00007fffeb920924 in ?? () from /usr/lib64/apache2/modules/libphp5.so
#2 0x00007fffeb9206ba in file_softmagic ()
from /usr/lib64/apache2/modules/libphp5.so
#3 0x00007fffeb91e4a1 in file_buffer ()
from /usr/lib64/apache2/modules/libphp5.so
#4 0x00007fffeb91f5ad in ?? () from /usr/lib64/apache2/modules/libphp5.so
#5 0x00007fffeb91f354 in magic_stream ()
from /usr/lib64/apache2/modules/libphp5.so
#6 0x00007fffeb91217c in ?? () from /usr/lib64/apache2/modules/libphp5.so
#7 0x00007fffeb9123b1 in zif_finfo_file ()
from /usr/lib64/apache2/modules/libphp5.so
#8 0x00007fffebc7bc02 in ?? () from /usr/lib64/apache2/modules/libphp5.so
#9 0x00007fffebc82c96 in ?? () from /usr/lib64/apache2/modules/libphp5.so
#10 0x00007fffebc7a5c4 in execute () from /usr/lib64/apache2/modules/libphp5.so
#11 0x00007fffebc2bc16 in zend_call_function ()
from /usr/lib64/apache2/modules/libphp5.so
#12 0x00007fffebae1eb7 in zif_array_map ()
from /usr/lib64/apache2/modules/libphp5.so
#13 0x00007fffebc7bc02 in ?? () from /usr/lib64/apache2/modules/libphp5.so
#14 0x00007fffebc82c96 in ?? () from /usr/lib64/apache2/modules/libphp5.so
#15 0x00007fffebc7a5c4 in execute () from /usr/lib64/apache2/modules/libphp5.so
#16 0x00007fffebc3e69c in zend_execute_scripts ()
from /usr/lib64/apache2/modules/libphp5.so
#17 0x00007fffebbb2e27 in php_execute_script ()
from /usr/lib64/apache2/modules/libphp5.so
#18 0x00007fffebd73f52 in ?? () from /usr/lib64/apache2/modules/libphp5.so
#19 0x0000000000455dcd in ap_run_handler ()
#20 0x00000000004566b0 in ap_invoke_handler ()
#21 0x0000000000472301 in ap_process_async_request ()
#22 0x00000000004723e6 in ap_process_request ()
#23 0x000000000046e2af in ?? ()
#24 0x000000000046e3c5 in ?? ()
#25 0x0000000000463085 in ap_run_process_connection ()
#26 0x000000000046354d in ap_process_connection ()
#27 0x000000000047c6da in ?? ()
#28 0x000000000047c7f1 in ?? ()
#29 0x000000000047cde5 in ?? ()
---Type <return> to continue, or q <return> to quit---
#30 0x0000000000434390 in ap_run_mpm ()
#31 0x000000000042c7a3 in main ()
------------------------------------------------------------------------
[2013-07-19 07:41:47] ab@php.net
Thanks for staying on this bug guys. I'd say this is more like a gentoo bug caused
by some awkward constellation of lib versions. So closing for now.
Thanks
------------------------------------------------------------------------
[2013-07-17 10:25:05] r dot biegel at gmx dot at
After downgrading sys-apps/file to 5.11 there are no segfaults anymore. But after upgrading to
5.12-r1 again, there are no sefaults either. So maybe "file" just needed to be recompiled?
I'm not able to reproduce it with any php/file combination for now (php 5.4.16, 5.4.17, 5.5.0).
------------------------------------------------------------------------
[2013-07-11 20:48:09] joschi at tollwerk dot de
I can confirm the issue on an x86_64 hardened Gentoo box with both PHP 5.4.17 as well as PHP 5.5.0.
It's not only the TYPO3 upgrade wizard that is failing, but also several TYPO3 backend modules
(probably all the ones involving
thumbnail generation) as well as the frontend (in my case at least).
As stated above, downgrading sys-apps/file to version 5.11 solves the issue for me as well.
------------------------------------------------------------------------
[2013-07-09 22:09:18] ab@php.net
Thanks staying on this guys. Reading the linked ticket:
"Simply removing (and thus disabling file) /usr/share/misc/magic.mgc "fixes" issues
with Mediawiki"
That could be a plausible explanation why PHP could fail, not sure about crash. As
PHP uses a compiled in magic file which is strongly recommended to use (so no
external file loading). However that explanation wouldn't exactly match with what
"r dot biegel at gmx dot at" told earlier
"PHP Versions 5.3.25, 5.4.13, 5.4.14, 5.4.15 and 5.5.0_rc2 all segfault for me."
where by 5.3 didn't become any libmagic upgrades since long. That fact makes me
really confused, as that would mean even without upgrade the constellation of
apache svn module and php would cause crash. 5.3 has libmagic 5.11 or older if i
don't err.
And this is anyway something i can't reproduce compiling all the stuff manually.
@r.biegel - if downgrading libmagic on your gentoo system works, i would close this
ticket with the status "mystic" :)
Thanks
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=64836--
Edit this bug report at https://bugs.php.net/bug.php?id=64836&edit=1