File tree 4 files changed +12
-9
lines changed
llvm/lib/Transforms/Instrumentation 4 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 72
72
// || `[0x2000000000, 0x23ffffffff]` || LowShadow ||
73
73
// || `[0x0000000000, 0x1fffffffff]` || LowMem ||
74
74
//
75
- // Default Linux/RISCV64 Sv39 mapping:
75
+ // Default Linux/RISCV64 Sv39 mapping with SHADOW_OFFSET == 0xd55550000;
76
+ // (the exact location of SHADOW_OFFSET may vary depending the dynamic probing
77
+ // by FindDynamicShadowStart).
78
+ //
76
79
// || `[0x1555550000, 0x3fffffffff]` || HighMem ||
77
80
// || `[0x0fffffa000, 0x1555555fff]` || HighShadow ||
78
81
// || `[0x0effffa000, 0x0fffff9fff]` || ShadowGap ||
186
189
# elif SANITIZER_FREEBSD && defined(__aarch64__)
187
190
# define ASAN_SHADOW_OFFSET_CONST 0x0000800000000000
188
191
# elif SANITIZER_RISCV64
189
- # define ASAN_SHADOW_OFFSET_CONST 0x0000000d55550000
192
+ # define ASAN_SHADOW_OFFSET_DYNAMIC
190
193
# elif defined(__aarch64__)
191
194
# define ASAN_SHADOW_OFFSET_CONST 0x0000001000000000
192
195
# elif defined(__powerpc64__)
Original file line number Diff line number Diff line change @@ -1109,7 +1109,8 @@ uptr GetMaxVirtualAddress() {
1109
1109
# if SANITIZER_NETBSD && defined(__x86_64__)
1110
1110
return 0x7f7ffffff000ULL ; // (0x00007f8000000000 - PAGE_SIZE)
1111
1111
# elif SANITIZER_WORDSIZE == 64
1112
- # if defined(__powerpc64__) || defined(__aarch64__) || defined(__loongarch__)
1112
+ # if defined(__powerpc64__) || defined(__aarch64__) || \
1113
+ defined (__loongarch__) || SANITIZER_RISCV64
1113
1114
// On PowerPC64 we have two different address space layouts: 44- and 46-bit.
1114
1115
// We somehow need to figure out which one we are using now and choose
1115
1116
// one of 0x00000fffffffffffUL and 0x00003fffffffffffUL.
@@ -1118,9 +1119,8 @@ uptr GetMaxVirtualAddress() {
1118
1119
// This should (does) work for both PowerPC64 Endian modes.
1119
1120
// Similarly, aarch64 has multiple address space layouts: 39, 42 and 47-bit.
1120
1121
// loongarch64 also has multiple address space layouts: default is 47-bit.
1122
+ // RISC-V 64 also has multiple address space layouts: 39, 48 and 57-bit.
1121
1123
return (1ULL << (MostSignificantSetBitIndex (GET_CURRENT_FRAME ()) + 1 )) - 1 ;
1122
- # elif SANITIZER_RISCV64
1123
- return (1ULL << 38 ) - 1 ;
1124
1124
# elif SANITIZER_MIPS64
1125
1125
return (1ULL << 40 ) - 1 ; // 0x000000ffffffffffUL;
1126
1126
# elif defined(__s390x__)
Original file line number Diff line number Diff line change 295
295
// For such platforms build this code with -DSANITIZER_CAN_USE_ALLOCATOR64=0 or
296
296
// change the definition of SANITIZER_CAN_USE_ALLOCATOR64 here.
297
297
#ifndef SANITIZER_CAN_USE_ALLOCATOR64
298
- # if (SANITIZER_RISCV64 && !SANITIZER_FUCHSIA) || SANITIZER_IOS || \
299
- SANITIZER_DRIVERKIT
298
+ # if (SANITIZER_RISCV64 && !SANITIZER_FUCHSIA && !SANITIZER_LINUX) || \
299
+ SANITIZER_IOS || SANITIZER_DRIVERKIT
300
300
# define SANITIZER_CAN_USE_ALLOCATOR64 0
301
301
# elif defined(__mips64) || defined(__hexagon__)
302
302
# define SANITIZER_CAN_USE_ALLOCATOR64 0
322
322
# if SANITIZER_FUCHSIA
323
323
# define SANITIZER_MMAP_RANGE_SIZE (1ULL << 38 )
324
324
# else
325
- # define SANITIZER_MMAP_RANGE_SIZE FIRST_32_SECOND_64 (1ULL << 32 , 1ULL << 47 )
325
+ # define SANITIZER_MMAP_RANGE_SIZE FIRST_32_SECOND_64 (1ULL << 32 , 1ULL << 56 )
326
326
# endif
327
327
#elif defined(__aarch64__)
328
328
# if SANITIZER_APPLE
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ static const uint64_t kMIPS32_ShadowOffset32 = 0x0aaa0000;
108
108
static const uint64_t kMIPS64_ShadowOffset64 = 1ULL << 37 ;
109
109
static const uint64_t kAArch64_ShadowOffset64 = 1ULL << 36 ;
110
110
static const uint64_t kLoongArch64_ShadowOffset64 = 1ULL << 46 ;
111
- static const uint64_t kRISCV64_ShadowOffset64 = 0xd55550000 ;
111
+ static const uint64_t kRISCV64_ShadowOffset64 = kDynamicShadowSentinel ;
112
112
static const uint64_t kFreeBSD_ShadowOffset32 = 1ULL << 30 ;
113
113
static const uint64_t kFreeBSD_ShadowOffset64 = 1ULL << 46 ;
114
114
static const uint64_t kFreeBSDAArch64_ShadowOffset64 = 1ULL << 47 ;
You can’t perform that action at this time.
0 commit comments