[PATCH] D40935: Hardware-assisted AddressSanitizer (compiler-rt)

Kostya Serebryany via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 8 10:37:58 PST 2017


kcc added a comment.

My top level comment: can we delete all non-aarch64 code? 
The arch owners can reinstate it if needed, but they will only need it if/when they have the TBI feature in HW.



================
Comment at: compiler-rt/lib/hwasan/hwasan.cc:60
+
+int hwasan_report_count = 0;
+
----------------
seems to be unused (nothings sets it to non zero), please remove. 


================
Comment at: compiler-rt/lib/hwasan/hwasan.cc:99
+
+#if HWASAN_CONTAINS_UBSAN
+  __ubsan::Flags *uf = __ubsan::flags();
----------------
can we not have any of these #ifdefs? 



================
Comment at: compiler-rt/lib/hwasan/hwasan.cc:181
+
+  AvoidCVE_2016_2143();
+  InitTlsSize();
----------------
Is this one relevant? 


================
Comment at: compiler-rt/lib/hwasan/hwasan.cc:194
+  DisableCoreDumperIfNecessary();
+  if (StackSizeIsUnlimited()) {
+    VPrintf(1, "Unlimited stack, doing reexec\n");
----------------
do we need this? 
For asan we did, but probably not for hwasan


================
Comment at: compiler-rt/lib/hwasan/hwasan_allocator.cc:72
+
+#if defined(__mips64)
+  static const uptr kMaxAllowedMallocSize = 2UL << 30;
----------------
oy! Please remove all of this non-aarch64 stuff. 
We won't need non-aarch64 any time soon. 


================
Comment at: compiler-rt/lib/hwasan/hwasan_flags.inc:24
+
+HWASAN_FLAG(bool, report_umrs, true, "")
+HWASAN_FLAG(bool, print_stats, false, "")
----------------
seems unused, remove


================
Comment at: compiler-rt/lib/hwasan/hwasan_interceptors.cc:478
+  HWASAN_MAYBE_INTERCEPT_MALLOC_STATS;
+#if defined(__mips__)
+  INTERCEPT_FUNCTION_VER(pthread_create, "GLIBC_2.2");
----------------
mips? 


================
Comment at: compiler-rt/lib/hwasan/hwasan_linux.cc:38
+__attribute__((alias("__hwasan_shadow_memory_dynamic_address")))
+extern uptr __hwasan_shadow_memory_dynamic_address_internal;
+
----------------
Note for future, feel free to ignore now: we should try to have the zero shadow base


================
Comment at: compiler-rt/lib/hwasan/hwasan_linux.cc:106
+
+#if defined(__aarch64__)
+static AccessInfo GetAccessInfo(siginfo_t *info, ucontext_t *uc) {
----------------
What's the use case for #else? 


https://reviews.llvm.org/D40935





More information about the llvm-commits mailing list