[llvm] r320109 - [PowerPC][asan] Update asan to handle changed memory layouts in newer kernels

Bill Seurer via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 7 14:53:34 PST 2017


Author: seurer
Date: Thu Dec  7 14:53:33 2017
New Revision: 320109

URL: http://llvm.org/viewvc/llvm-project?rev=320109&view=rev
Log:
[PowerPC][asan] Update asan to handle changed memory layouts in newer kernels

In more recent Linux kernels with 47 bit VMAs the layout of virtual memory
for powerpc64 changed causing the address sanitizer to not work properly. This
patch adds support for 47 bit VMA kernels for powerpc64 and fixes up test
cases.

https://reviews.llvm.org/D40907

There is an associated patch for compiler-rt.

Tested on several 4.x and 3.x kernel releases.

Modified:
    llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
    llvm/trunk/test/Instrumentation/AddressSanitizer/stack-poisoning-and-lifetime-be.ll

Modified: llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp?rev=320109&r1=320108&r2=320109&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/AddressSanitizer.cpp Thu Dec  7 14:53:33 2017
@@ -100,7 +100,7 @@ static const uint64_t kIOSSimShadowOffse
 static const uint64_t kSmallX86_64ShadowOffsetBase = 0x7FFFFFFF;  // < 2G.
 static const uint64_t kSmallX86_64ShadowOffsetAlignMask = ~0xFFFULL;
 static const uint64_t kLinuxKasan_ShadowOffset64 = 0xdffffc0000000000;
-static const uint64_t kPPC64_ShadowOffset64 = 1ULL << 41;
+static const uint64_t kPPC64_ShadowOffset64 = 1ULL << 44;
 static const uint64_t kSystemZ_ShadowOffset64 = 1ULL << 52;
 static const uint64_t kMIPS32_ShadowOffset32 = 0x0aaa0000;
 static const uint64_t kMIPS64_ShadowOffset64 = 1ULL << 37;

Modified: llvm/trunk/test/Instrumentation/AddressSanitizer/stack-poisoning-and-lifetime-be.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Instrumentation/AddressSanitizer/stack-poisoning-and-lifetime-be.ll?rev=320109&r1=320108&r2=320109&view=diff
==============================================================================
--- llvm/trunk/test/Instrumentation/AddressSanitizer/stack-poisoning-and-lifetime-be.ll (original)
+++ llvm/trunk/test/Instrumentation/AddressSanitizer/stack-poisoning-and-lifetime-be.ll Thu Dec  7 14:53:33 2017
@@ -20,7 +20,7 @@ entry:
   %z = alloca [40 x i8], align 1
   %zz = getelementptr inbounds [40 x i8], [40 x i8]* %z, i64 0, i64 0
 
-  ; CHECK: [[SHADOW_BASE:%[0-9]+]] = add i64 %{{[0-9]+}}, 2199023255552
+  ; CHECK: [[SHADOW_BASE:%[0-9]+]] = add i64 %{{[0-9]+}}, 17592186044416
 
   ; F1F1F1F1
   ; ENTRY-NEXT: [[OFFSET:%[0-9]+]] = add i64 [[SHADOW_BASE]], 0




More information about the llvm-commits mailing list