Skip to content

Commit d286540

Browse files
[sanitizer_common] Introduce SANITIZER_MMAP_BEGIN macro (#147645)
To prepare for other platforms, such as 64-bit AIX, that have a non-zero mmap beginning address. --------- Co-authored-by: David Justo <david.justo.1996@gmail.com>
1 parent 28aa5a6 commit d286540

File tree

6 files changed

+8
-5
lines changed

6 files changed

+8
-5
lines changed

compiler-rt/lib/asan/asan_allocator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ using PrimaryAllocator = PrimaryAllocatorASVT<LocalAddressSpaceView>;
239239
typedef CompactSizeClassMap SizeClassMap;
240240
template <typename AddressSpaceViewTy>
241241
struct AP32 {
242-
static const uptr kSpaceBeg = 0;
242+
static const uptr kSpaceBeg = SANITIZER_MMAP_BEGIN;
243243
static const u64 kSpaceSize = SANITIZER_MMAP_RANGE_SIZE;
244244
static const uptr kMetadataSize = 0;
245245
typedef __asan::SizeClassMap SizeClassMap;

compiler-rt/lib/lsan/lsan_allocator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ struct ChunkMetadata {
5353
#if !SANITIZER_CAN_USE_ALLOCATOR64
5454
template <typename AddressSpaceViewTy>
5555
struct AP32 {
56-
static const uptr kSpaceBeg = 0;
56+
static const uptr kSpaceBeg = SANITIZER_MMAP_BEGIN;
5757
static const u64 kSpaceSize = SANITIZER_MMAP_RANGE_SIZE;
5858
static const uptr kMetadataSize = sizeof(ChunkMetadata);
5959
typedef __sanitizer::CompactSizeClassMap SizeClassMap;

compiler-rt/lib/msan/msan_allocator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ struct MsanMapUnmapCallback {
5656
const uptr kMaxAllowedMallocSize = 2UL << 30;
5757

5858
struct AP32 {
59-
static const uptr kSpaceBeg = 0;
59+
static const uptr kSpaceBeg = SANITIZER_MMAP_BEGIN;
6060
static const u64 kSpaceSize = SANITIZER_MMAP_RANGE_SIZE;
6161
static const uptr kMetadataSize = sizeof(Metadata);
6262
using SizeClassMap = __sanitizer::CompactSizeClassMap;

compiler-rt/lib/sanitizer_common/sanitizer_allocator_internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace __sanitizer {
2323
typedef CompactSizeClassMap InternalSizeClassMap;
2424

2525
struct AP32 {
26-
static const uptr kSpaceBeg = 0;
26+
static const uptr kSpaceBeg = SANITIZER_MMAP_BEGIN;
2727
static const u64 kSpaceSize = SANITIZER_MMAP_RANGE_SIZE;
2828
static const uptr kMetadataSize = 0;
2929
typedef InternalSizeClassMap SizeClassMap;

compiler-rt/lib/sanitizer_common/sanitizer_platform.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,9 @@
318318
# endif
319319
#endif
320320

321+
// The first address that can be returned by mmap.
322+
#define SANITIZER_MMAP_BEGIN 0
323+
321324
// The range of addresses which can be returned my mmap.
322325
// FIXME: this value should be different on different platforms. Larger values
323326
// will still work but will consume more memory for TwoLevelByteMap.

compiler-rt/lib/tsan/rtl/tsan_rtl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ struct MapUnmapCallback;
6262
defined(__powerpc__) || SANITIZER_RISCV64
6363

6464
struct AP32 {
65-
static const uptr kSpaceBeg = 0;
65+
static const uptr kSpaceBeg = SANITIZER_MMAP_BEGIN;
6666
static const u64 kSpaceSize = SANITIZER_MMAP_RANGE_SIZE;
6767
static const uptr kMetadataSize = 0;
6868
typedef __sanitizer::CompactSizeClassMap SizeClassMap;

0 commit comments

Comments
 (0)