[PATCH] D80599: [HWASan] Add sizeof(global) in report even if symbols missing.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 9 11:33:01 PDT 2020


pcc accepted this revision.
pcc added a comment.
This revision is now accepted and ready to land.

LGTM



================
Comment at: compiler-rt/lib/hwasan/hwasan_globals.h:27
+  // The size of this global variable. Note that the size in the descriptor is
+  // max 2 << 16. When this occurs, we split the global up to have multiple
+  // descriptors.
----------------
pcc wrote:
> 2^24, "larger globals have multiple descriptors"
nit: 2 << 24 == 2^25 != 2^24.


================
Comment at: compiler-rt/lib/hwasan/hwasan_report.cpp:352
+          uptr size = GetGlobalSizeFromDescriptor(mem);
+          if (size == 0)
+            Printf(
----------------
hctim wrote:
> pcc wrote:
> > Is `size == 0` realistic? I don't think you can declare a zero-size global in C.
> Sorry - I don't understand the comment. `size == 0` here indicates that the descriptor lookup failed.
Ah okay. I'd probably leave a brief comment about that here then.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D80599





More information about the llvm-commits mailing list