Merge pull request #13791 from achurch/linux-mmap-commit-fix

Linux: Properly avoid committing address space for large mmap().
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2020-12-19 14:54:04 +01:00
commit 0da96ff119
1 file changed
+1 -1
+1 -1
View File
@@ -108,7 +108,7 @@ u8* MemArena::Find4GBBase() {
// aligned to 4GB for the movk trick. We can ensure that we get an aligned 4GB
// address by grabbing 8GB and aligning the pointer.
const uint64_t EIGHT_GIGS = 0x200000000ULL;
void *base = mmap(0, EIGHT_GIGS, PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED | MAP_NORESERVE, -1, 0);
void *base = mmap(0, EIGHT_GIGS, PROT_NONE, MAP_ANON | MAP_PRIVATE | MAP_NORESERVE, -1, 0);
if (base && base != MAP_FAILED) {
INFO_LOG(MEMMAP, "base: %p", base);
uint64_t aligned_base = ((uint64_t)base + 0xFFFFFFFF) & ~0xFFFFFFFFULL;