From 0c019b7cd2c6b7b89936ec015914c7be0051086d Mon Sep 17 00:00:00 2001 From: Eric Date: Wed, 11 Jun 2025 10:17:51 +0800 Subject: [PATCH] [Backport][tsan] increase app mappings for aarch64 48-bit Reference: https://reviews.llvm.org/D140923 Currently, tsan's memory mappings include 4GB for high app, 20GB for mid app, and 8GB for low app. The high app and mid app mappings are too small for large programs, especially if ASLR entropy (mmap_rnd_bits) is set higher. The low app region (for non-PIE) is too small for some of tcmalloc's internal tests (this does not affect normal apps, since tsan will replace malloc). This CL increases the memory mappings to 4TB for high app, 1.3TB for mid app, and 10TB for low app. Note that tsan's 44-bit pointer compression/decompression imposes a 16TB limit on the combined size of the app mappings, making this set of mappings more or less maximal. Signed-off-by: Eric --- compiler-rt/lib/tsan/rtl/tsan_platform.h | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform.h b/compiler-rt/lib/tsan/rtl/tsan_platform.h index d6dd2a902d37..0e1c69dcef23 100644 --- a/compiler-rt/lib/tsan/rtl/tsan_platform.h +++ b/compiler-rt/lib/tsan/rtl/tsan_platform.h @@ -225,20 +225,20 @@ unusual order). */ struct MappingAarch64_48 { static const uptr kLoAppMemBeg = 0x0000000001000ull; - static const uptr kLoAppMemEnd = 0x0000200000000ull; - static const uptr kShadowBeg = 0x0001000000000ull; - static const uptr kShadowEnd = 0x0002000000000ull; - static const uptr kMetaShadowBeg = 0x0005000000000ull; - static const uptr kMetaShadowEnd = 0x0006000000000ull; + static const uptr kLoAppMemEnd = 0x00a0000000000ull; + static const uptr kShadowBeg = 0x0155400000000ull; + static const uptr kShadowEnd = 0x0540000000000ull; + static const uptr kMetaShadowBeg = 0x0800000000000ull; + static const uptr kMetaShadowEnd = 0x0a00000000000ull; static const uptr kMidAppMemBeg = 0x0aaaa00000000ull; - static const uptr kMidAppMemEnd = 0x0aaaf00000000ull; - static const uptr kHeapMemBeg = 0x0ffff00000000ull; - static const uptr kHeapMemEnd = 0x0ffff00000000ull; - static const uptr kHiAppMemBeg = 0x0ffff00000000ull; + static const uptr kMidAppMemEnd = 0x0ac0000000000ull; + static const uptr kHiAppMemBeg = 0x0fc0000000000ull; static const uptr kHiAppMemEnd = 0x1000000000000ull; - static const uptr kShadowMsk = 0x0fff800000000ull; - static const uptr kShadowXor = 0x0000800000000ull; - static const uptr kShadowAdd = 0x0000000000000ull; + static const uptr kHeapMemBeg = 0x0fc0000000000ull; + static const uptr kHeapMemEnd = 0x0fc0000000000ull; + static const uptr kShadowMsk = 0x0c00000000000ull; + static const uptr kShadowXor = 0x0200000000000ull; + static const uptr kShadowAdd = 0x0000000000000ull; static const uptr kVdsoBeg = 0xffff000000000ull; }; -- Gitee