diff options
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Process.cpp | 3 | ||||
-rw-r--r-- | Kernel/Process.h | 41 |
2 files changed, 23 insertions, 21 deletions
diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index e91b38f1e0..420dfcd160 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -4295,10 +4295,11 @@ ssize_t Process::sys$getrandom(void* buffer, size_t buffer_size, unsigned int fl int Process::sys$setkeymap(const Syscall::SC_setkeymap_params* user_params) { + REQUIRE_PROMISE(setkeymap); + if (!is_superuser()) return -EPERM; - REQUIRE_NO_PROMISES; Syscall::SC_setkeymap_params params; if (!validate_read_and_copy_typed(¶ms, user_params)) return -EFAULT; diff --git a/Kernel/Process.h b/Kernel/Process.h index 7513de3eb8..b125dcf522 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -36,11 +36,11 @@ #include <Kernel/FileSystem/InodeMetadata.h> #include <Kernel/Forward.h> #include <Kernel/Lock.h> +#include <Kernel/StdLib.h> #include <Kernel/Syscall.h> #include <Kernel/Thread.h> #include <Kernel/UnixTypes.h> #include <Kernel/VM/RangeAllocator.h> -#include <Kernel/StdLib.h> #include <LibC/signal_numbers.h> namespace ELF { @@ -54,26 +54,27 @@ void kgettimeofday(timeval&); extern VirtualAddress g_return_to_ring3_from_signal_trampoline; -#define ENUMERATE_PLEDGE_PROMISES \ - __ENUMERATE_PLEDGE_PROMISE(stdio) \ - __ENUMERATE_PLEDGE_PROMISE(rpath) \ - __ENUMERATE_PLEDGE_PROMISE(wpath) \ - __ENUMERATE_PLEDGE_PROMISE(cpath) \ - __ENUMERATE_PLEDGE_PROMISE(dpath) \ - __ENUMERATE_PLEDGE_PROMISE(inet) \ - __ENUMERATE_PLEDGE_PROMISE(id) \ - __ENUMERATE_PLEDGE_PROMISE(proc) \ - __ENUMERATE_PLEDGE_PROMISE(exec) \ - __ENUMERATE_PLEDGE_PROMISE(unix) \ - __ENUMERATE_PLEDGE_PROMISE(fattr) \ - __ENUMERATE_PLEDGE_PROMISE(tty) \ - __ENUMERATE_PLEDGE_PROMISE(chown) \ - __ENUMERATE_PLEDGE_PROMISE(chroot) \ - __ENUMERATE_PLEDGE_PROMISE(thread) \ - __ENUMERATE_PLEDGE_PROMISE(video) \ - __ENUMERATE_PLEDGE_PROMISE(accept) \ - __ENUMERATE_PLEDGE_PROMISE(settime) \ +#define ENUMERATE_PLEDGE_PROMISES \ + __ENUMERATE_PLEDGE_PROMISE(stdio) \ + __ENUMERATE_PLEDGE_PROMISE(rpath) \ + __ENUMERATE_PLEDGE_PROMISE(wpath) \ + __ENUMERATE_PLEDGE_PROMISE(cpath) \ + __ENUMERATE_PLEDGE_PROMISE(dpath) \ + __ENUMERATE_PLEDGE_PROMISE(inet) \ + __ENUMERATE_PLEDGE_PROMISE(id) \ + __ENUMERATE_PLEDGE_PROMISE(proc) \ + __ENUMERATE_PLEDGE_PROMISE(exec) \ + __ENUMERATE_PLEDGE_PROMISE(unix) \ + __ENUMERATE_PLEDGE_PROMISE(fattr) \ + __ENUMERATE_PLEDGE_PROMISE(tty) \ + __ENUMERATE_PLEDGE_PROMISE(chown) \ + __ENUMERATE_PLEDGE_PROMISE(chroot) \ + __ENUMERATE_PLEDGE_PROMISE(thread) \ + __ENUMERATE_PLEDGE_PROMISE(video) \ + __ENUMERATE_PLEDGE_PROMISE(accept) \ + __ENUMERATE_PLEDGE_PROMISE(settime) \ __ENUMERATE_PLEDGE_PROMISE(sigaction) \ + __ENUMERATE_PLEDGE_PROMISE(setkeymap) \ __ENUMERATE_PLEDGE_PROMISE(shared_buffer) enum class Pledge : u32 { |