mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +00:00
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.
This commit is contained in:
@@ -189,6 +189,12 @@ void syscall_handler(TrapFrame* trap)
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
if (process.enforces_syscall_regions() && !calling_region->is_syscall_region()) {
|
||||
dbgln("Syscall from non-syscall region");
|
||||
handle_crash(regs, "Syscall from non-syscall region", SIGSEGV);
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
process.big_lock().lock();
|
||||
u32 function = regs.eax;
|
||||
u32 arg1 = regs.edx;
|
||||
|
||||
Reference in New Issue
Block a user