Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

php-5.5.8 Segmentation fault xhprof.c #33

Closed
wants to merge 7 commits into from

Conversation

kovalenko
Copy link

php-5.5.8 Segmentation fault
details:
(gdb) f 0
#0 hp_execute_internal (execute_data=0x7fffffffa600, fci=0x7fffffffa780, ret=1) at /opt/xhprof/extension/xhprof.c:1708

1708 temp_variable *retvar = &EX_T(opline->result.var);
(gdb) print opline
$1 = (zend_op *) 0x0

oliworx and others added 7 commits April 10, 2013 12:14
call graph: changed color of arrows/edges to grey for better 
readability of the labels
fixes PR phacility#20 when using randomly generated run ids
call graph: changed color of arrows/edges to grey for readability
php-5.5.8 Segmentation fault
details:
(gdb) f 0
#0  hp_execute_internal (execute_data=0x7fffffffa600, fci=0x7fffffffa780, ret=1) at /opt/xhprof/extension/xhprof.c:1708
1708	    temp_variable *retvar = &EX_T(opline->result.var);
(gdb) 
#0  hp_execute_internal (execute_data=0x7fffffffa600, fci=0x7fffffffa780, ret=1) at /opt/xhprof/extension/xhprof.c:1708
1708	    temp_variable *retvar = &EX_T(opline->result.var);
(gdb) print opline
$1 = (zend_op *) 0x0
@bitraft
Copy link

bitraft commented Jan 21, 2014

this patch working on my mac osx 10.8 with php55.

@PHPGangsta
Copy link

I also have this segmentation fault, in exactly the same line 1708

I'm using PHP 5.5.3-1ubuntu2.1 from current Ubuntu 13.10

I would be nice if it could be merged and a new PECL package could be released.

(gdb) bt
#0 hp_execute_internal (execute_data=0x7fffb5ed7bd0, fci=0x7fffb5ed7d50, ret=1) at /tmp/pear/temp/xhprof/extension/xhprof.c:1708
#1 0x00007f73e727c34b in zend_call_function () from /usr/lib/apache2/modules/libphp5.so
#2 0x00007f73e727ca2c in zend_lookup_class_ex () from /usr/lib/apache2/modules/libphp5.so
#3 0x00007f73e727d192 in zend_fetch_class_by_name () from /usr/lib/apache2/modules/libphp5.so
#4 0x00007f73e72c1a09 in ?? () from /usr/lib/apache2/modules/libphp5.so
#5 0x00007f73e72b3988 in execute_ex () from /usr/lib/apache2/modules/libphp5.so
#6 0x00007f73da64dec0 in hp_execute_ex (execute_data=0x7f73ec383120) at /tmp/pear/temp/xhprof/extension/xhprof.c:1664
......

@cabello
Copy link

cabello commented Feb 21, 2014

We just applied this patch and built our xhprof package, this one is working well for us. Many thanks!

@epriestley
Copy link
Member

I hit what is presumably the same issue (consistent segfault under PHP 5.5.8 on OS X); this also fixed it for me.

@billf
Copy link
Contributor

billf commented Apr 7, 2014

@kovalenko can you sign the contributor agreement at https://code.facebook.com/cla

@wimleers
Copy link

Does anybody know how to contact @kovalenko, so that this PR gets unblocked?

@epriestley
Copy link
Member

I've generated a similar patch here:

https://secure.phabricator.com/D10374
https://secure.phabricator.com/D10375

These don't have a CLA issue and should land once they're reviewed.

@epriestley epriestley closed this Aug 27, 2014
epriestley pushed a commit that referenced this pull request Aug 28, 2014
Summary:
This adds a failing test case for the bug discussed in <#33>.

It also adds a `bin/xhprofile` script which makes it easier to test stuff like this, by invoking the profiler on some other script. This isn't hugely useful in production but is valuable diagnostically, and helped me reduce this test case.

Test Plan:
  - Ran `arc unit` and got a failure.
  - Verified that this test passes if `class_exists()` is commented out (which makes the test not segfault).

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D10374
epriestley pushed a commit that referenced this pull request Aug 28, 2014
Summary:
Fixes <#33>. Since the issue with that patch was CLA, I developed this independently.

This works because it just inlines the body of `execute_internal()`, which is nearly identical:

```
ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, zend_fcall_info *fci, int return_value_used TSRMLS_DC)
{
	if(fci != NULL) {
		((zend_internal_function *) execute_data_ptr->function_state.function)->handler(fci->param_count,
				*fci->retval_ptr_ptr, fci->retval_ptr_ptr, fci->object_ptr, 1 TSRMLS_CC);

	} else {
		zval **return_value_ptr = &EX_TMP_VAR(execute_data_ptr, execute_data_ptr->opline->result.var)->var.ptr;
		((zend_internal_function *) execute_data_ptr->function_state.function)->handler(execute_data_ptr->opline->extended_value, *return_value_ptr,
					(execute_data_ptr->function_state.function->common.fn_flags & ZEND_ACC_RETURN_REFERENCE)?return_value_ptr:NULL,
					execute_data_ptr->object, return_value_used TSRMLS_CC);
	}
}
```

Test Plan: Failing test now passes. No more segfaults on PHP 5.5.8.

Reviewers: btrahan

Reviewed By: btrahan

Subscribers: epriestley

Differential Revision: https://secure.phabricator.com/D10375
@LionsAd LionsAd mentioned this pull request Nov 6, 2015
@Minasu Minasu mentioned this pull request Jun 20, 2016
yazshel pushed a commit to FluentDevelopment/xhprof that referenced this pull request Dec 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants