Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use DEEPBIND flag when loading external modules using dlopen #1703

Merged
merged 4 commits into from
Feb 10, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -12274,7 +12274,18 @@ int moduleLoad(const char *path, void **module_argv, int module_argc, int is_loa
}
}

handle = dlopen(path, RTLD_NOW | RTLD_LOCAL);
int dlopen_flags = RTLD_NOW | RTLD_LOCAL;
#if (defined(__linux__) || defined(__FreeBSD__)) && !defined(__SANITIZE_ADDRESS__)
/* RTLD_DEEPBIND, which is required for loading modules that contains the
* same symbols, does not work with ASAN. Therefore, we exclude
* RTLD_DEEPBIND when doing test builds with ASAN.
* See https://github.com/google/sanitizers/issues/611 for more details.
*
* This flag is also currently only available in Linux and FreeBSD. */
dlopen_flags |= RTLD_DEEPBIND;
#endif

handle = dlopen(path, dlopen_flags);
if (handle == NULL) {
serverLog(LL_WARNING, "Module %s failed to load: %s", path, dlerror());
return C_ERR;
Expand Down
Loading