1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-01 10:06:57 +03:00

malloc: Simplify static malloc interposition [BZ #20432]

Existing interposed mallocs do not define the glibc-internal
fork callbacks (and they should not), so statically interposed
mallocs lead to link failures because the strong reference from
fork pulls in glibc's malloc, resulting in multiple definitions
of malloc-related symbols.
This commit is contained in:
Florian Weimer
2016-08-26 22:40:27 +02:00
parent 21e79af4cf
commit ef4f97648d
15 changed files with 706 additions and 160 deletions

View File

@ -128,7 +128,7 @@ __libc_fork (void)
handlers may use malloc, and the libio list lock has an
indirect malloc dependency as well (via the getdelim
function). */
__malloc_fork_lock_parent ();
call_function_static_weak (__malloc_fork_lock_parent);
}
#ifndef NDEBUG
@ -192,7 +192,7 @@ __libc_fork (void)
if (multiple_threads)
{
/* Release malloc locks. */
__malloc_fork_unlock_child ();
call_function_static_weak (__malloc_fork_unlock_child);
/* Reset the file list. These are recursive mutexes. */
fresetlockfiles ();
@ -240,7 +240,7 @@ __libc_fork (void)
if (multiple_threads)
{
/* Release malloc locks, parent process variant. */
__malloc_fork_unlock_parent ();
call_function_static_weak (__malloc_fork_unlock_parent);
/* We execute this even if the 'fork' call failed. */
_IO_list_unlock ();