1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:08:10 +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

@ -50,13 +50,15 @@ public:
u8* data() { return m_data; }
u8* shadow_data() { return m_shadow_data; }
bool is_readable() const { return m_prot & PROT_READ; }
bool is_writable() const { return m_prot & PROT_WRITE; }
bool is_executable() const { return m_prot & PROT_EXEC; }
virtual bool is_readable() const override { return m_prot & PROT_READ; }
virtual bool is_writable() const override { return m_prot & PROT_WRITE; }
virtual bool is_executable() const override { return m_prot & PROT_EXEC; }
bool is_malloc_block() const { return m_malloc; }
void set_malloc(bool b) { m_malloc = b; }
void set_prot(int prot) { m_prot = prot; }
private:
MmapRegion(u32 base, u32 size, int prot);
virtual bool is_mmap() const override { return true; }