mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-12 04:04:11 +02:00
When loading an ELF file (usually PT_EXEC), we would have BSS regions that ended up in the high pages of the address space. We would then attempt mapping BRK after whatever the highest address ending up being. This was problematic because we used `MAP_FIXED` which means that the BRK region could cross in to 64-bit address space, overwrite VDSO, overwrite the stack, vsyscall, maybe a couple of other things. Instead of letting that happen, reorder some of the logic so that in `LoadElfFile` will ensure the full `BRK_SIZE` is allocated (or return zero) and then we can ensure we're never overwriting other various memory regions. This doesn't fix two fundamental issues that FEX has with brk: * If BRK gets mapped below the ELF, that should mean it isn't mapped at all * Linux-isms, doubt this breaks new software * We still map the full 8MB, which isn't correct * I'm working on fixing this issue, which is why I encountered this.