[PATCH] D137676: [compiler-rt][hwasan] Do not call InitLoadedGlobals in __hwasan_init

Leonard Chan via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 8 15:06:06 PST 2022


leonardchan created this revision.
leonardchan added reviewers: phosek, mcgrathr, vitalybuka.
leonardchan added a project: Sanitizers.
Herald added subscribers: Enna1, abrachet, dberris.
Herald added a project: All.
leonardchan requested review of this revision.
Herald added a subscriber: Sanitizers.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D137676

Files:
  compiler-rt/lib/hwasan/hwasan.cpp


Index: compiler-rt/lib/hwasan/hwasan.cpp
===================================================================
--- compiler-rt/lib/hwasan/hwasan.cpp
+++ compiler-rt/lib/hwasan/hwasan.cpp
@@ -340,7 +340,12 @@
   DisableCoreDumperIfNecessary();
 
   InitInstrumentation();
+#if !SANITIZER_FUCHSIA
+  // Fuchsia's libc provides a hook (__sanitizer_module_loaded) that runs on the
+  // startup path which calls into __hwasan_library_loaded on all initially
+  // loaded modules, so explicitly registering the globals here isn't needed.
   InitLoadedGlobals();
+#endif
 
   // Needs to be called here because flags()->random_tags might not have been
   // initialized when InitInstrumentation() was called.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137676.474101.patch
Type: text/x-patch
Size: 701 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221108/86db87b6/attachment.bin>


More information about the llvm-commits mailing list