nwrap: Don't do a deep bind if we run with libasan
authorAndreas Schneider <asn@samba.org>
Sat, 1 Sep 2018 17:41:46 +0000 (19:41 +0200)
committerAndreas Schneider <asn@samba.org>
Tue, 30 Oct 2018 19:49:13 +0000 (20:49 +0100)
Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
src/nss_wrapper.c

index 1150ebae8175cfeee024ce2014f41832588dc413..dd16fe6d554ad881fc3f539af588c99e4d2b9db1 100644 (file)
@@ -846,7 +846,15 @@ static void *nwrap_load_lib_handle(enum nwrap_lib lib)
        int i;
 
 #ifdef RTLD_DEEPBIND
-       flags |= RTLD_DEEPBIND;
+       const char *env = getenv("LD_PRELOAD");
+
+       /* Don't do a deepbind if we run with libasan */
+       if (env != NULL && strlen(env) < 1024) {
+               const char *p = strstr(env, "libasan.so");
+               if (p == NULL) {
+                       flags |= RTLD_DEEPBIND;
+               }
+       }
 #endif
 
        switch (lib) {