[PATCH] D127096: [MIPS][AddressSanitizer] Fix the shadow offset hook for the n32 ABI
Dimitrije Milošević via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 6 03:27:58 PDT 2022
dmilosevic141 created this revision.
dmilosevic141 added a reviewer: djtodoro.
Herald added subscribers: Enna1, atanasyan, hiraditya, arichardson, sdardis.
Herald added a project: All.
dmilosevic141 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Currently, //LLVM// doesn't have the correct shadow offset mapping for the //n32 ABI//.
This patch introduces the correct shadow offset value for the //n32 ABI// - `1ULL << 29`.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D127096
Files:
llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
Index: llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
===================================================================
--- llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
+++ llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp
@@ -100,6 +100,7 @@
static const uint64_t kLinuxKasan_ShadowOffset64 = 0xdffffc0000000000;
static const uint64_t kPPC64_ShadowOffset64 = 1ULL << 44;
static const uint64_t kSystemZ_ShadowOffset64 = 1ULL << 52;
+static const uint64_t kMIPS_ShadowOffsetN32 = 1ULL << 29;
static const uint64_t kMIPS32_ShadowOffset32 = 0x0aaa0000;
static const uint64_t kMIPS64_ShadowOffset64 = 1ULL << 37;
static const uint64_t kAArch64_ShadowOffset64 = 1ULL << 36;
@@ -475,6 +476,7 @@
TargetTriple.getArch() == Triple::ppc64le;
bool IsSystemZ = TargetTriple.getArch() == Triple::systemz;
bool IsX86_64 = TargetTriple.getArch() == Triple::x86_64;
+ bool IsMIPSN32ABI = TargetTriple.getEnvironment() == Triple::GNUABIN32;
bool IsMIPS32 = TargetTriple.isMIPS32();
bool IsMIPS64 = TargetTriple.isMIPS64();
bool IsArmOrThumb = TargetTriple.isARM() || TargetTriple.isThumb();
@@ -495,6 +497,8 @@
if (LongSize == 32) {
if (IsAndroid)
Mapping.Offset = kDynamicShadowSentinel;
+ else if (IsMIPSN32ABI)
+ Mapping.Offset = kMIPS_ShadowOffsetN32;
else if (IsMIPS32)
Mapping.Offset = kMIPS32_ShadowOffset32;
else if (IsFreeBSD)
@@ -538,7 +542,9 @@
(kSmallX86_64ShadowOffsetAlignMask << Mapping.Scale));
} else if (IsWindows && IsX86_64) {
Mapping.Offset = kWindowsShadowOffset64;
- } else if (IsMIPS64)
+ } else if (IsMIPSN32ABI)
+ Mapping.Offset = kMIPS_ShadowOffsetN32;
+ else if (IsMIPS64)
Mapping.Offset = kMIPS64_ShadowOffset64;
else if (IsIOS)
Mapping.Offset = kDynamicShadowSentinel;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127096.434416.patch
Type: text/x-patch
Size: 1865 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220606/c34fccda/attachment.bin>
More information about the llvm-commits
mailing list