NetBSD Problem Report #32007

From root@porticoluna.org  Sat Nov  5 23:32:23 2005
Return-Path: <root@porticoluna.org>
Received: from porticoluna.org (acpl.adam.es [212.36.65.53])
	by narn.netbsd.org (Postfix) with ESMTP id 2883063B88E
	for <gnats-bugs@gnats.NetBSD.org>; Sat,  5 Nov 2005 23:32:18 +0000 (UTC)
Message-Id: <20051105233113.1A119E275@porticoluna.org>
Date: Sun,  6 Nov 2005 00:31:13 +0100 (CET)
From: pancake@phreaker.net
Reply-To: pancake@phreaker.net
To: gnats-bugs@netbsd.org
Subject: FreeBSD and PHP problem with --enable-memory-limit
X-Send-Pr-Version: 3.95

>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:    jdolecek
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 05 23:33:00 +0000 2005
>Closed-Date:    Fri Oct 20 22:10:59 +0000 2006
>Last-Modified:  Sun Oct 29 16:50:01 +0000 2006
>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



>Release-Note:

>Audit-Trail:
From: Lubomir Sedlacik <salo@Xtrmntr.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/32007: FreeBSD and PHP problem with --enable-memory-limit
Date: Sun, 6 Nov 2005 00:50:19 +0100

 --7R/oUIX7ilUHG0fO
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 Content-Transfer-Encoding: quoted-printable

 On Sat, Nov 05, 2005 at 11:33:00PM +0000, pancake@phreaker.net wrote:
 > 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).
 >=20
 > =09
 > --- Makefile.php        1 Nov 2005 23:12:15 -0000       1.30
 > +++ Makefile.php        5 Nov 2005 23:24:03 -0000
 > @@ -22,7 +22,7 @@
 > =20
 > -CONFIGURE_ARGS+=3D       --enable-memory-limit
 > +CONFIGURE_ARGS+=3D       --enable-memory-limit=3D64M

 i don't think we should be patching it here.  it is very site specific.
 feel free to adjust the "memory_limit" setting in your php.ini.

 regards,

 --=20
 -- Lubomir Sedlacik <salo@{NetBSD,Xtrmntr,silcnet}.org>   --

 --7R/oUIX7ilUHG0fO
 Content-Type: application/pgp-signature
 Content-Disposition: inline

 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.2 (NetBSD)

 iD8DBQFDbUU7iwjDDlS8cmMRAtzjAJ9XHmWrBx+xFPuzGxwOXdotKf01IACfSmIM
 xXo+Q4fbotySIqy86T8iO3Q=
 =A924
 -----END PGP SIGNATURE-----

 --7R/oUIX7ilUHG0fO--

From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/32007: FreeBSD and PHP problem with --enable-memory-limit
Date: Sun, 6 Nov 2005 16:06:17 +0100

 On Sat, Nov 05, 2005 at 11:51:02PM +0000, Lubomir Sedlacik wrote:
 >  
 >  On Sat, Nov 05, 2005 at 11:33:00PM +0000, pancake@phreaker.net wrote:
 >  > 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).
 >  >=20
 >  > =09
 >  > --- Makefile.php        1 Nov 2005 23:12:15 -0000       1.30
 >  > +++ Makefile.php        5 Nov 2005 23:24:03 -0000
 >  > @@ -22,7 +22,7 @@
 >  > =20
 >  > -CONFIGURE_ARGS+=3D       --enable-memory-limit
 >  > +CONFIGURE_ARGS+=3D       --enable-memory-limit=3D64M
 >  
 >  i don't think we should be patching it here.  it is very site specific.
 >  feel free to adjust the "memory_limit" setting in your php.ini.

 While I agree that changing the default memory limit is site-specific, I
 think the failure is hard enough to correctly detect. What do you think
 about adding a (OS specific) warning to MESSAGES?

 Joerg

Responsible-Changed-From-To: pkg-manager->jdolecek
Responsible-Changed-By: wiz@netbsd.org
Responsible-Changed-When: Mon, 09 Jan 2006 17:40:13 +0000
Responsible-Changed-Why:
Over to php maintainer.


State-Changed-From-To: open->closed
State-Changed-By: jdolecek@netbsd.org
State-Changed-When: Fri, 20 Oct 2006 22:10:59 +0000
State-Changed-Why:
--enable-memory-limit removed from PHP4 and PHP5 packages, thanks
for report.


From: Jaromir Dolecek <jdolecek@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/32007 CVS commit: pkgsrc
Date: Fri, 20 Oct 2006 22:10:34 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	jdolecek
 Date:		Fri Oct 20 22:10:34 UTC 2006

 Modified Files:
 	pkgsrc/lang/php5: Makefile Makefile.php
 	pkgsrc/www/ap-php: Makefile
 	pkgsrc/www/php4: Makefile Makefile.php

 Log Message:
 remove --enable-memory-limit - 8MB is too low, and this just
 duplicates process resource limits, which already provide necessary
 "safety net" protection against rogue scripts

 bump PKGREVISION for this

 adressess PR pkg/32007 by "pancake"

 also remove --enable-track-vars, since that configure argument
 is long gone from PHP


 To generate a diff of this commit:
 cvs rdiff -r1.43 -r1.44 pkgsrc/lang/php5/Makefile
 cvs rdiff -r1.19 -r1.20 pkgsrc/lang/php5/Makefile.php
 cvs rdiff -r1.11 -r1.12 pkgsrc/www/ap-php/Makefile
 cvs rdiff -r1.70 -r1.71 pkgsrc/www/php4/Makefile
 cvs rdiff -r1.35 -r1.36 pkgsrc/www/php4/Makefile.php

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Geert Hendrickx <ghen@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: PR/32007 CVS commit: [pkgsrc-2006Q3] pkgsrc
Date: Sun, 29 Oct 2006 16:47:58 +0000 (UTC)

 Module Name:	pkgsrc
 Committed By:	ghen
 Date:		Sun Oct 29 16:47:58 UTC 2006

 Modified Files:
 	pkgsrc/lang/php5 [pkgsrc-2006Q3]: Makefile Makefile.php distinfo
 	pkgsrc/www/ap-php [pkgsrc-2006Q3]: Makefile
 	pkgsrc/www/php4 [pkgsrc-2006Q3]: Makefile Makefile.php distinfo
 Added Files:
 	pkgsrc/lang/php5/patches [pkgsrc-2006Q3]: patch-aa patch-ab
 	pkgsrc/www/php4/patches [pkgsrc-2006Q3]: patch-au

 Log Message:
 Pullup ticket 1889 - requested by adrianp
 security fix for php

 Revisions pulled up:
 - pkgsrc/lang/php5/Makefile			1.44-1.45
 - pkgsrc/lang/php5/Makefile.php			1.20
 - pkgsrc/lang/php5/distinfo			1.30
 - pkgsrc/lang/php5/patches/patch-aa		1.1
 - pkgsrc/lang/php5/patches/patch-ab		1.2
 - pkgsrc/lang/www/ap-php/Makefile		1.12
 - pkgsrc/lang/www/php4/Makefile			1.71-1.72
 - pkgsrc/lang/www/php4/Makefile.php		1.36
 - pkgsrc/lang/www/php4/distinfo			1.58
 - pkgsrc/lang/www/php4/patches/patch-au		1.3

    Module Name:	pkgsrc
    Committed By:	jdolecek
    Date:		Fri Oct 20 22:10:34 UTC 2006

    Modified Files:
 	pkgsrc/lang/php5: Makefile Makefile.php
 	pkgsrc/www/ap-php: Makefile
 	pkgsrc/www/php4: Makefile Makefile.php

    Log Message:
    remove --enable-memory-limit - 8MB is too low, and this just
    duplicates process resource limits, which already provide necessary
    "safety net" protection against rogue scripts

    bump PKGREVISION for this

    adressess PR pkg/32007 by "pancake"

    also remove --enable-track-vars, since that configure argument
    is long gone from PHP
 ---
    Module Name:	pkgsrc
    Committed By:	adrianp
    Date:		Sun Oct 22 13:16:42 UTC 2006

    Modified Files:
 	pkgsrc/www/php4: Makefile distinfo
    Added Files:
 	pkgsrc/www/php4/patches: patch-au

    Log Message:
    Fix for CVE-2006-4625
    Bump nb
 ---
    Module Name:	pkgsrc
    Committed By:	adrianp
    Date:		Sun Oct 22 13:19:19 UTC 2006

    Modified Files:
 	pkgsrc/lang/php5: Makefile distinfo
    Added Files:
 	pkgsrc/lang/php5/patches: patch-aa patch-ab

    Log Message:
    Fixes for CVE-2006-4812 and CVE-2006-4625
    Bump nb


 To generate a diff of this commit:
 cvs rdiff -r1.43 -r1.43.2.1 pkgsrc/lang/php5/Makefile
 cvs rdiff -r1.19 -r1.19.4.1 pkgsrc/lang/php5/Makefile.php
 cvs rdiff -r1.29 -r1.29.2.1 pkgsrc/lang/php5/distinfo
 cvs rdiff -r0 -r1.1.2.1 pkgsrc/lang/php5/patches/patch-aa \
     pkgsrc/lang/php5/patches/patch-ab
 cvs rdiff -r1.11 -r1.11.2.1 pkgsrc/www/ap-php/Makefile
 cvs rdiff -r1.70 -r1.70.2.1 pkgsrc/www/php4/Makefile
 cvs rdiff -r1.35 -r1.35.8.1 pkgsrc/www/php4/Makefile.php
 cvs rdiff -r1.57 -r1.57.2.1 pkgsrc/www/php4/distinfo
 cvs rdiff -r0 -r1.2.2.1 pkgsrc/www/php4/patches/patch-au

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.