Bix
8 months ago
committed by
crueter
No known key found for this signature in database
GPG Key ID: 425ACD2D4830EBC6
1 changed files with
2 additions and
2 deletions
-
src/common/host_memory.cpp
|
|
@ -387,10 +387,10 @@ static void* ChooseVirtualBase(size_t virtual_size) { |
|
|
uintptr_t hint_address = ((rng() % range) + lower) * HugePageSize; |
|
|
uintptr_t hint_address = ((rng() % range) + lower) * HugePageSize; |
|
|
|
|
|
|
|
|
// Try to map.
|
|
|
// Try to map.
|
|
|
// Note: we may be able to take advantage of MAP_FIXED_NOREPLACE here.
|
|
|
|
|
|
|
|
|
// Added MAP_FIXED_NOREPLACE here to stop mprotect eventually (20+ mins) failing with out of memory.
|
|
|
void* map_pointer = |
|
|
void* map_pointer = |
|
|
mmap(reinterpret_cast<void*>(hint_address), virtual_size, PROT_READ | PROT_WRITE, |
|
|
mmap(reinterpret_cast<void*>(hint_address), virtual_size, PROT_READ | PROT_WRITE, |
|
|
MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE, -1, 0); |
|
|
|
|
|
|
|
|
MAP_PRIVATE | MAP_ANONYMOUS | MAP_NORESERVE | MAP_FIXED_NOREPLACE, -1, 0); |
|
|
|
|
|
|
|
|
// If we successfully mapped, we're done.
|
|
|
// If we successfully mapped, we're done.
|
|
|
if (reinterpret_cast<uintptr_t>(map_pointer) == hint_address) { |
|
|
if (reinterpret_cast<uintptr_t>(map_pointer) == hint_address) { |
|
|
|