Segmentation faults and unable to load EE pages
Posted: 14 June 2010 11:26 AM   [ Ignore ]  
Summer Student
Total Posts:  6
Joined  01-28-2010

This question may be related to a resolved thread.

I have the paid ExpressionEngine 2.0 Beta.

After install I am unable to navigate to /system/index.php file.

A segmentation fault occurs, “child pid #### exit signal Segmentation fault (11)”, and the browser fails to load the page. Firefox attempts to download index.php file. Safari issues an error saying “Safari can’t open the page because the server unexpectedly dropped the connection.”

I am running Ubuntu Linux VM’s for development. I have reproduced this on Ubuntu 9.10 and 10.4 x64 server editions.

My coworker has an OSX/Apache/PHP/MySQL stack that works. I also have a Windows/Apache/PHP/MySQL stack that works. Our client’s production server is running some form of Linux without any issues either.

I can’t for the life of me find any Apache or PHP configuration differences that would affect this. I am sure I am missing something subtle but have been unsuccessful in diagnosing. I realize this may not be an EE issue at all but a server configuration issue. I would at least like to try my luck here first.

If need be I can try to expose the VM to the internet and give SSH access to an EE dev.

I am attaching my VM’s phpinfo() dump in a zip file.

File Attachments
info.php.html.zip  (File Size: 10KB - Downloads: 50)
Profile
 
 
Posted: 14 June 2010 11:44 AM   [ Ignore ]   [ # 1 ]  
Summer Student
Total Posts:  6
Joined  01-28-2010

Here is the phpinfo() dump from the production server. They run CentOS. I removed the hostname references.

File Attachments
info.php.centos.htm.zip  (File Size: 9KB - Downloads: 88)
Profile
 
 
Posted: 14 June 2010 02:09 PM   [ Ignore ]   [ # 2 ]  
Chancellor's Fellow
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33338
Joined  05-15-2004

I am afraid, yes, “Segmentation fault” is most definitely a server issue and consequently not something that we can assist you with. Are you your own server admin, as it were? There should be more info in the log files.

Profile
MSG
 
 
Posted: 14 June 2010 06:34 PM   [ Ignore ]   [ # 3 ]  
Summer Student
Total Posts:  6
Joined  01-28-2010

I’ve managed to fix my issue. I am going to convey the entirety of my findings.

Attached is the problematic call stack in image form. The line I am broke on in the debugger is the one with the issue. This code is obfuscated, I suppose you have your reasons. Here is an unmodified snippet from line 162 in EE_Config.php.

$echo 'ba'.'se'.'6'.'4'.'_d'.'ec'.'ode';
eval($echo('aWYgKElTX0ZSRUVMQU5DRVIpeyRzaXRlX2lkPTE7fQ='.'='))

The decoded string is equivalent the following

if (IS_FREELANCER){$site_id=1;

This decoded string doesn’t seem to matter to reproduce this with my setup.


Here are a series of tests I did and their results.


Does NOT work: Change $echo to another name in case of confusion with echo keyword.

$aaa 'ba'.'se'.'6'.'4'.'_d'.'ec'.'ode';
eval($aaa('aWYgKElTX0ZSRUVMQU5DRVIpeyRzaXRlX2lkPTE7fQ='.'='))

Does NOT work: Remove inline string concatenation on both lines.

$echo 'base64_decode';
eval($echo('aWYgKElTX0ZSRUVMQU5DRVIpeyRzaXRlX2lkPTE7fQ=='))

Works: decode into a local variable first.

$echo 'ba'.'se'.'6'.'4'.'_d'.'ec'.'ode';
$decoded $echo('aWYgKElTX0ZSRUVMQU5DRVIpeyRzaXRlX2lkPTE7fQ='.'=');
eval($decoded)

Works: Eval manually decoded string.

$echo 'ba'.'se'.'6'.'4'.'_d'.'ec'.'ode';
eval(
'if (IS_FREELANCER){$site_id=1;}')

It appears there is some issue with eval() on the results of a variable function (http://php.net/manual/en/functions.variable-functions.php).

If you want to make changes to this in your code base is up to you, but I wanted to make you aware at least.

Should I forward this on to the PHP team as a bug for them?

Image Attachments
callstack.png
Click thumbnail to see full-size image
Profile
 
 
Posted: 14 June 2010 07:33 PM   [ Ignore ]   [ # 4 ]  
Moderator
Avatar
RankRankRankRankRankRank
Total Posts:  6665
Joined  09-23-2009

Thanks for the detailed information, agoodreau. Filing a PHP bug is always worth a shot, though you’ve got a lot of variables going on there including Suhosin (Hardened-PHP) which might be a contributing factor. Nevertheless, a PHP script shouldn’t be able to bring down the host, for sure.

 Signature 
Profile
MSG
 
 
Posted: 15 June 2010 02:22 PM   [ Ignore ]   [ # 5 ]  
Summer Student
Total Posts:  6
Joined  01-28-2010

This issue was tracked down to a problem with the xdebug PHP extension.

I filed:
https://bugs.launchpad.net/ubuntu/+source/php5/+bug/594696
http://bugs.xdebug.org/view.php?id=586

Profile
 
 
Posted: 15 June 2010 02:38 PM   [ Ignore ]   [ # 6 ]  
Chancellor's Fellow
Avatar
RankRankRankRankRankRankRankRank
Total Posts:  33338
Joined  05-15-2004

Thanks for getting back to us, we appreciate it. Marking this one as “Resolved” for now, please don’t hesitate to post again as needed.

Profile
MSG