[compiler-rt] Add API to temporalily suppress usage of ASAN's fake stack (PR #160135)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 26 04:01:52 PST 2025
================
@@ -0,0 +1,34 @@
+// RUN: %clangxx_asan %s -o %t && %run %t
+// RUN: %clangxx_asan %s -mllvm -asan-use-after-return=runtime -o %t && env ASAN_OPTIONS=detect_stack_use_after_return=1 %run %t
+// RUN: %clangxx_asan %s -mllvm -asan-use-after-return=always -o %t && %run %t
+
+#include "defines.h"
+
+#include <cassert>
+#include <sanitizer/asan_interface.h>
+
+volatile uintptr_t saved;
+
+ATTRIBUTE_NOINLINE bool IsOnRealStack(uintptr_t caller_frame) {
+ uintptr_t this_frame =
+ reinterpret_cast<uintptr_t>(__builtin_frame_address(0));
+ return this_frame <= saved && saved <= caller_frame;
+}
+
+ATTRIBUTE_NOINLINE bool IsOnStack() {
----------------
happyCoder92 wrote:
Done.
https://github.com/llvm/llvm-project/pull/160135
More information about the llvm-commits
mailing list