ID:               49501
 User updated by:  romain dot riviere at gmail dot com
 Reported By:      romain dot riviere at gmail dot com
 Status:           Open
 Bug Type:         Scripting Engine problem
 Operating System: Gentoo Linux 32bit / PaX
 PHP Version:      5.*, 6
 New Comment:

Brad, thanks for clearing that up. However, I'm not sure I understand
how it explains the behaviour I've had: shouldn't the memory allocation
give up when reaching about half of the allowed 128M ? It's far from
being the case here ...

Without SEGMEXEC: the code (second snip) used to demonstrate the bug
runs in an endless loop, as it is supposed to. The string never exceeds
PHP's memory limit.

With SEGMEXEC: the code runs a few times, meaning the string is
generated up to PHP's memory limit. However, after a few runs, it dies,
and it's never even close to half the memory_limit.

What am I missing ?


Previous Comments:
------------------------------------------------------------------------

[2009-09-29 18:35:58] spender at grsecurity dot net

Due to VMA mirroring, the SEGMEXEC option causes accounted vm usage to
double.  So you weren't experiencing a memory leak -- you were just
being accounted for twice as much memory as you thought you were using. 
The solution would be to double the resource limit or, if your system is
NX-capable and PAE is enabled, use PAGEEXEC.

-Brad

------------------------------------------------------------------------

[2009-09-29 17:18:03] romain dot riviere at gmail dot com

Just a quick follow-up on this one.

I've finally traced it to PaX's SEGMEXEC feature.
I do not know yet if every PaX kernel should display that behaviour, or
if it's just VServer's GrSec patch, but disabling SEGMEXEC fixed it for
me.

I guess the bottomline here is : not PHP's fault

Cheers !

------------------------------------------------------------------------

[2009-09-12 13:51:39] romain dot riviere at gmail dot com

Unfortunately, same difference (Fatal error: Out of memory (allocated
9175040) (tried to allocate 1048577 bytes) in /home/smokey/test.php on
line 15).

I need to take some time and experiment a different kernel, with
different combinations of VServer/PaX/Grsecurity options, and see if it
helps.

------------------------------------------------------------------------

[2009-09-10 06:44:18] romain dot riviere at gmail dot com

I was able to reproduce the problem even with the latest sources. I am
beginning to suspect PaX/GrSecurity.

Are there any catches to be aware of when running PHP in that context ?
I know of the --with-pic/TEXTREL issue, but apparently there must be
something else to it.

------------------------------------------------------------------------

[2009-09-09 19:43:33] j...@php.net

And make sure you really do simply this:

1. Unpack sources
2. ./configure --disable-all --disable-cgi && make
3 run the test script with 'sapi/cli/php -n -d memory_limit=128M 
yourscript.php

------------------------------------------------------------------------

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
    http://bugs.php.net/49501

-- 
Edit this bug report at http://bugs.php.net/?id=49501&edit=1

Reply via email to