[llvm] 593fa3a - [PS5] Set address sanitizer shadow offset

Paul Robinson via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 16 11:28:37 PDT 2022


Author: Paul Robinson
Date: 2022-06-16T11:28:30-07:00
New Revision: 593fa3ab30b702c4694401cbbd2cac4f1987a8e0

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

LOG: [PS5] Set address sanitizer shadow offset

Added: 
    

Modified: 
    llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
    llvm/test/Instrumentation/AddressSanitizer/ps4.ll

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
index 0899acf3d6568..673738ee931ec 100644
--- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -110,7 +110,7 @@ static const uint64_t kFreeBSDKasan_ShadowOffset64 = 0xdffff7c000000000;
 static const uint64_t kNetBSD_ShadowOffset32 = 1ULL << 30;
 static const uint64_t kNetBSD_ShadowOffset64 = 1ULL << 46;
 static const uint64_t kNetBSDKasan_ShadowOffset64 = 0xdfff900000000000;
-static const uint64_t kPS4_ShadowOffset64 = 1ULL << 40;
+static const uint64_t kPS_ShadowOffset64 = 1ULL << 40;
 static const uint64_t kWindowsShadowOffset32 = 3ULL << 28;
 static const uint64_t kEmscriptenShadowOffset = 0;
 
@@ -469,7 +469,7 @@ static ShadowMapping getShadowMapping(const Triple &TargetTriple, int LongSize,
   bool IsMacOS = TargetTriple.isMacOSX();
   bool IsFreeBSD = TargetTriple.isOSFreeBSD();
   bool IsNetBSD = TargetTriple.isOSNetBSD();
-  bool IsPS4 = TargetTriple.isPS4();
+  bool IsPS = TargetTriple.isPS();
   bool IsLinux = TargetTriple.isOSLinux();
   bool IsPPC64 = TargetTriple.getArch() == Triple::ppc64 ||
                  TargetTriple.getArch() == Triple::ppc64le;
@@ -528,8 +528,8 @@ static ShadowMapping getShadowMapping(const Triple &TargetTriple, int LongSize,
         Mapping.Offset = kNetBSDKasan_ShadowOffset64;
       else
         Mapping.Offset = kNetBSD_ShadowOffset64;
-    } else if (IsPS4)
-      Mapping.Offset = kPS4_ShadowOffset64;
+    } else if (IsPS)
+      Mapping.Offset = kPS_ShadowOffset64;
     else if (IsLinux && IsX86_64) {
       if (IsKasan)
         Mapping.Offset = kLinuxKasan_ShadowOffset64;
@@ -568,7 +568,7 @@ static ShadowMapping getShadowMapping(const Triple &TargetTriple, int LongSize,
   // offset is not necessary 1/8-th of the address space.  On SystemZ,
   // we could OR the constant in a single instruction, but it's more
   // efficient to load it once and use indexed addressing.
-  Mapping.OrShadowOffset = !IsAArch64 && !IsPPC64 && !IsSystemZ && !IsPS4 &&
+  Mapping.OrShadowOffset = !IsAArch64 && !IsPPC64 && !IsSystemZ && !IsPS &&
                            !IsRISCV64 &&
                            !(Mapping.Offset & (Mapping.Offset - 1)) &&
                            Mapping.Offset != kDynamicShadowSentinel;

diff  --git a/llvm/test/Instrumentation/AddressSanitizer/ps4.ll b/llvm/test/Instrumentation/AddressSanitizer/ps4.ll
index 29faecc766a34..da09fd3e3880b 100644
--- a/llvm/test/Instrumentation/AddressSanitizer/ps4.ll
+++ b/llvm/test/Instrumentation/AddressSanitizer/ps4.ll
@@ -1,4 +1,5 @@
 ; RUN: opt < %s -passes='asan-pipeline' -S -mtriple=x86_64-scei-ps4 | FileCheck %s
+; RUN: opt < %s -passes='asan-pipeline' -S -mtriple=x86_64-sie-ps5 | FileCheck %s
 
 define i32 @read_4_bytes(i32* %a) sanitize_address {
 entry:
@@ -8,7 +9,7 @@ entry:
 
 ; CHECK: @read_4_bytes
 ; CHECK-NOT: ret
-; Check for ASAN's Offset on the PS4 (2^40 or 0x10000000000)
+; Check for ASAN's Offset on the PS4/PS5 (2^40 or 0x10000000000)
 ; CHECK: lshr {{.*}} 3
 ; CHECK-NEXT: {{1099511627776}}
 ; CHECK: ret


        


More information about the llvm-commits mailing list