Bug #63595 [Asn->Csd]: GMP memory management conflicts with other libraries using GMP

From: Date: Mon, 27 Oct 2014 06:54:09 +0000
Subject: Bug #63595 [Asn->Csd]: GMP memory management conflicts with other libraries using GMP
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188316@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
 Updated by:         remi@php.net
 Reported by:        arekm at maven dot pl
 Summary:            GMP memory management conflicts with other libraries
                     using GMP
-Status:             Assigned
+Status:             Closed
 Type:               Bug
 Package:            GNU MP related
 PHP Version:        5.3.19
 Assigned To:        remi
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3c925b18fa96043e5d7e86f9ce544b143c3c2079
Log: Fix bug #63595 GMP memory management conflicts with other libraries using GMP


Previous Comments:
------------------------------------------------------------------------
[2014-10-18 08:06:38] stas@php.net

The big problem is that nobody guarantees us gnutls GMP object lifetimes would match PHP request
lifetime. They could allocate something outside the request and free inside, or vice versa.

------------------------------------------------------------------------
[2014-10-14 07:30:38] remi@php.net

Problem with having the PHP allocator set globally during all the request, is that it will be used
by other libraries (ex freetds or zarafa/mapi), and then the free (during exit / 
gnutls_global_deinit) will segfault:
- using php efree as the php memory allocator is already shutdown
- using standard free as the php was not allocated using malloc

------------------------------------------------------------------------
[2014-10-11 09:51:51] nikic@php.net

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.

------------------------------------------------------------------------
[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

------------------------------------------------------------------------


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


Thread (10 messages)

« previous php.bugs (#188316) next »