[PATCH] D56603: [HWASAN] Improve tag-mismatch diagnostics

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 15 12:56:23 PST 2019


eugenis added inline comments.


================
Comment at: lib/hwasan/hwasan_report.cc:408
+  // correct tag
+  uptr granule = untagged_addr;
+  for (; *tag_ptr == ptr_tag;
----------------
evgeny777 wrote:
> eugenis wrote:
> > Reuse __hwasan_test_shadow.
> This function looks a bit strange to me. For instance it can return -1 either in case of error or in case of a tag mismatch when address is equal to start of granule plus one. It would make much more sense if this function returned pointer instead of offset
Oh, that's a good catch! I'd prefer the interface to stay as it is for consistency with __msan_test_shadow, but fix the return offset to be within [0, sz] is case of an error.

Also, this function assumes that tag 0 is match-all, which is not the case. The ptr_tag==0 check could be removed.



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

https://reviews.llvm.org/D56603





More information about the llvm-commits mailing list