Skip to content

Commit 97d73cc

Browse files
Fix "MemorySanitizer can not mmap the shadow memory"
High-entropy ASLR (e.g. vm.mmap_rnd_bits=32) can generate an incompatible memory layout (see google/sanitizers#1614). To fix this, we cherry-pick the following commits: 1. "[msan] Increase size of app/shadow/origin mappings on aarch64" - llvm/llvm-project@b726df1 2. "[msan] Add 'MappingDesc::ALLOCATOR' type and check it is available (#85153)" - llvm/llvm-project@af2bf86 3. "[msan] Re-exec with no ASLR if memory layout is incompatible on Linux (#85142)" - llvm/llvm-project@c2a5703 If the problem persists, disable ASLR or reduce the entropy to `vm.mmap_rnd_bits=28`.
1 parent e0eee84 commit 97d73cc

File tree

4 files changed

+99
-115
lines changed

4 files changed

+99
-115
lines changed

compiler-rt/lib/msan/msan.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ void __msan_init() {
454454
__msan_clear_on_return();
455455
if (__msan_get_track_origins())
456456
VPrintf(1, "msan_track_origins\n");
457-
if (!InitShadow(__msan_get_track_origins())) {
457+
if (!InitShadowWithReExec(__msan_get_track_origins())) {
458458
Printf("FATAL: MemorySanitizer can not mmap the shadow memory.\n");
459459
Printf("FATAL: Make sure to compile with -fPIE and to link with -pie.\n");
460460
Printf("FATAL: Disabling ASLR is known to cause this error.\n");

compiler-rt/lib/msan/msan.h

Lines changed: 42 additions & 99 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,18 @@ struct MappingDesc {
3333
uptr start;
3434
uptr end;
3535
enum Type {
36-
INVALID, APP, SHADOW, ORIGIN
36+
INVALID = 1,
37+
ALLOCATOR = 2,
38+
APP = 4,
39+
SHADOW = 8,
40+
ORIGIN = 16,
3741
} type;
3842
const char *name;
3943
};
4044

41-
45+
// Note: MappingDesc::ALLOCATOR entries are only used to check for memory
46+
// layout compatibility. The actual allocation settings are in
47+
// msan_allocator.cpp, which need to be kept in sync.
4248
#if SANITIZER_LINUX && defined(__mips64)
4349

4450
// MIPS64 maps:
@@ -65,98 +71,30 @@ const MappingDesc kMemoryLayout[] = {
6571

6672
#elif SANITIZER_LINUX && defined(__aarch64__)
6773

68-
// The mapping describes both 39-bits, 42-bits, and 48-bits VMA. AArch64
69-
// maps:
70-
// - 0x0000000000000-0x0000010000000: 39/42/48-bits program own segments
71-
// - 0x0005500000000-0x0005600000000: 39-bits PIE program segments
72-
// - 0x0007f80000000-0x0007fffffffff: 39-bits libraries segments
73-
// - 0x002aa00000000-0x002ab00000000: 42-bits PIE program segments
74-
// - 0x003ff00000000-0x003ffffffffff: 42-bits libraries segments
75-
// - 0x0aaaaa0000000-0x0aaab00000000: 48-bits PIE program segments
76-
// - 0xffff000000000-0x1000000000000: 48-bits libraries segments
77-
// It is fragmented in multiples segments to increase the memory available
78-
// on 42-bits (12.21% of total VMA available for 42-bits and 13.28 for
79-
// 39 bits). The 48-bits segments only cover the usual PIE/default segments
80-
// plus some more segments (262144GB total, 0.39% total VMA).
74+
// The mapping assumes 48-bit VMA. AArch64 maps:
75+
// - 0x0000000000000-0x0100000000000: 39/42/48-bits program own segments
76+
// - 0x0a00000000000-0x0b00000000000: 48-bits PIE program segments
77+
// Ideally, this would extend to 0x0c00000000000 (2^45 bytes - the
78+
// maximum ASLR region for 48-bit VMA) but it is too hard to fit in
79+
// the larger app/shadow/origin regions.
80+
// - 0x0e00000000000-0x1000000000000: 48-bits libraries segments
8181
const MappingDesc kMemoryLayout[] = {
82-
{0x00000000000ULL, 0x01000000000ULL, MappingDesc::INVALID, "invalid"},
83-
{0x01000000000ULL, 0x02000000000ULL, MappingDesc::SHADOW, "shadow-2"},
84-
{0x02000000000ULL, 0x03000000000ULL, MappingDesc::ORIGIN, "origin-2"},
85-
{0x03000000000ULL, 0x04000000000ULL, MappingDesc::SHADOW, "shadow-1"},
86-
{0x04000000000ULL, 0x05000000000ULL, MappingDesc::ORIGIN, "origin-1"},
87-
{0x05000000000ULL, 0x06000000000ULL, MappingDesc::APP, "app-1"},
88-
{0x06000000000ULL, 0x07000000000ULL, MappingDesc::INVALID, "invalid"},
89-
{0x07000000000ULL, 0x08000000000ULL, MappingDesc::APP, "app-2"},
90-
{0x08000000000ULL, 0x09000000000ULL, MappingDesc::INVALID, "invalid"},
91-
// The mappings below are used only for 42-bits VMA.
92-
{0x09000000000ULL, 0x0A000000000ULL, MappingDesc::SHADOW, "shadow-3"},
93-
{0x0A000000000ULL, 0x0B000000000ULL, MappingDesc::ORIGIN, "origin-3"},
94-
{0x0B000000000ULL, 0x0F000000000ULL, MappingDesc::INVALID, "invalid"},
95-
{0x0F000000000ULL, 0x10000000000ULL, MappingDesc::APP, "app-3"},
96-
{0x10000000000ULL, 0x11000000000ULL, MappingDesc::INVALID, "invalid"},
97-
{0x11000000000ULL, 0x12000000000ULL, MappingDesc::APP, "app-4"},
98-
{0x12000000000ULL, 0x17000000000ULL, MappingDesc::INVALID, "invalid"},
99-
{0x17000000000ULL, 0x18000000000ULL, MappingDesc::SHADOW, "shadow-4"},
100-
{0x18000000000ULL, 0x19000000000ULL, MappingDesc::ORIGIN, "origin-4"},
101-
{0x19000000000ULL, 0x20000000000ULL, MappingDesc::INVALID, "invalid"},
102-
{0x20000000000ULL, 0x21000000000ULL, MappingDesc::APP, "app-5"},
103-
{0x21000000000ULL, 0x26000000000ULL, MappingDesc::INVALID, "invalid"},
104-
{0x26000000000ULL, 0x27000000000ULL, MappingDesc::SHADOW, "shadow-5"},
105-
{0x27000000000ULL, 0x28000000000ULL, MappingDesc::ORIGIN, "origin-5"},
106-
{0x28000000000ULL, 0x29000000000ULL, MappingDesc::SHADOW, "shadow-7"},
107-
{0x29000000000ULL, 0x2A000000000ULL, MappingDesc::ORIGIN, "origin-7"},
108-
{0x2A000000000ULL, 0x2B000000000ULL, MappingDesc::APP, "app-6"},
109-
{0x2B000000000ULL, 0x2C000000000ULL, MappingDesc::INVALID, "invalid"},
110-
{0x2C000000000ULL, 0x2D000000000ULL, MappingDesc::SHADOW, "shadow-6"},
111-
{0x2D000000000ULL, 0x2E000000000ULL, MappingDesc::ORIGIN, "origin-6"},
112-
{0x2E000000000ULL, 0x2F000000000ULL, MappingDesc::APP, "app-7"},
113-
{0x2F000000000ULL, 0x39000000000ULL, MappingDesc::INVALID, "invalid"},
114-
{0x39000000000ULL, 0x3A000000000ULL, MappingDesc::SHADOW, "shadow-9"},
115-
{0x3A000000000ULL, 0x3B000000000ULL, MappingDesc::ORIGIN, "origin-9"},
116-
{0x3B000000000ULL, 0x3C000000000ULL, MappingDesc::APP, "app-8"},
117-
{0x3C000000000ULL, 0x3D000000000ULL, MappingDesc::INVALID, "invalid"},
118-
{0x3D000000000ULL, 0x3E000000000ULL, MappingDesc::SHADOW, "shadow-8"},
119-
{0x3E000000000ULL, 0x3F000000000ULL, MappingDesc::ORIGIN, "origin-8"},
120-
{0x3F000000000ULL, 0x40000000000ULL, MappingDesc::APP, "app-9"},
121-
// The mappings below are used only for 48-bits VMA.
122-
// TODO(unknown): 48-bit mapping ony covers the usual PIE, non-PIE
123-
// segments and some more segments totalizing 262144GB of VMA (which cover
124-
// only 0.32% of all 48-bit VMA). Memory availability can be increase by
125-
// adding multiple application segments like 39 and 42 mapping.
126-
{0x0040000000000ULL, 0x0041000000000ULL, MappingDesc::INVALID, "invalid"},
127-
{0x0041000000000ULL, 0x0042000000000ULL, MappingDesc::APP, "app-10"},
128-
{0x0042000000000ULL, 0x0047000000000ULL, MappingDesc::INVALID, "invalid"},
129-
{0x0047000000000ULL, 0x0048000000000ULL, MappingDesc::SHADOW, "shadow-10"},
130-
{0x0048000000000ULL, 0x0049000000000ULL, MappingDesc::ORIGIN, "origin-10"},
131-
{0x0049000000000ULL, 0x0050000000000ULL, MappingDesc::INVALID, "invalid"},
132-
{0x0050000000000ULL, 0x0051000000000ULL, MappingDesc::APP, "app-11"},
133-
{0x0051000000000ULL, 0x0056000000000ULL, MappingDesc::INVALID, "invalid"},
134-
{0x0056000000000ULL, 0x0057000000000ULL, MappingDesc::SHADOW, "shadow-11"},
135-
{0x0057000000000ULL, 0x0058000000000ULL, MappingDesc::ORIGIN, "origin-11"},
136-
{0x0058000000000ULL, 0x0059000000000ULL, MappingDesc::APP, "app-12"},
137-
{0x0059000000000ULL, 0x005E000000000ULL, MappingDesc::INVALID, "invalid"},
138-
{0x005E000000000ULL, 0x005F000000000ULL, MappingDesc::SHADOW, "shadow-12"},
139-
{0x005F000000000ULL, 0x0060000000000ULL, MappingDesc::ORIGIN, "origin-12"},
140-
{0x0060000000000ULL, 0x0061000000000ULL, MappingDesc::INVALID, "invalid"},
141-
{0x0061000000000ULL, 0x0062000000000ULL, MappingDesc::APP, "app-13"},
142-
{0x0062000000000ULL, 0x0067000000000ULL, MappingDesc::INVALID, "invalid"},
143-
{0x0067000000000ULL, 0x0068000000000ULL, MappingDesc::SHADOW, "shadow-13"},
144-
{0x0068000000000ULL, 0x0069000000000ULL, MappingDesc::ORIGIN, "origin-13"},
145-
{0x0069000000000ULL, 0x0AAAAA0000000ULL, MappingDesc::INVALID, "invalid"},
146-
{0x0AAAAA0000000ULL, 0x0AAAB00000000ULL, MappingDesc::APP, "app-14"},
147-
{0x0AAAB00000000ULL, 0x0AACAA0000000ULL, MappingDesc::INVALID, "invalid"},
148-
{0x0AACAA0000000ULL, 0x0AACB00000000ULL, MappingDesc::SHADOW, "shadow-14"},
149-
{0x0AACB00000000ULL, 0x0AADAA0000000ULL, MappingDesc::INVALID, "invalid"},
150-
{0x0AADAA0000000ULL, 0x0AADB00000000ULL, MappingDesc::ORIGIN, "origin-14"},
151-
{0x0AADB00000000ULL, 0x0FF9F00000000ULL, MappingDesc::INVALID, "invalid"},
152-
{0x0FF9F00000000ULL, 0x0FFA000000000ULL, MappingDesc::SHADOW, "shadow-15"},
153-
{0x0FFA000000000ULL, 0x0FFAF00000000ULL, MappingDesc::INVALID, "invalid"},
154-
{0x0FFAF00000000ULL, 0x0FFB000000000ULL, MappingDesc::ORIGIN, "origin-15"},
155-
{0x0FFB000000000ULL, 0x0FFFF00000000ULL, MappingDesc::INVALID, "invalid"},
156-
{0x0FFFF00000000ULL, 0x1000000000000ULL, MappingDesc::APP, "app-15"},
82+
{0X0000000000000, 0X0100000000000, MappingDesc::APP, "app-10-13"},
83+
{0X0100000000000, 0X0200000000000, MappingDesc::SHADOW, "shadow-14"},
84+
{0X0200000000000, 0X0300000000000, MappingDesc::INVALID, "invalid"},
85+
{0X0300000000000, 0X0400000000000, MappingDesc::ORIGIN, "origin-14"},
86+
{0X0400000000000, 0X0600000000000, MappingDesc::SHADOW, "shadow-15"},
87+
{0X0600000000000, 0X0800000000000, MappingDesc::ORIGIN, "origin-15"},
88+
{0X0800000000000, 0X0A00000000000, MappingDesc::INVALID, "invalid"},
89+
{0X0A00000000000, 0X0B00000000000, MappingDesc::APP, "app-14"},
90+
{0X0B00000000000, 0X0C00000000000, MappingDesc::SHADOW, "shadow-10-13"},
91+
{0X0C00000000000, 0X0D00000000000, MappingDesc::INVALID, "invalid"},
92+
{0X0D00000000000, 0X0E00000000000, MappingDesc::ORIGIN, "origin-10-13"},
93+
{0x0E00000000000, 0x0E40000000000, MappingDesc::ALLOCATOR, "allocator"},
94+
{0X0E40000000000, 0X1000000000000, MappingDesc::APP, "app-15"},
15795
};
158-
# define MEM_TO_SHADOW(mem) ((uptr)mem ^ 0x6000000000ULL)
159-
# define SHADOW_TO_ORIGIN(shadow) (((uptr)(shadow)) + 0x1000000000ULL)
96+
# define MEM_TO_SHADOW(mem) ((uptr)mem ^ 0xB00000000000ULL)
97+
# define SHADOW_TO_ORIGIN(shadow) (((uptr)(shadow)) + 0x200000000000ULL)
16098

16199
#elif SANITIZER_LINUX && SANITIZER_PPC64
162100
const MappingDesc kMemoryLayout[] = {
@@ -166,7 +104,8 @@ const MappingDesc kMemoryLayout[] = {
166104
{0x180200000000ULL, 0x1C0000000000ULL, MappingDesc::INVALID, "invalid"},
167105
{0x1C0000000000ULL, 0x2C0200000000ULL, MappingDesc::ORIGIN, "origin"},
168106
{0x2C0200000000ULL, 0x300000000000ULL, MappingDesc::INVALID, "invalid"},
169-
{0x300000000000ULL, 0x800000000000ULL, MappingDesc::APP, "high memory"}};
107+
{0x300000000000ULL, 0x320000000000ULL, MappingDesc::ALLOCATOR, "allocator"},
108+
{0x320000000000ULL, 0x800000000000ULL, MappingDesc::APP, "high memory"}};
170109

171110
// Various kernels use different low end ranges but we can combine them into one
172111
// big range. They also use different high end ranges but we can map them all to
@@ -189,7 +128,8 @@ const MappingDesc kMemoryLayout[] = {
189128
{0x180000000000ULL, 0x1C0000000000ULL, MappingDesc::INVALID, "invalid"},
190129
{0x1C0000000000ULL, 0x2C0000000000ULL, MappingDesc::ORIGIN, "origin"},
191130
{0x2C0000000000ULL, 0x440000000000ULL, MappingDesc::INVALID, "invalid"},
192-
{0x440000000000ULL, 0x500000000000ULL, MappingDesc::APP, "high memory"}};
131+
{0x440000000000ULL, 0x460000000000ULL, MappingDesc::ALLOCATOR, "allocator"},
132+
{0x460000000000ULL, 0x500000000000ULL, MappingDesc::APP, "high memory"}};
193133

194134
#define MEM_TO_SHADOW(mem) \
195135
((((uptr)(mem)) & ~0xC00000000000ULL) + 0x080000000000ULL)
@@ -269,7 +209,8 @@ const MappingDesc kMemoryLayout[] = {
269209
{0x510000000000ULL, 0x600000000000ULL, MappingDesc::APP, "app-2"},
270210
{0x600000000000ULL, 0x610000000000ULL, MappingDesc::ORIGIN, "origin-1"},
271211
{0x610000000000ULL, 0x700000000000ULL, MappingDesc::INVALID, "invalid"},
272-
{0x700000000000ULL, 0x800000000000ULL, MappingDesc::APP, "app-3"}};
212+
{0x700000000000ULL, 0x740000000000ULL, MappingDesc::ALLOCATOR, "allocator"},
213+
{0x740000000000ULL, 0x800000000000ULL, MappingDesc::APP, "app-3"}};
273214
#define MEM_TO_SHADOW(mem) (((uptr)(mem)) ^ 0x500000000000ULL)
274215
#define SHADOW_TO_ORIGIN(mem) (((uptr)(mem)) + 0x100000000000ULL)
275216
#endif // MSAN_LINUX_X86_64_OLD_MAPPING
@@ -285,20 +226,22 @@ const uptr kMemoryLayoutSize = sizeof(kMemoryLayout) / sizeof(kMemoryLayout[0]);
285226
#ifndef __clang__
286227
__attribute__((optimize("unroll-loops")))
287228
#endif
288-
inline bool addr_is_type(uptr addr, MappingDesc::Type mapping_type) {
229+
inline bool
230+
addr_is_type(uptr addr, int mapping_types) {
289231
// It is critical for performance that this loop is unrolled (because then it is
290232
// simplified into just a few constant comparisons).
291233
#ifdef __clang__
292234
#pragma unroll
293235
#endif
294236
for (unsigned i = 0; i < kMemoryLayoutSize; ++i)
295-
if (kMemoryLayout[i].type == mapping_type &&
237+
if (kMemoryLayout[i].type & mapping_types &&
296238
addr >= kMemoryLayout[i].start && addr < kMemoryLayout[i].end)
297239
return true;
298240
return false;
299241
}
300242

301-
#define MEM_IS_APP(mem) addr_is_type((uptr)(mem), MappingDesc::APP)
243+
#define MEM_IS_APP(mem) \
244+
(addr_is_type((uptr)(mem), MappingDesc::APP | MappingDesc::ALLOCATOR))
302245
#define MEM_IS_SHADOW(mem) addr_is_type((uptr)(mem), MappingDesc::SHADOW)
303246
#define MEM_IS_ORIGIN(mem) addr_is_type((uptr)(mem), MappingDesc::ORIGIN)
304247

@@ -312,7 +255,7 @@ extern bool msan_init_is_running;
312255
extern int msan_report_count;
313256

314257
bool ProtectRange(uptr beg, uptr end);
315-
bool InitShadow(bool init_origins);
258+
bool InitShadowWithReExec(bool init_origins);
316259
char *GetProcSelfMaps();
317260
void InitializeInterceptors();
318261

compiler-rt/lib/msan/msan_linux.cpp

Lines changed: 54 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
#include <pthread.h>
2424
#include <stdio.h>
2525
#include <stdlib.h>
26+
# if SANITIZER_LINUX
27+
# include <sys/personality.h>
28+
# endif
2629
#include <signal.h>
2730
#include <unistd.h>
2831
#include <unwind.h>
@@ -41,11 +44,13 @@ void ReportMapRange(const char *descr, uptr beg, uptr size) {
4144
}
4245
}
4346

44-
static bool CheckMemoryRangeAvailability(uptr beg, uptr size) {
47+
static bool CheckMemoryRangeAvailability(uptr beg, uptr size, bool verbose) {
4548
if (size > 0) {
4649
uptr end = beg + size - 1;
4750
if (!MemoryRangeIsAvailable(beg, end)) {
48-
Printf("FATAL: Memory range 0x%zx - 0x%zx is not available.\n", beg, end);
51+
if (verbose)
52+
Printf("FATAL: Memory range 0x%zx - 0x%zx is not available.\n", beg,
53+
end);
4954
return false;
5055
}
5156
}
@@ -84,7 +89,7 @@ static void CheckMemoryLayoutSanity() {
8489
CHECK(addr_is_type(start, type));
8590
CHECK(addr_is_type((start + end) / 2, type));
8691
CHECK(addr_is_type(end - 1, type));
87-
if (type == MappingDesc::APP) {
92+
if (type == MappingDesc::APP || type == MappingDesc::ALLOCATOR) {
8893
uptr addr = start;
8994
CHECK(MEM_IS_SHADOW(MEM_TO_SHADOW(addr)));
9095
CHECK(MEM_IS_ORIGIN(MEM_TO_ORIGIN(addr)));
@@ -104,7 +109,7 @@ static void CheckMemoryLayoutSanity() {
104109
}
105110
}
106111

107-
bool InitShadow(bool init_origins) {
112+
static bool InitShadow(bool init_origins, bool dry_run) {
108113
// Let user know mapping parameters first.
109114
VPrintf(1, "__msan_init %p\n", reinterpret_cast<void *>(&__msan_init));
110115
for (unsigned i = 0; i < kMemoryLayoutSize; ++i)
@@ -114,8 +119,9 @@ bool InitShadow(bool init_origins) {
114119
CheckMemoryLayoutSanity();
115120

116121
if (!MEM_IS_APP(&__msan_init)) {
117-
Printf("FATAL: Code %p is out of application range. Non-PIE build?\n",
118-
reinterpret_cast<void *>(&__msan_init));
122+
if (!dry_run)
123+
Printf("FATAL: Code %p is out of application range. Non-PIE build?\n",
124+
reinterpret_cast<void *>(&__msan_init));
119125
return false;
120126
}
121127

@@ -136,27 +142,62 @@ bool InitShadow(bool init_origins) {
136142
bool protect = type == MappingDesc::INVALID ||
137143
(!init_origins && type == MappingDesc::ORIGIN);
138144
CHECK(!(map && protect));
139-
if (!map && !protect)
140-
CHECK(type == MappingDesc::APP);
145+
if (!map && !protect) {
146+
CHECK(type == MappingDesc::APP || type == MappingDesc::ALLOCATOR);
147+
148+
if (dry_run && type == MappingDesc::ALLOCATOR &&
149+
!CheckMemoryRangeAvailability(start, size, !dry_run))
150+
return false;
151+
}
141152
if (map) {
142-
if (!CheckMemoryRangeAvailability(start, size))
153+
if (dry_run && !CheckMemoryRangeAvailability(start, size, !dry_run))
143154
return false;
144-
if (!MmapFixedSuperNoReserve(start, size, kMemoryLayout[i].name))
155+
if (!dry_run &&
156+
!MmapFixedSuperNoReserve(start, size, kMemoryLayout[i].name))
145157
return false;
146-
if (common_flags()->use_madv_dontdump)
158+
if (dry_run && common_flags()->use_madv_dontdump)
147159
DontDumpShadowMemory(start, size);
148160
}
149161
if (protect) {
150-
if (!CheckMemoryRangeAvailability(start, size))
162+
if (dry_run && !CheckMemoryRangeAvailability(start, size, !dry_run))
151163
return false;
152-
if (!ProtectMemoryRange(start, size, kMemoryLayout[i].name))
164+
if (!dry_run && !ProtectMemoryRange(start, size, kMemoryLayout[i].name))
153165
return false;
154166
}
155167
}
156168

157169
return true;
158170
}
159171

172+
bool InitShadowWithReExec(bool init_origins) {
173+
// Start with dry run: check layout is ok, but don't print warnings because
174+
// warning messages will cause tests to fail (even if we successfully re-exec
175+
// after the warning).
176+
bool success = InitShadow(__msan_get_track_origins(), true);
177+
if (!success) {
178+
# if SANITIZER_LINUX
179+
// Perhaps ASLR entropy is too high. If ASLR is enabled, re-exec without it.
180+
int old_personality = personality(0xffffffff);
181+
bool aslr_on =
182+
(old_personality != -1) && ((old_personality & ADDR_NO_RANDOMIZE) == 0);
183+
184+
if (aslr_on) {
185+
VReport(1,
186+
"WARNING: MemorySanitizer: memory layout is incompatible, "
187+
"possibly due to high-entropy ASLR.\n"
188+
"Re-execing with fixed virtual address space.\n"
189+
"N.B. reducing ASLR entropy is preferable.\n");
190+
CHECK_NE(personality(old_personality | ADDR_NO_RANDOMIZE), -1);
191+
ReExec();
192+
}
193+
# endif
194+
}
195+
196+
// The earlier dry run didn't actually map or protect anything. Run again in
197+
// non-dry run mode.
198+
return success && InitShadow(__msan_get_track_origins(), false);
199+
}
200+
160201
static void MsanAtExit(void) {
161202
if (flags()->print_stats && (flags()->atexit || msan_report_count > 0))
162203
ReportStats();

llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,9 +412,9 @@ static const MemoryMapParams Linux_S390X_MemoryMapParams = {
412412
// aarch64 Linux
413413
static const MemoryMapParams Linux_AArch64_MemoryMapParams = {
414414
0, // AndMask (not used)
415-
0x06000000000, // XorMask
415+
0x0B00000000000, // XorMask
416416
0, // ShadowBase (not used)
417-
0x01000000000, // OriginBase
417+
0x0200000000000, // OriginBase
418418
};
419419

420420
// aarch64 FreeBSD

0 commit comments

Comments
 (0)