mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 18:37:35 +00:00
Kernel: Add "setkeymap" pledge promise
This commit is contained in:
parent
033da11364
commit
0609eefd57
3 changed files with 24 additions and 21 deletions
|
@ -49,6 +49,7 @@ If the process later attempts to use any system functionality it has previously
|
|||
* `chroot`: The [`chroot(2)`](chroot.md) syscall (\*)
|
||||
* `video`: May use [`ioctl(2)`](ioctl.md) and [`mmap(2)`](mmap.md) on framebuffer video devices
|
||||
* `settime`: Changing the system time and date
|
||||
* `setkeymap`: Changing the system keyboard layout
|
||||
* `sigaction`: Change signal handlers and dispositions (\*)
|
||||
|
||||
Promises marked with an asterisk (\*) are SerenityOS specific extensions not supported by the original OpenBSD `pledge()`.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
@ -74,6 +74,7 @@ extern VirtualAddress g_return_to_ring3_from_signal_trampoline;
|
|||
__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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue