[gcc r10-8931] ASAN: Support detect_invalid_pointer_pairs=1 with detect_stack_use_after_return=1

Martin Liska marxin@gcc.gnu.org
Wed Oct 21 09:22:35 GMT 2020


https://gcc.gnu.org/g:5758b0d976c7d27443e577dcef027370e23ef4f9

commit r10-8931-g5758b0d976c7d27443e577dcef027370e23ef4f9
Author: Martin Liska <mliska@suse.cz>
Date:   Fri Oct 16 15:08:52 2020 +0200

    ASAN: Support detect_invalid_pointer_pairs=1 with detect_stack_use_after_return=1
    
    Do not crash when AsanThread::GetStackVariableShadowStart does not find
    a variable for a pointer on a shadow stack.
    
    Cherry-pick from ad2be02a833e56f7fe280797280b219eb3312621.
    
    Differential Revision: https://reviews.llvm.org/D89552
    
    (cherry picked from commit b69f33f477b9ac38af3c39465600ae74a3554878)

Diff:
---
 libsanitizer/asan/asan_thread.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libsanitizer/asan/asan_thread.cpp b/libsanitizer/asan/asan_thread.cpp
index 6734d9a1668..cb374b28622 100644
--- a/libsanitizer/asan/asan_thread.cpp
+++ b/libsanitizer/asan/asan_thread.cpp
@@ -366,7 +366,9 @@ uptr AsanThread::GetStackVariableShadowStart(uptr addr) {
     bottom = stack_bottom();
   } else if (has_fake_stack()) {
     bottom = fake_stack()->AddrIsInFakeStack(addr);
-    CHECK(bottom);
+    if (bottom == 0) {
+      return 0;
+    }
   } else {
     return 0;
   }


More information about the Gcc-cvs mailing list