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

Matt Morehouse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 2 13:04:30 PDT 2021


morehouse added inline comments.


================
Comment at: compiler-rt/lib/asan/asan_rtl.cpp:402
+  if (&__asan_detect_use_after_return_always &&
+      __asan_detect_use_after_return_always) {
+    __asan_option_detect_stack_use_after_return = 1;
----------------
According to the comment above, we should not override the runtime flag when this is 1.


================
Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:2654
+          M, IntTy, /*isConstant=*/true, GlobalValue::WeakODRLinkage,
+          ConstantInt::get(IntTy, 1), "__asan_detect_use_after_return_always");
+    });
----------------
The constant value 1 is also inconsistent with the comment in the runtime (should be 2).


================
Comment at: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp:2648
 
+  assert(ClUseAfterReturn != AsanDetectStackUseAfterReturnMode::Invalid);
+  Type *IntTy = Type::getInt32Ty(*C);
----------------
kda wrote:
> vitalybuka wrote:
> > what we are going to do if different modules inserted the global with different values?
> I don't know.  I'm open to ideas.
> How is it solved elsewhere?
> Although, this is a very specific global.
I guess currently the linker would arbitrarily pick one value.

The question is when would we expect to compile modules with different values of the `-asan_use_after_return` flag?  If this is a valid and common use case, we might want to address it in DFSan as well.


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