diff options
author | Andreas Kling <kling@serenityos.org> | 2021-03-09 09:32:23 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-03-09 11:31:18 +0100 |
commit | b940dd4fa8532f1527df30a179cce342fc49ad73 (patch) | |
tree | 80dccf667cc7ce2c5abeb4a90c8f3b77341e5bef /Userland | |
parent | 9588f01739179bebbed960ceecbad92bca90d7f9 (diff) | |
download | serenity-b940dd4fa8532f1527df30a179cce342fc49ad73.zip |
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.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/DevTools/UserspaceEmulator/MmapRegion.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Userland/DevTools/UserspaceEmulator/MmapRegion.cpp b/Userland/DevTools/UserspaceEmulator/MmapRegion.cpp index 4661feb656..43655962e0 100644 --- a/Userland/DevTools/UserspaceEmulator/MmapRegion.cpp +++ b/Userland/DevTools/UserspaceEmulator/MmapRegion.cpp @@ -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); + } } } |