[compiler-rt] db3d337 - [NFC][hwasan] Print after protecting gaps

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 11 17:56:03 PDT 2024


Author: Vitaly Buka
Date: 2024-07-11T17:55:54-07:00
New Revision: db3d3378ba751337c12147d11367006f23becc0c

URL: https://github.com/llvm/llvm-project/commit/db3d3378ba751337c12147d11367006f23becc0c
DIFF: https://github.com/llvm/llvm-project/commit/db3d3378ba751337c12147d11367006f23becc0c.diff

LOG: [NFC][hwasan] Print after protecting gaps

PrintAddressSpaceLayout can accidentally
mmap into the gap.

Added: 
    

Modified: 
    compiler-rt/lib/hwasan/hwasan_linux.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/hwasan/hwasan_linux.cpp b/compiler-rt/lib/hwasan/hwasan_linux.cpp
index ae14906fd3042..0a23ffc9fa1ba 100644
--- a/compiler-rt/lib/hwasan/hwasan_linux.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_linux.cpp
@@ -251,9 +251,6 @@ bool InitShadow() {
   CHECK_GT(kLowShadowEnd, kLowShadowStart);
   CHECK_GT(kLowShadowStart, kLowMemEnd);
 
-  if (Verbosity())
-    PrintAddressSpaceLayout();
-
   // Reserve shadow memory.
   ReserveShadowMemoryRange(kLowShadowStart, kLowShadowEnd, "low shadow");
   ReserveShadowMemoryRange(kHighShadowStart, kHighShadowEnd, "high shadow");
@@ -267,6 +264,9 @@ bool InitShadow() {
   if (kHighShadowEnd + 1 < kHighMemStart)
     ProtectGap(kHighShadowEnd + 1, kHighMemStart - kHighShadowEnd - 1);
 
+  if (Verbosity())
+    PrintAddressSpaceLayout();
+
   return true;
 }
 


        


More information about the llvm-commits mailing list