Edit report at https://bugs.php.net/bug.php?id=67493&edit=1
ID: 67493
User updated by: majo-bugs dot php dot net at pematon dot com
Reported by: majo-bugs dot php dot net at pematon dot com
Summary: Crash in _zend_hash_add_or_update
Status: Open
Type: Bug
Package: PHAR related
Operating System: FreeBSD 9.2
PHP Version: 5.4.29
Block user comment: N
Private report: N
New Comment:
I tried to analyze the crash dump a little more:
#0 0x0000000805944c94 in _zend_hash_add_or_update (ht=0x805ddc1f0,
arKey=0x80f56cea8 "/srv/konecnekreslim.com/www/public/image.php", nKeyLength=45,
pData=0x7fffffffd37c,
nDataSize=4, pDest=0x0, flag=2) at
/tmp/portbuild/usr/ports/www/mod_php5/work/php-5.4.29/Zend/zend_hash.c:220
220 if (p->arKey == arKey ||
[New Thread 802407400 (LWP 102051/httpd)]
(gdb) list zend_hash.c:220
215 h = zend_inline_hash_func(arKey, nKeyLength);
216 nIndex = h & ht->nTableMask;
217
218 p = ht->arBuckets[nIndex];
219 while (p != NULL) {
220 if (p->arKey == arKey ||
221 ((p->h == h) && (p->nKeyLength == nKeyLength) && !memcmp(p->arKey,
arKey, nKeyLength))) {
222 if (flag & HASH_ADD) {
223 return FAILURE;
224 }
(gdb) p p
$1 = (Bucket *) 0x16800259ff625ff
(gdb) p *p
Cannot access memory at address 0x16800259ff625ff
(gdb) p nIndex
$2 = 15
(gdb) p *ht->arBuckets[nIndex]
$3 = {h = 302, nKeyLength = 0, pData = 0x0, pDataPtr = 0x7d0000000000, pListNext = 0x8073906d8,
pListLast = 0x807390768, pNext = 0x8073907c0, pLast = 0x807390790, arKey = 0x7 <Address 0x7 out
of bounds>}
(gdb) p *ht->arBuckets[nIndex]->pNext
$4 = {h = 34479906304, nKeyLength = 0, pData = 0xffffffffffffffff, pDataPtr = 0x8073906b8, pListNext
= 0x8073907c0,
pListLast = 0x4353a0, pNext = 0x42cb54, pLast = 0x8072fa028, arKey = 0x30 <Address 0x30 out of
bounds>}
--> Pointers pListLast = 0x4353a0 and pNext = 0x42cb54 do not seem correct, other pointers have
0x80 prefix.
(gdb) p *ht->arBuckets[nIndex]->pNext->pNext
$5 = {h = 18331902444810675711, nKeyLength = 3909091328, pData = 0xff680025a00625ff, pDataPtr =
0xffffeff0e9000000,
pListNext = 0x6800259ffe25ff, pListLast = 0xffffefe0e9000001, pNext = 0x16800259ff625ff,
pLast = 0xffffefd0e9000001, arKey = 0x26800259fee25ff <Address 0x26800259fee25ff out of
bounds>}
--> Looks like random data. pNext = 0x16800259ff625ff is the problematic address, that can not be
addressed
Previous Comments:
------------------------------------------------------------------------
[2014-06-29 08:45:11] majo-bugs dot php dot net at pematon dot com
Unfortunately I am not able to provide a reproducing script because I am not able to reproduce the
problem. If I call the script that causes the crash with exactly the same parameters as the one that
has crashed it is not crashing any more. However the script is crashing few times a week (with
different parameters / conditions).
I have tried to set "MaxRequestsPerChild 1" in httpd.conf as this has helped somebody in
Bug #42475 Got seg fault, core dump in php 5.2.3 code in _zend_hash_add_or_update. It did not help.
------------------------------------------------------------------------
[2014-06-24 05:36:46] laruence@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
[2014-06-22 03:31:57] majo-bugs dot php dot net at pematon dot com
Description:
------------
Crashes from time to time in _zend_hash_add_or_update.
Expected result:
----------------
Not crash.
Actual result:
--------------
Core was generated by `httpd'.
Program terminated with signal 10, Bus error.
#0 _zend_hash_add_or_update (ht=0x805c8e590, arKey=0x80ef88ce8
"/srv/konecnekreslim.com/www/public/image.php", nKeyLength=45, pData=0x7fffffffd39c,
nDataSize=4, pDest=0x0, flag=2)
at /tmp/portbuild/usr/ports/www/mod_php5/work/php-5.4.29/Zend/zend_hash.c:220
220 /tmp/portbuild/usr/ports/www/mod_php5/work/php-5.4.29/Zend/zend_hash.c: No such file or
directory.
in /tmp/portbuild/usr/ports/www/mod_php5/work/php-5.4.29/Zend/zend_hash.c
[New Thread 802407400 (LWP 100409/httpd)]
#0 _zend_hash_add_or_update (ht=0x805c8e590, arKey=0x80ef88ce8
"/srv/konecnekreslim.com/www/public/image.php", nKeyLength=45, pData=0x7fffffffd39c,
nDataSize=4, pDest=0x0, flag=2)
at /tmp/portbuild/usr/ports/www/mod_php5/work/php-5.4.29/Zend/zend_hash.c:220
#1 0x000000080c5f1eca in my_compile_file () from /usr/local/lib/php/20100525/apc.so
#2 0x000000080b51c5c4 in phar_compile_file () from /usr/local/lib/php/20100525/phar.so
#3 0x000000080588e6bd in zend_execute_scripts (type=2, retval=0x0, file_count=1) at
/tmp/portbuild/usr/ports/www/mod_php5/work/php-5.4.29/Zend/zend.c:1307
#4 0x0000000805937ee1 in php_handler (r=0x8071f6280) at
/tmp/portbuild/usr/ports/www/mod_php5/work/php-5.4.29/sapi/apache2handler/sapi_apache2.c:669
#5 0x000000000044e91a in ap_run_handler (r=0x8071f6280) at config.c:169
#6 0x0000000000452682 in ap_invoke_handler (r=0x8071f6280) at config.c:439
#7 0x0000000000463baa in ap_internal_redirect (new_uri=<value optimized out>, r=<value
optimized out>) at http_request.c:644
#8 0x000000080546b640 in handler_redirect (r=0x80717b0a0) at mod_rewrite.c:5105
#9 0x000000000044e91a in ap_run_handler (r=0x80717b0a0) at config.c:169
#10 0x0000000000452682 in ap_invoke_handler (r=0x80717b0a0) at config.c:439
#11 0x0000000000463f8e in ap_process_async_request (r=0x80717b0a0) at http_request.c:317
#12 0x00000000004640cf in ap_process_request (r=0x80717b0a0) at http_request.c:363
#13 0x0000000000460815 in ap_process_http_connection (c=0x807145290) at http_core.c:190
#14 0x0000000000458c22 in ap_run_process_connection (c=0x807145290) at connection.c:41
#15 0x000000000046a327 in child_main (child_num_arg=<value optimized out>) at prefork.c:704
#16 0x000000000046a5a4 in make_child (s=0x802453268, slot=2) at prefork.c:800
#17 0x000000000046af06 in prefork_run (_pconf=<value optimized out>, plog=<value optimized
out>, s=<value optimized out>) at prefork.c:902
#18 0x00000000004360b2 in ap_run_mpm (pconf=0x802423028, plog=0x80244f028, s=0x802453268) at
mpm_common.c:96
#19 0x000000000043021b in main (argc=2, argv=0x7fffffffdd18) at main.c:777
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67493&edit=1