[PATCH] D103304: Update and improve compiler-rt tests for -mllvm -asan_use_after_return=(never|[runtime]|always).

Vitaly Buka via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat May 29 14:37:55 PDT 2021


vitalybuka added inline comments.


================
Comment at: compiler-rt/lib/asan/asan_fake_stack.cpp:196-197
     return fs;
   if (!__asan_option_detect_stack_use_after_return)
     return nullptr;
   return GetFakeStack();
----------------
Flawless change should be in a separate patch.

Also this is slow pass, one per thread. I don't think we care about performance of this branch, so I would prefer we avoid extending API where unnecessary.



================
Comment at: compiler-rt/lib/asan/asan_rtl.cpp:26
 #include "asan_thread.h"
+#include "lsan/lsan_common.h"
 #include "sanitizer_common/sanitizer_atomic.h"
----------------
why it's moved?


================
Comment at: compiler-rt/lib/asan/asan_rtl.cpp:46
+
+int __asan_get_use_after_return_mode() {
+  return &__asan_use_after_return_mode ? __asan_use_after_return_mode : 1;
----------------
we use __asan_... for interface functions names

I assume none will call it outside of this file
so should be CamelCase and static


Maybe rename it InitAsanDetectUAROption() and move 

entire switch here?


================
Comment at: compiler-rt/test/asan/TestCases/heavy_uar_test.cpp:4
+// RUN: %clangxx_asan -O0 %s -o %t -mllvm -asan-use-after-return=always && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O0 %s -o %t -mllvm -asan-use-after-return=always && not %run %t 2>&1 | FileCheck %s
 // XFAIL: windows-msvc
----------------
-O2?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D103304



More information about the llvm-commits mailing list