[PATCH] D58857: [HWASan] Save + print registers when tag mismatch occurs in AArch64.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 7 16:12:39 PST 2019


pcc added inline comments.


================
Comment at: compiler-rt/lib/hwasan/hwasan_report.cc:452
+    Printf("    x%d%s%016llx", i, (i < 10) ? kDoubleSpace : kSingleSpace,
+           frame[28 - i]);
+    Printf("  x%d%s%016llx", i + 1, (i + 1 < 10) ? kDoubleSpace : kSingleSpace,
----------------
hctim wrote:
> pcc wrote:
> > The math here seems a little hard to reason about. Would it be better to store the registers in numerical order so that e.g. x0 is in frame[0], x1 is in frame[1] and so on?
> Have changed to do ordering for `x2` - `x28`, but as `x0`, `x1`, `x29`, and `x30` are saved in `__hwasan_check` they'll have to stay a bit out-of-order.
Not necessarily. I think you could do this in `__hwasan_check_*`:
```
stp x0, x1, [sp, #-248]!
stp x29, x30, [sp, #232]
```
Now all of your stores in `__hwasan_tag_mismatch` can look like this:
```
stp xN, xN+1, [sp, #(N * 8)]
```


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D58857





More information about the llvm-commits mailing list