[PATCH] D58988: [Sanitizer] Protect UnwindFast with IsValidFrame on MIPS

Julian Lettner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 5 11:26:18 PST 2019


yln created this revision.
yln added reviewers: vitalybuka, eugenis.
Herald added subscribers: llvm-commits, Sanitizers, jdoerfert, atanasyan, arichardson, kubamracek, sdardis.
Herald added projects: Sanitizers, LLVM.

I think we changed what we protect with IsValidFrame over the course of
our refactorings. Take a look at the code before we started:
https://github.com/llvm/llvm-project/blob/2946cd701067404b99c39fb29dc9c74bd7193eb3/compiler-rt/lib/asan/asan_stack.h

Note that the code path that can potentially result in a fast unwind is
protected by IsValidFrame (for MIPS). This makes sense, since fast
unwind requires the frame info (bp, stack_top, stack_bottom) to work.
The current code only protects the slow unwind.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D58988

Files:
  compiler-rt/lib/asan/asan_stack.cc


Index: compiler-rt/lib/asan/asan_stack.cc
===================================================================
--- compiler-rt/lib/asan/asan_stack.cc
+++ compiler-rt/lib/asan/asan_stack.cc
@@ -65,15 +65,13 @@
   if (!unwind_scope.CanUnwind())
     return;
   if (request_fast) {
-    if (t) {
+    if (t && (!SANITIZER_MIPS ||
+              IsValidFrame(bp, t->stack_top(), t->stack_bottom()))) {
       Unwind(max_depth, pc, bp, nullptr, t->stack_top(), t->stack_bottom(),
              true);
     }
     return;
   }
-  if (SANITIZER_MIPS && t &&
-      !IsValidFrame(bp, t->stack_top(), t->stack_bottom()))
-    return;
   Unwind(max_depth, pc, bp, context, 0, 0, false);
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D58988.189375.patch
Type: text/x-patch
Size: 681 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190305/b5ab6ac3/attachment.bin>


More information about the llvm-commits mailing list