forked from OSchip/llvm-project
[ASan] Move the shadow range on 32-bit iOS (and iOS Simulator)
to 0x40000000-0x60000000 to avoid address space clash with system libraries. The solution has been proposed by tahabekireren@gmail.com in https://code.google.com/p/address-sanitizer/issues/detail?id=210 This is also known to fix some Chromium iOS tests. llvm-svn: 207002
This commit is contained in:
parent
e811ab9582
commit
a51e483846
|
@ -67,7 +67,8 @@
|
|||
// || `[0x00000000, 0x0aaa7fff]` || LowMem ||
|
||||
|
||||
static const u64 kDefaultShadowScale = 3;
|
||||
static const u64 kDefaultShadowOffset32 = 1ULL << 29;
|
||||
static const u64 kDefaultShadowOffset32 = 1ULL << 29; // 0x20000000
|
||||
static const u64 kIosShadowOffset32 = 1ULL << 30; // 0x40000000
|
||||
static const u64 kDefaultShadowOffset64 = 1ULL << 44;
|
||||
static const u64 kDefaultShort64bitShadowOffset = 0x7FFF8000; // < 2G.
|
||||
static const u64 kAArch64_ShadowOffset64 = 1ULL << 36;
|
||||
|
@ -81,7 +82,11 @@ static const u64 kMIPS32_ShadowOffset32 = 0x0aaa8000;
|
|||
# if defined(__mips__)
|
||||
# define SHADOW_OFFSET kMIPS32_ShadowOffset32
|
||||
# else
|
||||
# define SHADOW_OFFSET kDefaultShadowOffset32
|
||||
# if SANITIZER_IOS
|
||||
# define SHADOW_OFFSET kIosShadowOffset32
|
||||
# else
|
||||
# define SHADOW_OFFSET kDefaultShadowOffset32
|
||||
# endif
|
||||
# endif
|
||||
# else
|
||||
# if defined(__aarch64__)
|
||||
|
|
|
@ -55,6 +55,7 @@ using namespace llvm;
|
|||
|
||||
static const uint64_t kDefaultShadowScale = 3;
|
||||
static const uint64_t kDefaultShadowOffset32 = 1ULL << 29;
|
||||
static const uint64_t kIOSShadowOffset32 = 1ULL << 30;
|
||||
static const uint64_t kDefaultShadowOffset64 = 1ULL << 44;
|
||||
static const uint64_t kSmallX86_64ShadowOffset = 0x7FFF8000; // < 2G.
|
||||
static const uint64_t kPPC64_ShadowOffset64 = 1ULL << 41;
|
||||
|
@ -250,7 +251,7 @@ struct ShadowMapping {
|
|||
static ShadowMapping getShadowMapping(const Module &M, int LongSize) {
|
||||
llvm::Triple TargetTriple(M.getTargetTriple());
|
||||
bool IsAndroid = TargetTriple.getEnvironment() == llvm::Triple::Android;
|
||||
// bool IsMacOSX = TargetTriple.getOS() == llvm::Triple::MacOSX;
|
||||
bool IsIOS = TargetTriple.getOS() == llvm::Triple::IOS;
|
||||
bool IsFreeBSD = TargetTriple.getOS() == llvm::Triple::FreeBSD;
|
||||
bool IsLinux = TargetTriple.getOS() == llvm::Triple::Linux;
|
||||
bool IsPPC64 = TargetTriple.getArch() == llvm::Triple::ppc64 ||
|
||||
|
@ -268,6 +269,8 @@ static ShadowMapping getShadowMapping(const Module &M, int LongSize) {
|
|||
Mapping.Offset = kMIPS32_ShadowOffset32;
|
||||
else if (IsFreeBSD)
|
||||
Mapping.Offset = kFreeBSD_ShadowOffset32;
|
||||
else if (IsIOS)
|
||||
Mapping.Offset = kIOSShadowOffset32;
|
||||
else
|
||||
Mapping.Offset = kDefaultShadowOffset32;
|
||||
} else { // LongSize == 64
|
||||
|
|
Loading…
Reference in New Issue