From 1500935d1ce4ec2b868bf6e3240d8fe95e68ffeb Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Tue, 20 Apr 2021 23:48:34 +0000 Subject: [PATCH] docs: Add note for RTLD_DEEPBING flag w sanitizers --- runtime/src/module.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/runtime/src/module.c b/runtime/src/module.c index 02bdcb9..423c0e8 100644 --- a/runtime/src/module.c +++ b/runtime/src/module.c @@ -149,10 +149,11 @@ module_new(char *name, char *path, int32_t argument_count, uint32_t stack_size, atomic_init(&module->reference_count, 0); - /* Load the dynamic library *.so file with lazy function call binding and deep binding */ - // TODO: Changed to work with sanitizers. What does RTLD_DEEPBIND do? - // module->dynamic_library_handle = dlopen(path, RTLD_LAZY | RTLD_DEEPBIND); - module->dynamic_library_handle = dlopen(path, RTLD_LAZY); + /* Load the dynamic library *.so file with lazy function call binding and deep binding + * RTLD_DEEPBIND is incompatible with certain clang sanitizers, so it might need to be temporarily disabled at + * times. See https://github.com/google/sanitizers/issues/611 + */ + module->dynamic_library_handle = dlopen(path, RTLD_LAZY | RTLD_DEEPBIND); if (module->dynamic_library_handle == NULL) { fprintf(stderr, "Failed to open %s with error: %s\n", path, dlerror()); goto dl_open_error;