Skip to content

Commit 40dffef

Browse files
committed
[compiler-rt][hwasan] Do not call InitLoadedGlobals in __hwasan_init
Fuchsia's libc provides a new hook (__sanitizer_module_loaded) which calls hwasan_library_loaded in the startup path which will register globals in loaded modules. Differential Revision: https://reviews.llvm.org/D137676
1 parent e044796 commit 40dffef

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

compiler-rt/lib/hwasan/hwasan.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,13 @@ __attribute__((constructor(0))) void __hwasan_init() {
340340
DisableCoreDumperIfNecessary();
341341

342342
InitInstrumentation();
343-
InitLoadedGlobals();
343+
if constexpr (!SANITIZER_FUCHSIA) {
344+
// Fuchsia's libc provides a hook (__sanitizer_module_loaded) that runs on
345+
// the startup path which calls into __hwasan_library_loaded on all
346+
// initially loaded modules, so explicitly registering the globals here
347+
// isn't needed.
348+
InitLoadedGlobals();
349+
}
344350

345351
// Needs to be called here because flags()->random_tags might not have been
346352
// initialized when InitInstrumentation() was called.

0 commit comments

Comments
 (0)