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

Segmentation fault @ zval_ptr_dtor(&arg_list); #5

Open
hnsl opened this issue Nov 9, 2011 · 5 comments
Open

Segmentation fault @ zval_ptr_dtor(&arg_list); #5

hnsl opened this issue Nov 9, 2011 · 5 comments

Comments

@hnsl
Copy link

hnsl commented Nov 9, 2011

I get a segmentation fault at line

zval_ptr_dtor(&arg_list);

in function

PHP_FUSE_API int php_fuse_getdir(const char * path, fuse_dirh_t dh, fuse_dirfil_t df) 

From gdb:

Program received signal SIGSEGV, Segmentation fault.
0x00000000006839d7 in _zval_ptr_dtor ()
(gdb) backtrace
#0  0x00000000006839d7 in _zval_ptr_dtor ()
#1  0x000000000069f6c3 in zend_hash_destroy ()
#2  0x000000000069132f in _zval_dtor_func ()
#3  0x0000000000683a12 in _zval_ptr_dtor ()
#4  0x000000000069f6c3 in zend_hash_destroy ()
#5  0x000000000069132f in _zval_dtor_func ()
#6  0x0000000000683a12 in _zval_ptr_dtor ()
#7  0x00007f942a8438fa in php_fuse_getdir (path=<value optimized out>, dh=0x7fff30f029e0, df=0x7f942a60f3f0)

Could it be some obvious mistake? I'm not a PHP extension ninja so I can't look for obvious mistakes etc. Does this signify something special?

@hnsl
Copy link
Author

hnsl commented Nov 9, 2011

The segfault is reproducible. If I comment out the

df(dh, r == HASH_KEY_IS_LONG ? buf : tmp_s_key, type, ino);

line there doesn't seem to be a segfault so I'm wondering if this is a problem with the buffer passed to fuse via df().

@hnsl
Copy link
Author

hnsl commented Nov 9, 2011

This issue disappeared after I disabled the xdebug extension. Xdebug doesn't seem to be compatible with this extension which doesn't surprise me as this extension is very advanced and xdebug is very intrusive.

@hnsl hnsl closed this as completed Nov 9, 2011
@hnsl hnsl reopened this Nov 10, 2011
@hnsl
Copy link
Author

hnsl commented Nov 10, 2011

The segmentation fault is back and I still have xdebug disabled. It's in the same function and reproducible/deterministic. What causes it is listing directories in certain ways. It would be nice if you could take a look at php_fuse_getdir() again and see if you find any obvious mistakes...

@hnsl
Copy link
Author

hnsl commented Nov 10, 2011

Here's a more precise backtrace:

#0  gc_remove_zval_from_buffer (zv=0x334c020) at /build/buildd/php5-5.3.5/Zend/zend_gc.h:189
#1  0x0000000000683a04 in _zval_ptr_dtor (zval_ptr=0x33e2be8) at /build/buildd/php5-5.3.5/Zend/zend_execute_API.c:442
#2  0x000000000069f6c3 in zend_hash_destroy (ht=0x33e2b30) at /build/buildd/php5-5.3.5/Zend/zend_hash.c:729
#3  0x000000000069132f in _zval_dtor_func (zvalue=0x334bff0) at /build/buildd/php5-5.3.5/Zend/zend_variables.c:46
#4  0x0000000000683a12 in _zval_ptr_dtor (zval_ptr=0x33e2ca8) at /build/buildd/php5-5.3.5/Zend/zend_variables.h:35
#5  0x000000000069f6c3 in zend_hash_destroy (ht=0x33496a0) at /build/buildd/php5-5.3.5/Zend/zend_hash.c:729
#6  0x000000000069132f in _zval_dtor_func (zvalue=0x334b450) at /build/buildd/php5-5.3.5/Zend/zend_variables.c:46
#7  0x0000000000683a12 in _zval_ptr_dtor (zval_ptr=0x7fff01853588) at /build/buildd/php5-5.3.5/Zend/zend_variables.h:35
#8  0x00007f6ee90078fa in php_fuse_getdir (path=<value optimized out>, dh=0x7fff01853a00, df=0x7f6ee8dd33f0) at fujimoto-php-fuse/fuse.c:415

@hnsl
Copy link
Author

hnsl commented Nov 10, 2011

I made 3 changes: removed "convert_to_array_ex(entry);" and the "zval_ptr_dtor(tmp_type);" and "zval_ptr_dtor(tmp_ino);".

I can no longer seem to reproduce the segfault although it's possible that it's a coincidence. What do you think might cause this?

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

No branches or pull requests

1 participant