* ASan: move allocator base to avoid conflict with high-entropy ASLR

for x86-64 Linux. Patch taken from LLVM 17.
This commit is contained in:
Matthias Klose 2024-03-16 22:18:17 +01:00
parent cff18adb3b
commit c9847d7ab5
3 changed files with 25 additions and 0 deletions

2
debian/changelog vendored
View File

@ -3,6 +3,8 @@ llvm-toolchain-16 (1:16.0.6-24) UNRELEASED; urgency=medium
[ Matthias Klose ]
* Add a stage1 profile to disable curl, grpc and spirv.
* Build with --as-needed.
* ASan: move allocator base to avoid conflict with high-entropy ASLR
for x86-64 Linux. Patch taken from LLVM 17.
-- Matthias Klose <doko@debian.org> Sat, 16 Mar 2024 22:12:22 +0100

View File

@ -0,0 +1,22 @@
diff --git a/compiler-rt/lib/asan/asan_allocator.h b/compiler-rt/lib/asan/asan_allocator.h
index 0b4dbf03bb9d53..6a12a6c6025283 100644
--- a/compiler-rt/lib/asan/asan_allocator.h
+++ b/compiler-rt/lib/asan/asan_allocator.h
@@ -143,11 +143,15 @@ typedef DefaultSizeClassMap SizeClassMap;
const uptr kAllocatorSpace = ~(uptr)0;
const uptr kAllocatorSize = 0x8000000000ULL; // 500G
typedef DefaultSizeClassMap SizeClassMap;
-# else
+# elif SANITIZER_APPLE
const uptr kAllocatorSpace = 0x600000000000ULL;
const uptr kAllocatorSize = 0x40000000000ULL; // 4T.
typedef DefaultSizeClassMap SizeClassMap;
-# endif
+# else
+const uptr kAllocatorSpace = 0x500000000000ULL;
+const uptr kAllocatorSize = 0x40000000000ULL; // 4T.
+typedef DefaultSizeClassMap SizeClassMap;
+# endif
template <typename AddressSpaceViewTy>
struct AP64 { // Allocator64 parameters. Deliberately using a short name.
static const uptr kSpaceBeg = kAllocatorSpace;

View File

@ -156,3 +156,4 @@ D158066-simd-ppc64el.patch
D142688-loong64.diff
remove-unused-imp-module.diff
libsanitizer-timebits.diff
fb77ca05ffb4f8e666878f2f6718a9fb4d686839.diff