summaryrefslogtreecommitdiff
path: root/Kernel/VM/Region.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-02-02 19:56:11 +0100
committerAndreas Kling <kling@serenityos.org>2021-02-02 20:13:44 +0100
commit823186031d9250217f9a51829d34a96b74113334 (patch)
treefc7506c59649a5765d726f538d94f5f886d1e980 /Kernel/VM/Region.cpp
parentd57b4128a194066a03a3224473463d7756ade3f7 (diff)
downloadserenity-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/VM/Region.cpp')
-rw-r--r--Kernel/VM/Region.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp
index b21b2d9cd8..f8a27b70c8 100644
--- a/Kernel/VM/Region.cpp
+++ b/Kernel/VM/Region.cpp
@@ -105,6 +105,7 @@ OwnPtr<Region> Region::clone(Process& new_owner)
region->copy_purgeable_page_ranges(*this);
region->set_mmap(m_mmap);
region->set_shared(m_shared);
+ region->set_syscall_region(is_syscall_region());
return region;
}
@@ -127,6 +128,7 @@ OwnPtr<Region> Region::clone(Process& new_owner)
ASSERT(vmobject().is_anonymous());
clone_region->set_stack(true);
}
+ clone_region->set_syscall_region(is_syscall_region());
clone_region->set_mmap(m_mmap);
return clone_region;
}