[PATCH] D52249: [hwasan] Record and display stack history in stack-based reports.

Evgenii Stepanov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 19 17:35:21 PDT 2018


eugenis added a comment.

I've moved initialization code around a little.



================
Comment at: compiler-rt/lib/hwasan/hwasan_report.cc:152
+      auto *sa = t->stack_allocations();
+      uptr frames = Min((uptr)flags()->stack_history_size, sa->size());
+      for (uptr i = 0; i < frames; i++) {
----------------
kcc wrote:
> why not just sa->size()? 
sa->size() is a multiple of 512, the user might prefer less history in their reports


================
Comment at: compiler-rt/lib/hwasan/hwasan_thread_list.h:21
+// * All stack ring buffers are located within (2**kShadowBaseAlignment - 1)
+// sized region adjacent starting at (2**kShadowBaseAlignment) below the shadow.
+// * Each ring buffer has a size of (2**N)*4096 where N is in [0, 8), and is
----------------
kcc wrote:
> Is that 
>   starting at (2**kShadowBaseAlignment+1)
> ?
No, the align-up code is only wrong the ringbuffer address == shadow address, which is clearly impossible. I'll remove the -1, it is confusing.


================
Comment at: compiler-rt/lib/hwasan/hwasan_thread_list.h:27
+// ring buffer,
+//     A_next = (A + sizeof(uptr)) & ((1 << (N + 13)) - 1)
+//   is the address of the next element of that ring buffer (with wrap-around).
----------------
kcc wrote:
> is this 
>    (a + sizeof(uptr))) & ~mask ? 
> (~ missing)
yes, will fix


https://reviews.llvm.org/D52249





More information about the llvm-commits mailing list