mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 00:27:43 +00:00
Kernel: Implement some basic stack pointer validation
VM regions can now be marked as stack regions, which is then validated on syscall, and on page fault. If a thread is caught with its stack pointer pointing into anything that's *not* a Region with its stack bit set, we'll crash the whole process with SIGSTKFLT. Userspace must now allocate custom stacks by using mmap() with the new MAP_STACK flag. This mechanism was first introduced in OpenBSD, and now we have it too, yay! :^)
This commit is contained in:
parent
197ed1bb2a
commit
794758df3a
12 changed files with 101 additions and 5 deletions
|
@ -50,6 +50,9 @@ public:
|
|||
bool is_shared() const { return m_shared; }
|
||||
void set_shared(bool shared) { m_shared = shared; }
|
||||
|
||||
bool is_stack() const { return m_stack; }
|
||||
void set_stack(bool stack) { m_stack = stack; }
|
||||
|
||||
bool is_user_accessible() const { return m_user_accessible; }
|
||||
|
||||
PageFaultResponse handle_fault(const PageFault&);
|
||||
|
@ -141,5 +144,6 @@ private:
|
|||
u8 m_access { 0 };
|
||||
bool m_shared { false };
|
||||
bool m_user_accessible { false };
|
||||
bool m_stack { false };
|
||||
mutable OwnPtr<Bitmap> m_cow_map;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue