Skip to content

Commit 06ce602

Browse files
committed
Instrumentation to make ASAN reports work
Add RTLD_NODELETE to dlopen() flags in ASAN builds to allow ASAN resolve symbols and report memleaks. This also suppresses some false positives.
1 parent 694d6ca commit 06ce602

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

wsrep_loader.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,14 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb)
165165
return ret;
166166
}
167167

168-
if (!(dlh = dlopen(spec, RTLD_NOW | RTLD_LOCAL))) {
168+
int open_flags = RTLD_NOW | RTLD_LOCAL;
169+
#ifdef __SANITIZE_ADDRESS__
170+
/* Keep the shared object to allow ASAN resolve symbols and report
171+
* memleaks. This also suppresses some false positives. */
172+
open_flags |= RTLD_NODELETE;
173+
#endif /* __SANITIZE_ADDRESS__ */
174+
175+
if (!(dlh = dlopen(spec, open_flags))) {
169176
snprintf(msg, msg_len, "wsrep_load(): dlopen(): %s", dlerror());
170177
logger (WSREP_LOG_ERROR, msg);
171178
ret = EINVAL;

0 commit comments

Comments
 (0)