File tree Expand file tree Collapse file tree 4 files changed +12
-9
lines changed
llvm/lib/Transforms/Instrumentation Expand file tree Collapse file tree 4 files changed +12
-9
lines changed Original file line number Diff line number Diff line change 7272// || `[0x2000000000, 0x23ffffffff]` || LowShadow ||
7373// || `[0x0000000000, 0x1fffffffff]` || LowMem ||
7474//
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+ //
7679// || `[0x1555550000, 0x3fffffffff]` || HighMem ||
7780// || `[0x0fffffa000, 0x1555555fff]` || HighShadow ||
7881// || `[0x0effffa000, 0x0fffff9fff]` || ShadowGap ||
186189# elif SANITIZER_FREEBSD && defined(__aarch64__)
187190# define ASAN_SHADOW_OFFSET_CONST 0x0000800000000000
188191# elif SANITIZER_RISCV64
189- # define ASAN_SHADOW_OFFSET_CONST 0x0000000d55550000
192+ # define ASAN_SHADOW_OFFSET_DYNAMIC
190193# elif defined(__aarch64__)
191194# define ASAN_SHADOW_OFFSET_CONST 0x0000001000000000
192195# elif defined(__powerpc64__)
Original file line number Diff line number Diff line change @@ -1109,7 +1109,8 @@ uptr GetMaxVirtualAddress() {
11091109# if SANITIZER_NETBSD && defined(__x86_64__)
11101110 return 0x7f7ffffff000ULL ; // (0x00007f8000000000 - PAGE_SIZE)
11111111# elif SANITIZER_WORDSIZE == 64
1112- # if defined(__powerpc64__) || defined(__aarch64__) || defined(__loongarch__)
1112+ # if defined(__powerpc64__) || defined(__aarch64__) || \
1113+ defined (__loongarch__) || SANITIZER_RISCV64
11131114 // On PowerPC64 we have two different address space layouts: 44- and 46-bit.
11141115 // We somehow need to figure out which one we are using now and choose
11151116 // one of 0x00000fffffffffffUL and 0x00003fffffffffffUL.
@@ -1118,9 +1119,8 @@ uptr GetMaxVirtualAddress() {
11181119 // This should (does) work for both PowerPC64 Endian modes.
11191120 // Similarly, aarch64 has multiple address space layouts: 39, 42 and 47-bit.
11201121 // 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.
11211123 return (1ULL << (MostSignificantSetBitIndex (GET_CURRENT_FRAME ()) + 1 )) - 1 ;
1122- # elif SANITIZER_RISCV64
1123- return (1ULL << 38 ) - 1 ;
11241124# elif SANITIZER_MIPS64
11251125 return (1ULL << 40 ) - 1 ; // 0x000000ffffffffffUL;
11261126# elif defined(__s390x__)
Original file line number Diff line number Diff line change 295295// For such platforms build this code with -DSANITIZER_CAN_USE_ALLOCATOR64=0 or
296296// change the definition of SANITIZER_CAN_USE_ALLOCATOR64 here.
297297#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
300300# define SANITIZER_CAN_USE_ALLOCATOR64 0
301301# elif defined(__mips64) || defined(__hexagon__)
302302# define SANITIZER_CAN_USE_ALLOCATOR64 0
322322# if SANITIZER_FUCHSIA
323323# define SANITIZER_MMAP_RANGE_SIZE (1ULL << 38 )
324324# 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 )
326326# endif
327327#elif defined(__aarch64__)
328328# if SANITIZER_APPLE
Original file line number Diff line number Diff line change @@ -108,7 +108,7 @@ static const uint64_t kMIPS32_ShadowOffset32 = 0x0aaa0000;
108108static const uint64_t kMIPS64_ShadowOffset64 = 1ULL << 37 ;
109109static const uint64_t kAArch64_ShadowOffset64 = 1ULL << 36 ;
110110static const uint64_t kLoongArch64_ShadowOffset64 = 1ULL << 46 ;
111- static const uint64_t kRISCV64_ShadowOffset64 = 0xd55550000 ;
111+ static const uint64_t kRISCV64_ShadowOffset64 = kDynamicShadowSentinel ;
112112static const uint64_t kFreeBSD_ShadowOffset32 = 1ULL << 30 ;
113113static const uint64_t kFreeBSD_ShadowOffset64 = 1ULL << 46 ;
114114static const uint64_t kFreeBSDAArch64_ShadowOffset64 = 1ULL << 47 ;
You can’t perform that action at this time.
0 commit comments