1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:18:11 +00:00

UserspaceEmulator: Honor the read/write/execute bits in mmap regions

UE will now correctly crash when accessing an mmap memory region in
some way it's not supposed to be accessed.
This commit is contained in:
Andreas Kling 2020-11-14 15:13:50 +01:00
parent ef9ac8a8a2
commit d4509647d8
5 changed files with 72 additions and 5 deletions

View file

@ -134,6 +134,12 @@ void SoftCPU::update_code_cache()
auto* region = m_emulator.mmu().find_region({ cs(), eip() });
ASSERT(region);
if (!region->is_executable()) {
reportln("SoftCPU::update_code_cache: Non-readable region @ {:p}", eip());
Emulator::the().dump_backtrace();
TODO();
}
m_cached_code_ptr = region->cacheable_ptr(eip() - region->base());
m_cached_code_end = region->cacheable_ptr(region->size());
}