From 326e9f8cd33aeac5d4010910cd32f98b7365bdb7 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Sat, 1 Sep 2018 19:36:19 +0200 Subject: swrap: Don't do a deep bind if we run with libasan Signed-off-by: Andreas Schneider Reviewed-by: Ralph Boehme --- src/socket_wrapper.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c index 3f027dc..0f19b95 100644 --- a/src/socket_wrapper.c +++ b/src/socket_wrapper.c @@ -558,7 +558,15 @@ static void *swrap_load_lib_handle(enum swrap_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) { -- cgit