[PATCH] D110254: [hwasan] have callbacks for 32 and 64 byte ops

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 22 14:01:31 PDT 2021


eugenis added inline comments.


================
Comment at: compiler-rt/lib/hwasan/hwasan.cpp:451
+void __hwasan_load32(uptr p) {
+  CheckAddress<ErrorAction::Abort, AccessType::Load, 5>(p);
+}
----------------
I think you need to update CheckAddress - it only ever checks the first granule.

And it would be great to have a runtime test that ex. 64-byte access checks the middle and the last granules.


================
Comment at: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:74
+// of Android.
+static const size_t kOldNumberOfAccessSizes = 5;
+// Accesses sizes are powers of two: 1, 2, 4, 8, 16, 32, 64.
----------------
rename it to something like kApi32NumberOfAccessSizes. "old" is too vague.


================
Comment at: llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp:1049
       (!O.Alignment || *O.Alignment >= (1ULL << Mapping.Scale) ||
        *O.Alignment >= O.TypeSize / 8)) {
     size_t AccessSizeIndex = TypeSizeToSizeIndex(O.TypeSize);
----------------
as I understand, this will work for 64-byte access that is only 16-byte aligned. Could you add a test for this?



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D110254



More information about the llvm-commits mailing list