Bug #63595 [Com]: GMP memory management conflicts with other libraries using GMP

From: Date: Sat, 11 Oct 2014 09:51:53 +0000
Subject: Bug #63595 [Com]: GMP memory management conflicts with other libraries using GMP
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188023@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=63595&edit=1 ID: 63595 Comment by: nikic@php.net Reported by: arekm at maven dot pl Summary: GMP memory management conflicts with other libraries using GMP Status: Open Type: Bug Package: GNU MP related PHP Version: 5.3.19 Block user comment: N Private report: N New Comment: Before going with ugly solutions like switching the allocator in every single function, could we please try the approach of a) resetting memory allocators in MSHUTDOWN b) setting memory allocators in RINIT and resetting in RSHUTDOWN. I'd much prefer this to happen on every request regardless of GMP usage than for every single GMP function call. Previous Comments: ------------------------------------------------------------------------ [2014-10-11 06:50:32] remi@php.net The following patch has been added/updated: Patch Name: gmp-memory.patch Revision: 1413010232 URL: https://bugs.php.net/patch-display.php?bug=63595&patch=gmp-memory.patch&revision=1413010232 ------------------------------------------------------------------------ [2014-10-11 06:16:36] remi@php.net The following patch has been added/updated: Patch Name: gmp-memory.patch Revision: 1413008196 URL: https://bugs.php.net/patch-display.php?bug=63595&patch=gmp-memory.patch&revision=1413008196 ------------------------------------------------------------------------ [2014-10-10 23:43:24] rasmus@php.net ext/gmp calls mp_set_memory_functions() in the MINIT hook so it should be fine for any PHP extensions that might use it. I don't see how a curl ssl call from PHP would end up having a problem. However, I can see the cases Remi mentioned where non-php things like mod_gnutls gets in the mix. Might have to set it back in RSHUTDOWN, but I would hate having to do that. Anything in the per-request hooks end up getting called on every request regardless of whether anything used anything from gmp on that request. The other option would be to yank it from MINIT and do it for every gmp operation/object. ------------------------------------------------------------------------ [2014-10-10 08:39:10] remi@php.net Another backtrace (php + odbc + freetds) (gdb) bt #0 0x0000555555798a78 in _zend_mm_free_int () #1 0x00007fffe6ace02a in mp_clear_multi () from /lib64/libgnutls.so.28 #2 0x00007fffe6acf64a in ecc_del_point () from /lib64/libgnutls.so.28 #3 0x00007fffe6acec9a in ecc_wmnaf_cache_free () from /lib64/libgnutls.so.28 #4 0x00007fffe6a382c1 in gnutls_global_deinit () from /lib64/libgnutls.so.28 #5 0x00007ffff7debb7a in _dl_fini () from /lib64/ld-linux-x86-64.so.2 #6 0x00007ffff472be59 in __run_exit_handlers () from /lib64/libc.so.6 #7 0x00007ffff472bea5 in exit () from /lib64/libc.so.6 #8 0x0000555555619ffa in main () ------------------------------------------------------------------------ [2014-10-10 08:30:30] remi@php.net Some other cases: Apache HTTP + mod_php + mod_gnutls => segfaults PHP + odbc + freetds (use gnutls) => segfaults ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=63595 -- Edit this bug report at https://bugs.php.net/bug.php?id=63595&edit=1

« previous php.bugs (#188023) next »