UserspaceEmulator: Never try to mprotect(PROT_EXEC) MmapRegion backing

We never want to map host memory executable anyway, so let's always
mask off the PROT_EXEC bit.
This commit is contained in:
Andreas Kling 2021-03-09 09:32:23 +01:00
parent 9588f01739
commit b940dd4fa8

View file

@ -242,7 +242,10 @@ void MmapRegion::set_prot(int prot)
set_writable(prot & PROT_WRITE);
set_executable(prot & PROT_EXEC);
if (m_file_backed) {
mprotect(m_data, size(), prot);
if (mprotect(m_data, size(), prot & ~PROT_EXEC) < 0) {
perror("MmapRegion::set_prot: mprotect");
exit(1);
}
}
}