pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

pkg/32007: FreeBSD and PHP problem with --enable-memory-limit



>Number:         32007
>Category:       pkg
>Synopsis:       PHP cannot create pipes on FreeBSD with PHP using the default 
>memory limit.
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          open
>Class:          support
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 05 23:33:00 +0000 2005
>Originator:     pancake
>Release:        FreeBSD 7.0-CURRENT
>Organization:
        
>Environment:
        
        
System: FreeBSD porticoluna 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Tue Sep 27 
07:09:02 CEST 2005 root@porticoluna:/usr/src/sys/i386/compile/KERN_PLUNA2 i386
Architecture: i386
Machine: i386
>Description:
        I have been using FreeBSD from 4 to 7, always with pkgsrc, but I was 
unable to 
        call mail(), system() and other commands that uses pipes like popen() 
does.

        After some debugging, I found the problem in PHP.

        The default build flag of pkgsrc's PHP was to enable the 
--enable-memory-limit,
        that makes PHP workable by default until it takes 8MB of memory.

        On FreeBSD, when you call one of these functions, the process must 
require more
        memory and this makes PHP to take more that 8MB of memory, forcing PHP 
to syslog
        a string like that:

        Fatal error 'Unable to read from thread kernel pipe' at line 1100 in 
file /usr/src/lib/libc_r/uthread/uthread_kern.c (errno = 0)
        [Thu Nov  3 02:01:24 2005] [notice] child pid 70180 exit signal Abort 
trap (6)

        This string is created when the process overflows the memory limit 
defined by PHP.


        
>How-To-Repeat:
        Just call mail() or system() on FreeBSD using pkgsrc with PHP.
        
>Fix:

        The fix contains just a bigger limit for PHP, something like 64M is so 
logic, but disable 
        --disable-memory-limit would make the same effect on ther target 
system. But obviously
        making the system 'vulnerable' to a DoS. (sysctl fixable).

        
cvs diff: Diffing .
Index: Makefile.php
===================================================================
RCS file: /pub/NetBSD-CVS/pkgsrc/www/php4/Makefile.php,v
retrieving revision 1.30
diff -u -r1.30 Makefile.php
--- Makefile.php        1 Nov 2005 23:12:15 -0000       1.30
+++ Makefile.php        5 Nov 2005 23:24:03 -0000
@@ -22,7 +22,7 @@
 .include "../../mk/bsd.prefs.mk"
 
 CONFIGURE_ARGS+=       --with-regex=system
-CONFIGURE_ARGS+=       --enable-memory-limit
+CONFIGURE_ARGS+=       --enable-memory-limit=64M
 CONFIGURE_ARGS+=       --enable-track-vars
 
 # Support for linking some PHP4 extensions statically into the php CGI and

        

>Unformatted:
        
        



Home | Main Index | Thread Index | Old Index