Add the FreeBSD AArch64 shadow offset to llvm

AArch64 has a larger address space than 64 but x86. Use the larger
shadow offset on FreeBSD AArch64.

Reviewed by: vitalybuka

Differential Revision: https://reviews.llvm.org/D125873
This commit is contained in:
Andrew Turner 2022-05-16 17:20:52 +01:00 committed by Ed Maste
parent 1b2fa907d7
commit e13bd2644e
2 changed files with 15 additions and 0 deletions

View File

@ -108,6 +108,7 @@ static const uint64_t kAArch64_ShadowOffset64 = 1ULL << 36;
static const uint64_t kRISCV64_ShadowOffset64 = 0xd55550000;
static const uint64_t kFreeBSD_ShadowOffset32 = 1ULL << 30;
static const uint64_t kFreeBSD_ShadowOffset64 = 1ULL << 46;
static const uint64_t kFreeBSDAArch64_ShadowOffset64 = 1ULL << 47;
static const uint64_t kFreeBSDKasan_ShadowOffset64 = 0xdffff7c000000000;
static const uint64_t kNetBSD_ShadowOffset32 = 1ULL << 30;
static const uint64_t kNetBSD_ShadowOffset64 = 1ULL << 46;
@ -523,6 +524,8 @@ static ShadowMapping getShadowMapping(const Triple &TargetTriple, int LongSize,
Mapping.Offset = kPPC64_ShadowOffset64;
else if (IsSystemZ)
Mapping.Offset = kSystemZ_ShadowOffset64;
else if (IsFreeBSD && IsAArch64)
Mapping.Offset = kFreeBSDAArch64_ShadowOffset64;
else if (IsFreeBSD && !IsMIPS64) {
if (IsKasan)
Mapping.Offset = kFreeBSDKasan_ShadowOffset64;

View File

@ -8,6 +8,11 @@
; RUN: -data-layout="e-m:e-i64:64-f80:128-n8:16:32:64-S128" | \
; RUN: FileCheck --check-prefix=CHECK-64 %s
; RUN: opt < %s -passes='asan-pipeline' -S \
; RUN: -mtriple=aarch64-unknown-freebsd \
; RUN: -data-layout="e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" | \
; RUN: FileCheck --check-prefix=CHECK-AARCH64 %s
; RUN: opt < %s -passes='asan-pipeline' -S \
; RUN: -mtriple=mips64-unknown-freebsd \
; RUN: -data-layout="E-m:e-i64:64-n32:64-S128" | \
@ -33,6 +38,13 @@ entry:
; CHECK-64-NEXT: {{70368744177664}}
; CHECK-64: ret
; CHECK-AARCH64: @read_4_bytes
; CHECK-AARCH64-NOT: ret
; Check for ASAN's Offset for 64-bit (2^47 or 0x800000000000)
; CHECK-AARCH64: lshr {{.*}} 3
; CHECK-AARCH64-NEXT: {{140737488355328}}
; CHECK-AARCH64: ret
; CHECK-MIPS64: @read_4_bytes
; CHECK-MIPS64-NOT: ret
; Check for ASAN's Offset for 64-bit (2^37 or 0x2000000000)