Edit report at https://bugs.php.net/bug.php?id=55509&edit=1
ID: 55509
Patch added by: laruence@php.net
Reported by: r dot gauweiler at otterbach dot de
Summary: segfault on x86_64 using more than 2G memory
Status: Open
Type: Bug
Package: Streams related
Operating System: Linux
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
The following patch has been added/updated:
Patch Name: bug55509.diff
Revision: 1315316576
URL: https://bugs.php.net/patch-display.php?bug=55509&patch=bug55509.diff&revision=1315316576
Previous Comments:
------------------------------------------------------------------------
[2011-08-25 17:30:05] r dot gauweiler at otterbach dot de
Description:
------------
I get a segfault if I use much memory on a x86_64. It works up to 2G and doesn't
work beyond it.
I first encountered it using streams, but it seems that it happens always using
more memory.
Test script:
---------------
<?php
$a=file_get_contents('/dev/zero');
?>
Expected result:
----------------
getting fatal error telling me that memory_limit is exhausted like
'Fatal error: Allowed memory size of 2147483648 bytes exhausted at /home/rgr/php-
5.3.8/main/streams/streams.c:1331 (tried to allocate 2146697216 bytes) in
fillMemory.php on line 3'
Actual result:
--------------
rgr@rgrVM1:~/php-5.3.8/sapi/cli$ ./php -d memory_limit=3G fillMemory.php
Speicherzugriffsfehler (Speicherabzug geschrieben)
rgr@rgrVM1:~/php-5.3.8/sapi/cli$ ./php --version
PHP 5.3.8 (cli) (built: Aug 25 2011 18:37:32) (DEBUG)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies
(gdb) bt
#0 0x00000000007c1d18 in _zend_mm_realloc_int (heap=0x2db82c0,
p=0x7fe31c8a7070, size=2147491840,
__zend_filename=0xba5468 "/home/rgr/php-5.3.8/main/streams/streams.c",
__zend_lineno=1331,
__zend_orig_filename=0xb85bf8 "/home/rgr/php-5.3.8/ext/standard/file.c",
__zend_orig_lineno=570)
at /home/rgr/php-5.3.8/Zend/zend_alloc.c:2143
#1 0x00000000007c2a36 in _erealloc (ptr=0x7fe31c8a7070, size=2147491840,
allow_failure=0,
__zend_filename=0xba5468 "/home/rgr/php-5.3.8/main/streams/streams.c",
__zend_lineno=1331,
__zend_orig_filename=0xb85bf8 "/home/rgr/php-5.3.8/ext/standard/file.c",
__zend_orig_lineno=570)
at /home/rgr/php-5.3.8/Zend/zend_alloc.c:2371
#2 0x000000000078c1a0 in _php_stream_copy_to_mem (src=0x2f58498,
buf=0x7fff9b3155e8, maxlen=0, persistent=0,
__php_stream_call_depth=0, __zend_filename=0xb85bf8 "/home/rgr/php-
5.3.8/ext/standard/file.c", __zend_lineno=570,
__zend_orig_filename=0x0, __zend_orig_lineno=0) at /home/rgr/php-
5.3.8/main/streams/streams.c:1331
#3 0x00000000006e615d in zif_file_get_contents (ht=1, return_value=0x2f56d70,
return_value_ptr=0x0, this_ptr=0x0,
return_value_used=0) at /home/rgr/php-5.3.8/ext/standard/file.c:570
#4 0x00000000005e9c2c in phar_file_get_contents (ht=1, return_value=0x2f56d70,
return_value_ptr=0x0, this_ptr=0x0,
return_value_used=0) at /home/rgr/php-5.3.8/ext/phar/func_interceptors.c:225
#5 0x000000000081cfbf in zend_do_fcall_common_helper_SPEC
(execute_data=0x7fe3dc874090)
at /home/rgr/php-5.3.8/Zend/zend_vm_execute.h:320
#6 0x00000000008215f3 in ZEND_DO_FCALL_SPEC_CONST_HANDLER
(execute_data=0x7fe3dc874090)
at /home/rgr/php-5.3.8/Zend/zend_vm_execute.h:1640
#7 0x000000000081c47c in execute (op_array=0x2f57a30) at /home/rgr/php-
5.3.8/Zend/zend_vm_execute.h:107
#8 0x00000000007e82d5 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /home/rgr/php-5.3.8/Zend/zend.c:1236
#9 0x0000000000770cf7 in php_execute_script (primary_file=0x7fff9b317e30) at
/home/rgr/php-5.3.8/main/main.c:2284
#10 0x00000000008d27dc in main (argc=4, argv=0x7fff9b318088) at /home/rgr/php-
5.3.8/sapi/cli/php_cli.c:1184
also reproduced it with
rgr@rgrVM1:~/php-5.3.8/sapi/cli$ php --version
PHP 5.3.3-7+squeeze3 with Suhosin-Patch (cli) (built: Jun 28 2011 08:24:40)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Suhosin v0.9.32.1, Copyright (c) 2007-2010, by SektionEins GmbH
root@develop:/mnt/webdav/web/public/rgr/streamTest# php --version
PHP 5.2.6-1+lenny13 with Suhosin-Patch 0.9.6.2 (cli) (built: Jul 1 2011
16:01:01)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
with eAccelerator v0.9.6.1, Copyright (c) 2004-2010 eAccelerator, by
eAccelerator
with Suhosin v0.9.27, Copyright (c) 2007, by SektionEins GmbH
cli and apache-module as well.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55509&edit=1