Dan Williams: mdmon: prevent allocations due to late binding

Martin F. Krafft madduck at alioth.debian.org
Sun Aug 29 11:55:32 UTC 2010


Module: mdadm
Branch: upstream
Commit: 23eb475a96b1b0cf7f8feaeb7b32355b80e8faa7
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=23eb475a96b1b0cf7f8feaeb7b32355b80e8faa7

Author: Dan Williams <dan.j.williams at intel.com>
Date:   Thu Jul  1 17:28:14 2010 -0700

mdmon: prevent allocations due to late binding

Current versions of glibc do not provide a useable interface to clone(2) as it
inflicts hidden dependencies on setting up a glibc specific tls
descriptor.  The dynamic linker trips this dependency and causes mdmon
to intermittently fail to load.  Resolving all dynamic linking prior to
starting the monitor thread appears to mitigate the issue but there is no
guarantee that another tls dependency will bite us later.

However, while the debate continues with the glibc maintainers it seems
prudent to keep this change.  It ensures that we do not get into a
situation where the monitor thread needs to make a late allocation to
resolve a symbol.

Signed-off-by: Dan Williams <dan.j.williams at intel.com>

---

 Makefile |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
index 3af1665..237f4fc 100644
--- a/Makefile
+++ b/Makefile
@@ -157,8 +157,9 @@ mdadm.O2 : $(SRCS) mdadm.h mdmon.O2
 mdmon.O2 : $(MON_SRCS) mdadm.h mdmon.h
 	$(CC) -o mdmon.O2 $(CFLAGS)  -DHAVE_STDINT_H -O2 -D_FORTIFY_SOURCE=2 $(MON_SRCS)
 
+# use '-z now' to guarantee no dynamic linker interactions with the monitor thread
 mdmon : $(MON_OBJS)
-	$(CC) $(LDFLAGS) -o mdmon $(MON_OBJS) $(LDLIBS)
+	$(CC) $(LDFLAGS) -z now -o mdmon $(MON_OBJS) $(LDLIBS)
 msg.o: msg.c msg.h
 
 test_stripe : restripe.c mdadm.h




More information about the pkg-mdadm-commits mailing list