diff options
author | Andreas Kling <kling@serenityos.org> | 2021-02-02 19:56:11 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-02-02 20:13:44 +0100 |
commit | 823186031d9250217f9a51829d34a96b74113334 (patch) | |
tree | fc7506c59649a5765d726f538d94f5f886d1e980 /Kernel/Process.h | |
parent | d57b4128a194066a03a3224473463d7756ade3f7 (diff) | |
download | serenity-823186031d9250217f9a51829d34a96b74113334.zip |
Kernel: Add a way to specify which memory regions can make syscalls
This patch adds sys$msyscall() which is loosely based on an OpenBSD
mechanism for preventing syscalls from non-blessed memory regions.
It works similarly to pledge and unveil, you can call it as many
times as you like, and when you're finished, you call it with a null
pointer and it will stop accepting new regions from then on.
If a syscall later happens and doesn't originate from one of the
previously blessed regions, the kernel will simply crash the process.
Diffstat (limited to 'Kernel/Process.h')
-rw-r--r-- | Kernel/Process.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Kernel/Process.h b/Kernel/Process.h index 62d5a71f89..2acf335f4e 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -266,6 +266,7 @@ public: int sys$set_mmap_name(Userspace<const Syscall::SC_set_mmap_name_params*>); int sys$mprotect(void*, size_t, int prot); int sys$madvise(void*, size_t, int advice); + int sys$msyscall(void*); int sys$purge(int mode); int sys$select(const Syscall::SC_select_params*); int sys$poll(Userspace<const Syscall::SC_poll_params*>); @@ -510,6 +511,8 @@ public: PerformanceEventBuffer* perf_events() { return m_perf_event_buffer; } + bool enforces_syscall_regions() const { return m_enforces_syscall_regions; } + private: friend class MemoryManager; friend class Scheduler; @@ -648,6 +651,8 @@ private: RefPtr<Timer> m_alarm_timer; + bool m_enforces_syscall_regions { false }; + bool m_has_promises { false }; u32 m_promises { 0 }; bool m_has_execpromises { false }; |