summaryrefslogtreecommitdiff
path: root/Kernel/Syscall.cpp
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-08-12 19:33:24 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-08-12 19:33:24 +0200
commit7d6689055fbed308324a80769c334a649edcab56 (patch)
tree36c3d20c0778a0429c626ad55657db70f1284221 /Kernel/Syscall.cpp
parent4917445e2e1ca6ce2c6254db4850eb1cbd2ac485 (diff)
downloadserenity-7d6689055fbed308324a80769c334a649edcab56.zip
Kernel+LibC+crash: Add mprotect() syscall
This patch adds the mprotect() syscall to allow changing the protection flags for memory regions. We don't do any region splitting/merging yet, so this only works on whole mmap() regions. Added a "crash -r" flag to verify that we crash when you attempt to write to read-only memory. :^)
Diffstat (limited to 'Kernel/Syscall.cpp')
-rw-r--r--Kernel/Syscall.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/Kernel/Syscall.cpp b/Kernel/Syscall.cpp
index 48b9313a92..8d43d8a56c 100644
--- a/Kernel/Syscall.cpp
+++ b/Kernel/Syscall.cpp
@@ -305,6 +305,8 @@ static u32 handle(RegisterDump& regs, u32 function, u32 arg1, u32 arg2, u32 arg3
return current->process().sys$share_buffer_globally((int)arg1);
case Syscall::SC_set_process_icon:
return current->process().sys$set_process_icon((int)arg1);
+ case Syscall::SC_mprotect:
+ return current->process().sys$mprotect((void*)arg1, (size_t)arg2, (int)arg3);
default:
kprintf("<%u> int0x82: Unknown function %u requested {%x, %x, %x}\n", current->process().pid(), function, arg1, arg2, arg3);
return -ENOSYS;