[PATCH] D65770: hwasan: Instrument globals.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 5 14:44:29 PDT 2019


pcc marked 3 inline comments as done.
pcc added inline comments.


================
Comment at: compiler-rt/lib/hwasan/hwasan.cpp:221
+  s32 gv_relptr;
+  u32 info;
+};
----------------
vitalybuka wrote:
> Can this be just following?
>   u32 size:24;
>   u8 tag;
It could, but since these structs are created by the pass I didn't want to make any assumptions about bitfield layout (even though I think we should always end up with the layout we expect on the platforms we care about), and the way I've written it the code is more "obviously" correct when comparing it against the pass.


================
Comment at: compiler-rt/lib/hwasan/hwasan.cpp:236
 
-using namespace __hwasan;
+#define NT_LLVM_HWASAN_GLOBALS 3
+
----------------
vitalybuka wrote:
> could this be a normal constant?
You mean like an enum? Sure.


================
Comment at: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:1203
+  Constant *Initializer = GV->getInitializer();
+  uint64_t SizeInBytes =
+      M.getDataLayout().getTypeAllocSize(Initializer->getType());
----------------
vitalybuka wrote:
> what is going to happen with size > 2^24?
We create multiple descriptors, see the loop on lines 1242-1262.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D65770





More information about the llvm-commits mailing list