Edit report at https://bugs.php.net/bug.php?id=67493&edit=1
ID: 67493
Updated by: cmb@php.net
Reported by: majo-bugs dot php dot net at pematon dot com
Summary: Crash in _zend_hash_add_or_update
-Status: Assigned
+Status: Closed
Type: Bug
Package: Scripting Engine problem
Operating System: FreeBSD 9.2
PHP Version: 5.4.29
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Thanks!
Previous Comments:
------------------------------------------------------------------------
[2018-09-22 19:53:36] majo-bugs dot php dot net at pematon dot com
No, it does not happen anymore. Feel free to close it.
------------------------------------------------------------------------
[2018-09-22 17:19:29] cmb@php.net
Does this still happen with any of the actively supported PHP
versions[1]?
[1] <http://php.net/supported-versions.php>
------------------------------------------------------------------------
[2016-02-08 13:55:52] lluis dot garcia at gmail dot com
Same happening here.
PHP version: PHP 5.3.3 (cli) (built: Jul 9 2015 17:39:00)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Suhosin v0.9.29, Copyright (c) 2007, by SektionEins GmbH
Using CentOS 6.7 with package:
php.x86_64 5.3.3-46.el6_6
I can't provide a script to reproduce it.
(gdb) bt
#0 0x00007f9515a7b46d in _zend_hash_add_or_update (ht=0x7f9521821878, arKey=0x7f95223fe028
"REMOTE_ADDR", nKeyLength=12, pData=0x7ffde2894550, nDataSize=8, pDest=0x7ffde2894548,
flag=1) at /usr/src/debug/php-5.3.3/Zend/zend_hash.c:218
#1 0x00007f9515a2ad4b in zend_symtable_update (var_name=<value optimized out>,
val=0x7ffde28945e0, track_vars_array=0x7f952201f450) at
/usr/src/debug/php-5.3.3/Zend/zend_hash.h:346
#2 php_register_variable_ex (var_name=<value optimized out>, val=0x7ffde28945e0,
track_vars_array=0x7f952201f450) at /usr/src/debug/php-5.3.3/main/php_variables.c:251
#3 0x00007f951593feb9 in php_sapi_filter (arg=<value optimized out>, var=0x7f95078ced1b
"REMOTE_ADDR", val=0x7ffde2894648, val_len=12, new_val_len=0x0) at
/usr/src/debug/php-5.3.3/ext/filter/filter.c:484
#4 0x00007f9515a24ecc in sapi_getenv (name=0x7f95078ced1b "REMOTE_ADDR",
name_len=<value optimized out>) at /usr/src/debug/php-5.3.3/main/SAPI.c:954
#5 0x00007f95078c535b in suhosin_log () from /usr/lib64/php/modules/suhosin.so
#6 0x00007f95078c0e93 in ?? () from /usr/lib64/php/modules/suhosin.so
#7 0x00007f9515a816a5 in zend_restore_ini_entry_cb (ini_entry=0x7f95212c88b0, stage=8) at
/usr/src/debug/php-5.3.3/Zend/zend_ini.c:57
#8 0x00007f9515a81781 in zend_restore_ini_entry_wrapper (ini_entry=<value optimized out>) at
/usr/src/debug/php-5.3.3/Zend/zend_ini.c:81
#9 0x00007f9515a79885 in zend_hash_apply (ht=0x7f9521618488, apply_func=0x7f9515a81770
<zend_restore_ini_entry_wrapper>) at /usr/src/debug/php-5.3.3/Zend/zend_hash.c:671
#10 0x00007f9515a81bf0 in zend_ini_deactivate () at /usr/src/debug/php-5.3.3/Zend/zend_ini.c:121
#11 0x00007f9515a6dadf in zend_deactivate () at /usr/src/debug/php-5.3.3/Zend/zend.c:919
#12 0x00007f9515a1b675 in php_request_shutdown (dummy=<value optimized out>) at
/usr/src/debug/php-5.3.3/main/main.c:1641
#13 0x00007f9515af60b7 in php_apache_request_dtor (r=0x7f952165a7e8) at
/usr/src/debug/php-5.3.3/sapi/apache2handler/sapi_apache2.c:509
#14 php_handler (r=0x7f952165a7e8) at
/usr/src/debug/php-5.3.3/sapi/apache2handler/sapi_apache2.c:681
#15 0x00007f95206ffe50 in ap_run_handler (r=0x7f952165a7e8) at
/usr/src/debug/httpd-2.2.15/server/config.c:158
#16 0x00007f952070370e in ap_invoke_handler (r=0x7f952165a7e8) at
/usr/src/debug/httpd-2.2.15/server/config.c:376
#17 0x00007f952070ee00 in ap_process_request (r=0x7f952165a7e8) at
/usr/src/debug/httpd-2.2.15/modules/http/http_request.c:282
#18 0x00007f952070bc48 in ap_process_http_connection (c=0x7f9521633448) at
/usr/src/debug/httpd-2.2.15/modules/http/http_core.c:190
#19 0x00007f9520707958 in ap_run_process_connection (c=0x7f9521633448) at
/usr/src/debug/httpd-2.2.15/server/connection.c:43
#20 0x00007f9520713b97 in child_main (child_num_arg=<value optimized out>) at
/usr/src/debug/httpd-2.2.15/server/mpm/prefork/prefork.c:667
#21 0x00007f9520713eaa in make_child (s=0x7f9521134870, slot=5) at
/usr/src/debug/httpd-2.2.15/server/mpm/prefork/prefork.c:763
#22 0x00007f95207141db in startup_children (_pconf=<value optimized out>, plog=<value
optimized out>, s=<value optimized out>) at
/usr/src/debug/httpd-2.2.15/server/mpm/prefork/prefork.c:781
#23 ap_mpm_run (_pconf=<value optimized out>, plog=<value optimized out>, s=<value
optimized out>) at /usr/src/debug/httpd-2.2.15/server/mpm/prefork/prefork.c:1002
#24 0x00007f95206eba30 in main (argc=1, argv=0x7ffde2899438) at
/usr/src/debug/httpd-2.2.15/server/main.c:763
------------------------------------------------------------------------
[2014-07-05 21:55:04] majo-bugs dot php dot net at pematon dot com
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
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
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=67493
--
Edit this bug report at https://bugs.php.net/bug.php?id=67493&edit=1