[PATCH] D56672: [HWASAN] Instrument globals

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 14 13:42:41 PST 2019


eugenis added a comment.

> hash_value(GV->getName())

This would break interoperability with non-instrumented translation units and DSOs.

AFAIK the proper implementation of global tagging needs to involve the dynamic loader, which can emit tagged pointers into GOTs. The compiler would need to route every access to a global through GOT, too, even for internal / non-preemptible globals.

I wonder if the same could be achieved with a clever use of ifunc?



================
Comment at: lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:1236
+      ConstantArray::get(ArrayOfGlobalStructTy, Initializers),
+      kHwasanGlobalsListName);
+
----------------
This "all globals in one" approach breaks -Wl,-gc-sections, which is rather bad for binary size. You need to do the whole comdat + !associated thing,  same as ASan.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56672/new/

https://reviews.llvm.org/D56672





More information about the llvm-commits mailing list