Bug 139189

Summary: lang/php5: Update of PHP-5.2.10 to 5.2.11 breaks CLI and FastCGI
Product: Ports & Packages Reporter: Michael Powell <nightrecon>
Component: Individual Port(s)Assignee: Alex Dupre <ale>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Michael Powell 2009-09-27 16:30:01 UTC
A portupgrade -a of PHP-5.2.10 to 5.2.11 can cause CLI and FastCGI PHP breakage. This entails building with previously established and working make config options. Simply executing php -v at a prompt will return this error:

Sep 26 12:15:42 testbed suhosin[48982]: ALERT - canary mismatch on efree() - heap overflow detected (attacker 'REMOTE_ADDR not set', file 'unknown') 

At first it appears to be a problem with the Suhosin patch, as rebuilding PHP without Suhosin seems to fix the problem. Upon further investigation the problem is actually a clash between the Suhosin patch and the Mailhead patch. 

Note the Suhosin patch is suhosin-patch-5.2.11-0.9.7.patch.gz while the Mailheader patch is php-5.2.10-mail-header.patch. Since the default config has the Mailheader patch switched "off" in the Makefile, this will not normally produce this error.

This occurred as I had previously selected both options in previous builds. Both Apache and lighttpd web servers are running PHP as FastCGI with mod_fcgid, so it is unknown if this also affects mod_php5.

Fix: 

Build PHP without the Mailheader patch, which is the default. Do not build with Suhosin and Mailheader both enabled.

Possibly consider removing the mailheader patch from the Makefile until such time as the two can be utilized together as in the past.
How-To-Repeat: When performing a "make config" in lang/php5 if both Suhosin and Mailheader options are chosen this will produce the problem, in addition to the CLI, CGI, and FastCGI options.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2009-09-27 17:06:42 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ale

Fix synopsis and assign.
Comment 2 Alex Dupre freebsd_committer freebsd_triage 2009-09-30 21:40:31 UTC
State Changed
From-To: open->feedback

Unable to reproduce. Nothing changed from previous versions.
Comment 3 rainer 2009-10-01 11:36:05 UTC
(app1-bla <~>) 0 # /usr/local/bin/php /usr/local/www/data/phpinfo.php
Segmentation fault: 11

FreeBSD app1-bla 7.2-RELEASE-p3 FreeBSD 7.2-RELEASE-p3 #0: Wed Sep 23
11:29:14 CEST 2009     root@app1-bla:/usr/obj/usr/src/sys/GENERIC  amd64

(app1-bla <~>) 0 # cat /var/db/ports/php5/options
# This file is auto-generated by 'make config'.
# No user-servicable parts inside!
# Options for php5-5.2.4_1
_OPTIONS_READ=php5-5.2.4_1
WITH_CLI=true
WITHOUT_CGI=true
WITH_APACHE=true
WITHOUT_DEBUG=true
WITHOUT_SUHOSIN=true
WITH_MULTIBYTE=true
WITH_IPV6=true
WITH_MAILHEAD=true
WITHOUT_REDIRECT=true
WITHOUT_DISCARD=true
WITHOUT_FASTCGI=true
WITHOUT_PATHINFO=true
(app1-bla <~>) 0 # pkg_info |grep php5-5
php5-5.2.11         PHP Scripting Language

There's a new version of the mailheader-patch available - but I still
got SIGSEGV when running phpinfo().

I tried disabling the COPTFLAGS= -O -pipe
that I have on this server, but it still SIGSEGVed.

Then, I re-ran make config on devel/php5 and it showed the
mailheader-patch and suhosin disabled.
(The /var/db/ports directory was copied over from another server)
I re-enabled everything I needed to have enabled as options, portupgrade
-f 'ed php-5 and all the extensions - and at least, now 
/usr/local/bin/php /usr/local/www/data/phpinfo.php gives a meaningfull
output.

I had to reinstall two pecl-extensions, because the php5-extensions port
(or portupgrade) seemed unable to recognize them and try to install them
again (which failed).


Anyway, hope this is of help.


Best Regards,
Rainer
Comment 4 Alex Dupre freebsd_committer freebsd_triage 2009-10-22 14:44:16 UTC
State Changed
From-To: feedback->closed

No more an issue.