mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-30 10:50:11 +01:00
libnm-core: don't use RTLD_DEEPBIND when building with asan
The address sanitizer is not compatible [1] with libraries dynamically opened using RTLD_DEEPBIND: disable the flag when building with asan. [1] https://github.com/google/sanitizers/issues/611
This commit is contained in:
parent
0af2762cbf
commit
936e0a51fe
2 changed files with 9 additions and 1 deletions
|
|
@ -1148,6 +1148,7 @@ if test "$with_address_sanitizer" = yes -o "$with_address_sanitizer" = "exec"; t
|
|||
|
||||
sanitizer_exec_cflags="$sanitizer_exec_cflags -fsanitize=address"
|
||||
sanitizer_exec_ldflags="$sanitizer_exec_ldflags -Wc,-fsanitize=address"
|
||||
AC_DEFINE(ASAN_BUILD, 1, [Whether NM is built with address sanitizer])
|
||||
|
||||
if test "$with_address_sanitizer" = "yes"; then
|
||||
sanitizer_lib_cflags="$sanitizer_lib_cflags -fsanitize=address"
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ nm_jansson_load (void)
|
|||
MISSING,
|
||||
} state = UNKNOWN;
|
||||
void *handle;
|
||||
int mode;
|
||||
|
||||
if (G_LIKELY (state != UNKNOWN))
|
||||
goto out;
|
||||
|
|
@ -102,7 +103,13 @@ nm_jansson_load (void)
|
|||
if (!bind_symbols (RTLD_DEFAULT))
|
||||
goto out;
|
||||
|
||||
handle = dlopen (JANSSON_SONAME, RTLD_LAZY | RTLD_LOCAL | RTLD_NODELETE | RTLD_DEEPBIND);
|
||||
mode = RTLD_LAZY | RTLD_LOCAL | RTLD_NODELETE | RTLD_DEEPBIND;
|
||||
#if defined (ASAN_BUILD)
|
||||
/* Address sanitizer is incompatible with RTLD_DEEPBIND. */
|
||||
mode &= ~RTLD_DEEPBIND;
|
||||
#endif
|
||||
handle = dlopen (JANSSON_SONAME, mode);
|
||||
|
||||
if (!handle)
|
||||
goto out;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue