[compiler-rt] Poison last word of FakeFrame (PR #133689)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 31 01:23:17 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: None (brandb97)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/133689.diff
1 Files Affected:
- (modified) compiler-rt/lib/asan/asan_fake_stack.cpp (+6-1)
``````````diff
diff --git a/compiler-rt/lib/asan/asan_fake_stack.cpp b/compiler-rt/lib/asan/asan_fake_stack.cpp
index 7443ff166984d..f68dd31ab1610 100644
--- a/compiler-rt/lib/asan/asan_fake_stack.cpp
+++ b/compiler-rt/lib/asan/asan_fake_stack.cpp
@@ -107,7 +107,12 @@ FakeFrame *FakeStack::Allocate(uptr stack_size_log, uptr class_id,
FakeFrame *res = reinterpret_cast<FakeFrame *>(
GetFrame(stack_size_log, class_id, pos));
res->real_stack = real_stack;
- *SavedFlagPtr(reinterpret_cast<uptr>(res), class_id) = &flags[pos];
+ u8 **saved_flag_ptr = SavedFlagPtr(reinterpret_cast<uptr>(res), class_id);
+ *saved_flag_ptr = &flags[pos];
+
+ // Poison the last word of FakeFrame
+ u8 *shadow = reinterpret_cast<u8*>(MemToShadow(reinterpret_cast<uptr>(saved_flag_ptr)));
+ *shadow = kMagic1;
return res;
}
return nullptr; // We are out of fake stack.
``````````
</details>
https://github.com/llvm/llvm-project/pull/133689
More information about the llvm-commits
mailing list