Lines Matching +full:mem +full:- +full:base
1 //===-- msan.h --------------------------------------------------*- C++ -*-===//
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
12 //===----------------------------------------------------------------------===//
51 // - 0x0000000000-0x0200000000: Program own segments
52 // - 0xa200000000-0xc000000000: PIE program segments
53 // - 0xe200000000-0xffffffffff: libraries segments.
55 {0x000000000000ULL, 0x000200000000ULL, MappingDesc::APP, "app-1"},
57 {0x002200000000ULL, 0x004000000000ULL, MappingDesc::SHADOW, "shadow-2"},
59 {0x004200000000ULL, 0x006000000000ULL, MappingDesc::ORIGIN, "origin-2"},
61 {0x006200000000ULL, 0x008000000000ULL, MappingDesc::SHADOW, "shadow-3"},
62 {0x008000000000ULL, 0x008200000000ULL, MappingDesc::SHADOW, "shadow-1"},
63 {0x008200000000ULL, 0x00a000000000ULL, MappingDesc::ORIGIN, "origin-3"},
64 {0x00a000000000ULL, 0x00a200000000ULL, MappingDesc::ORIGIN, "origin-1"},
65 {0x00a200000000ULL, 0x00c000000000ULL, MappingDesc::APP, "app-2"},
67 {0x00e200000000ULL, 0x00ffffffffffULL, MappingDesc::APP, "app-3"}};
69 #define MEM_TO_SHADOW(mem) (((uptr)(mem)) ^ 0x8000000000ULL)
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
80 // - 0x0e00000000000-0x1000000000000: 48-bits libraries segments
82 {0X0000000000000, 0X0100000000000, MappingDesc::APP, "app-10-13"},
83 {0X0100000000000, 0X0200000000000, MappingDesc::SHADOW, "shadow-14"},
85 {0X0300000000000, 0X0400000000000, MappingDesc::ORIGIN, "origin-14"},
86 {0X0400000000000, 0X0600000000000, MappingDesc::SHADOW, "shadow-15"},
87 {0X0600000000000, 0X0800000000000, MappingDesc::ORIGIN, "origin-15"},
89 {0X0A00000000000, 0X0B00000000000, MappingDesc::APP, "app-14"},
90 {0X0B00000000000, 0X0C00000000000, MappingDesc::SHADOW, "shadow-10-13"},
92 {0X0D00000000000, 0X0E00000000000, MappingDesc::ORIGIN, "origin-10-13"},
94 {0X0E40000000000, 0X1000000000000, MappingDesc::APP, "app-15"},
96 # define MEM_TO_SHADOW(mem) ((uptr)mem ^ 0xB00000000000ULL)
101 // - 0x000000000000-0x010000000000: Program own segments
102 // - 0x555500000000-0x555600000000: PIE program segments
103 // - 0x7fff00000000-0x7fffffffffff: libraries segments.
105 {0x000000000000ULL, 0x010000000000ULL, MappingDesc::APP, "app-1"},
106 {0x010000000000ULL, 0x100000000000ULL, MappingDesc::SHADOW, "shadow-2"},
108 {0x110000000000ULL, 0x200000000000ULL, MappingDesc::ORIGIN, "origin-2"},
109 {0x200000000000ULL, 0x300000000000ULL, MappingDesc::SHADOW, "shadow-3"},
110 {0x300000000000ULL, 0x400000000000ULL, MappingDesc::ORIGIN, "origin-3"},
112 {0x500000000000ULL, 0x510000000000ULL, MappingDesc::SHADOW, "shadow-1"},
113 {0x510000000000ULL, 0x600000000000ULL, MappingDesc::APP, "app-2"},
114 {0x600000000000ULL, 0x610000000000ULL, MappingDesc::ORIGIN, "origin-1"},
117 {0x740000000000ULL, 0x800000000000ULL, MappingDesc::APP, "app-3"}};
118 # define MEM_TO_SHADOW(mem) (((uptr)(mem)) ^ 0x500000000000ULL)
135 // Maps low and high app ranges to contiguous space with zero base:
136 // Low: 0000 0000 0000 - 0001 ffff ffff -> 1000 0000 0000 - 1001 ffff ffff
137 // High: 3000 0000 0000 - 3fff ffff ffff -> 0000 0000 0000 - 0fff ffff ffff
138 // High: 4000 0000 0000 - 4fff ffff ffff -> 0000 0000 0000 - 0fff ffff ffff
139 // High: 7000 0000 0000 - 7fff ffff ffff -> 0000 0000 0000 - 0fff ffff ffff
140 #define LINEARIZE_MEM(mem) \
141 (((uptr)(mem) & ~0xE00000000000ULL) ^ 0x100000000000ULL)
142 #define MEM_TO_SHADOW(mem) (LINEARIZE_MEM((mem)) + 0x080000000000ULL)
156 #define MEM_TO_SHADOW(mem) \
157 ((((uptr)(mem)) & ~0xC00000000000ULL) + 0x080000000000ULL)
173 // Maps low and high app ranges to contiguous space with zero base:
174 // Low: 0000 0000 0000 - 01ff ffff ffff -> 4000 0000 0000 - 41ff ffff ffff
175 // High: c000 0000 0000 - ffff ffff ffff -> 0000 0000 0000 - 3fff ffff ffff
176 #define LINEARIZE_MEM(mem) \
177 (((uptr)(mem) & ~0x1800000000000ULL) ^ 0x400000000000ULL)
178 #define MEM_TO_SHADOW(mem) (LINEARIZE_MEM((mem)) + 0x200000000000ULL)
194 // Maps low and high app ranges to contiguous space with zero base:
195 // Low: 0000 0000 0000 - 00ff ffff ffff -> 2000 0000 0000 - 20ff ffff ffff
196 // High: 6000 0000 0000 - 7fff ffff ffff -> 0000 0000 0000 - 1fff ffff ffff
197 #define LINEARIZE_MEM(mem) \
198 (((uptr)(mem) & ~0xc00000000000ULL) ^ 0x200000000000ULL)
199 #define MEM_TO_SHADOW(mem) (LINEARIZE_MEM((mem)) + 0x100000000000ULL)
207 // non-PIE: main executable below 0x100000000, DSOs at 0x7f0000000000
210 {0x000000000000ULL, 0x010000000000ULL, MappingDesc::APP, "app-1"},
211 {0x010000000000ULL, 0x100000000000ULL, MappingDesc::SHADOW, "shadow-2"},
213 {0x110000000000ULL, 0x200000000000ULL, MappingDesc::ORIGIN, "origin-2"},
214 {0x200000000000ULL, 0x300000000000ULL, MappingDesc::SHADOW, "shadow-3"},
215 {0x300000000000ULL, 0x400000000000ULL, MappingDesc::ORIGIN, "origin-3"},
217 {0x500000000000ULL, 0x510000000000ULL, MappingDesc::SHADOW, "shadow-1"},
218 {0x510000000000ULL, 0x600000000000ULL, MappingDesc::APP, "app-2"},
219 {0x600000000000ULL, 0x610000000000ULL, MappingDesc::ORIGIN, "origin-1"},
222 {0x740000000000ULL, 0x800000000000ULL, MappingDesc::APP, "app-3"}};
223 #define MEM_TO_SHADOW(mem) (((uptr)(mem)) ^ 0x500000000000ULL)
224 #define SHADOW_TO_ORIGIN(mem) (((uptr)(mem)) + 0x100000000000ULL)
232 #define MEM_TO_ORIGIN(mem) (SHADOW_TO_ORIGIN(MEM_TO_SHADOW((mem))))
235 __attribute__((optimize("unroll-loops")))
251 #define MEM_IS_APP(mem) \
252 (addr_is_type((uptr)(mem), MappingDesc::APP | MappingDesc::ALLOCATOR))
253 #define MEM_IS_SHADOW(mem) addr_is_type((uptr)(mem), MappingDesc::SHADOW)
254 #define MEM_IS_ORIGIN(mem) addr_is_type((uptr)(mem), MappingDesc::ORIGIN)
311 common_flags()->fast_unwind_on_malloc, \
312 common_flags()->malloc_context_size); \
322 int size = flags()->store_context_size; \
325 stack.Unwind(pc, bp, nullptr, common_flags()->fast_unwind_on_malloc, \
335 stack.Unwind(pc, bp, nullptr, common_flags()->fast_unwind_on_fatal); \
344 if (msan_inited && (STACK)->size == 0) { \
345 (STACK)->Unwind(StackTrace::GetCurrentPc(), GET_CURRENT_FRAME(), nullptr, \
346 common_flags()->fast_unwind_on_fatal); \