aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2016-08-26 22:40:27 +0200
committerFlorian Weimer <fweimer@redhat.com>2016-08-26 23:20:41 +0200
commitef4f97648dc95849e417dd3e6328165de4c22185 (patch)
tree8d250b1f15efcb2d718939c8d75d732efa8e70c2 /sysdeps
parent21e79af4cf72429f98480fa34912a4ce236b09a0 (diff)
downloadglibc-ef4f97648dc95849e417dd3e6328165de4c22185.tar
glibc-ef4f97648dc95849e417dd3e6328165de4c22185.tar.gz
glibc-ef4f97648dc95849e417dd3e6328165de4c22185.tar.bz2
glibc-ef4f97648dc95849e417dd3e6328165de4c22185.zip
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.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/mach/hurd/fork.c6
-rw-r--r--sysdeps/nptl/fork.c6
2 files changed, 6 insertions, 6 deletions
diff --git a/sysdeps/mach/hurd/fork.c b/sysdeps/mach/hurd/fork.c
index 2e8b59e7c0..9973b1bb9e 100644
--- a/sysdeps/mach/hurd/fork.c
+++ b/sysdeps/mach/hurd/fork.c
@@ -112,7 +112,7 @@ __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);
/* Lock things that want to be locked before we fork. */
{
@@ -612,7 +612,7 @@ __fork (void)
}
/* Release malloc locks. */
- __malloc_fork_unlock_parent ();
+ call_function_static_weak (__malloc_fork_unlock_parent);
/* Run things that want to run in the parent to restore it to
normality. Usually prepare hooks and parent hooks are
@@ -666,7 +666,7 @@ __fork (void)
__sigemptyset (&_hurdsig_traced);
/* Release malloc locks. */
- __malloc_fork_unlock_child ();
+ call_function_static_weak (__malloc_fork_unlock_child);
/* Run things that want to run in the child task to set up. */
RUN_HOOK (_hurd_fork_child_hook, ());
diff --git a/sysdeps/nptl/fork.c b/sysdeps/nptl/fork.c
index 616d897a36..ea135f8e18 100644
--- a/sysdeps/nptl/fork.c
+++ b/sysdeps/nptl/fork.c
@@ -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 ();