diff --git a/compiler-rt/lib/lsan/lsan_allocator.h b/compiler-rt/lib/lsan/lsan_allocator.h --- a/compiler-rt/lib/lsan/lsan_allocator.h +++ b/compiler-rt/lib/lsan/lsan_allocator.h @@ -69,19 +69,26 @@ # if SANITIZER_FUCHSIA || defined(__powerpc64__) const uptr kAllocatorSpace = ~(uptr)0; const uptr kAllocatorSize = 0x40000000000ULL; // 4T. +typedef DefaultSizeClassMap SizeClassMap; +# elif SANITIZER_RISCV64 +const uptr kAllocatorSpace = ~(uptr)0; +const uptr kAllocatorSize = 0x2000000000ULL; // 128G. +typedef VeryDenseSizeClassMap SizeClassMap; # elif SANITIZER_APPLE const uptr kAllocatorSpace = 0x600000000000ULL; const uptr kAllocatorSize = 0x40000000000ULL; // 4T. +typedef DefaultSizeClassMap SizeClassMap; # else const uptr kAllocatorSpace = 0x500000000000ULL; const uptr kAllocatorSize = 0x40000000000ULL; // 4T. +typedef DefaultSizeClassMap SizeClassMap; # endif template struct AP64 { // Allocator64 parameters. Deliberately using a short name. static const uptr kSpaceBeg = kAllocatorSpace; static const uptr kSpaceSize = kAllocatorSize; static const uptr kMetadataSize = sizeof(ChunkMetadata); - typedef DefaultSizeClassMap SizeClassMap; + typedef __lsan::SizeClassMap SizeClassMap; typedef NoOpMapUnmapCallback MapUnmapCallback; static const uptr kFlags = 0; using AddressSpaceView = AddressSpaceViewTy; diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform.h --- a/compiler-rt/lib/sanitizer_common/sanitizer_platform.h +++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform.h @@ -304,9 +304,7 @@ # define SANITIZER_MMAP_RANGE_SIZE FIRST_32_SECOND_64(1ULL << 32, 1ULL << 40) # endif #elif SANITIZER_RISCV64 -// FIXME: Set to 47 to ensure it works with both Sv39 and Sv48; however, -// this will not work correctly on Sv57. -# define SANITIZER_MMAP_RANGE_SIZE FIRST_32_SECOND_64(1ULL << 32, 1ULL << 47) +# define SANITIZER_MMAP_RANGE_SIZE FIRST_32_SECOND_64(1ULL << 32, 1ULL << 57) #elif defined(__aarch64__) # if SANITIZER_APPLE # if SANITIZER_OSX || SANITIZER_IOSSIM diff --git a/compiler-rt/test/asan/TestCases/Linux/syscalls.cpp b/compiler-rt/test/asan/TestCases/Linux/syscalls.cpp --- a/compiler-rt/test/asan/TestCases/Linux/syscalls.cpp +++ b/compiler-rt/test/asan/TestCases/Linux/syscalls.cpp @@ -17,6 +17,6 @@ __sanitizer_syscall_pre_recvmsg(0, buf - 1, 0); // CHECK: AddressSanitizer: stack-buffer-{{.*}}erflow // CHECK: READ of size {{.*}} at {{.*}} thread T0 - // CHECK: #0 {{.*}} in __sanitizer_syscall{{.*}}recvmsg + // CHECK: {{#[0-9]+ .*}} in __sanitizer_syscall{{.*}}recvmsg return 0; } diff --git a/compiler-rt/test/asan/TestCases/Posix/bcmp_test.cpp b/compiler-rt/test/asan/TestCases/Posix/bcmp_test.cpp --- a/compiler-rt/test/asan/TestCases/Posix/bcmp_test.cpp +++ b/compiler-rt/test/asan/TestCases/Posix/bcmp_test.cpp @@ -12,7 +12,7 @@ char a2[] = {1, static_cast(2 * argc), 3, 4}; int res = bcmp(a1, a2, 4 + argc); // BOOM // CHECK: AddressSanitizer: stack-buffer-overflow - // CHECK: {{#1.*bcmp}} - // CHECK: {{#2.*main}} + // CHECK: {{#[0-9]+ .*bcmp}} + // CHECK: {{#[0-9]+ .*main}} return res; } diff --git a/compiler-rt/test/asan/TestCases/memcmp_test.cpp b/compiler-rt/test/asan/TestCases/memcmp_test.cpp --- a/compiler-rt/test/asan/TestCases/memcmp_test.cpp +++ b/compiler-rt/test/asan/TestCases/memcmp_test.cpp @@ -11,7 +11,7 @@ char a2[] = {1, static_cast(2*argc), 3, 4}; int res = memcmp(a1, a2, 4 + argc); // BOOM // CHECK: AddressSanitizer: stack-buffer-overflow - // CHECK: {{#1.*memcmp}} - // CHECK: {{#2.*main}} + // CHECK: {{#[0-9]+ .*memcmp}} + // CHECK: {{#[0-9]+ .*main}} return res; }