diff --git a/Kernel/Process.h b/Kernel/Process.h index 039d873311..62d5a71f89 100644 --- a/Kernel/Process.h +++ b/Kernel/Process.h @@ -82,7 +82,8 @@ extern VirtualAddress g_return_to_ring3_from_signal_trampoline; __ENUMERATE_PLEDGE_PROMISE(settime) \ __ENUMERATE_PLEDGE_PROMISE(sigaction) \ __ENUMERATE_PLEDGE_PROMISE(setkeymap) \ - __ENUMERATE_PLEDGE_PROMISE(prot_exec) + __ENUMERATE_PLEDGE_PROMISE(prot_exec) \ + __ENUMERATE_PLEDGE_PROMISE(getkeymap) enum class Pledge : u32 { #define __ENUMERATE_PLEDGE_PROMISE(x) x, diff --git a/Kernel/Syscalls/keymap.cpp b/Kernel/Syscalls/keymap.cpp index 2cbab8bf46..53b5279baf 100644 --- a/Kernel/Syscalls/keymap.cpp +++ b/Kernel/Syscalls/keymap.cpp @@ -69,7 +69,7 @@ int Process::sys$setkeymap(Userspace user_p int Process::sys$getkeymap(Userspace user_params) { - REQUIRE_PROMISE(stdio); + REQUIRE_PROMISE(getkeymap); Syscall::SC_getkeymap_params params; if (!copy_from_user(¶ms, user_params)) diff --git a/Userland/Applications/KeyboardMapper/main.cpp b/Userland/Applications/KeyboardMapper/main.cpp index c9ccf17e25..654eb44fd5 100644 --- a/Userland/Applications/KeyboardMapper/main.cpp +++ b/Userland/Applications/KeyboardMapper/main.cpp @@ -40,14 +40,14 @@ int main(int argc, char** argv) args_parser.add_positional_argument(path, "Keyboard character mapping file.", "file", Core::ArgsParser::Required::No); args_parser.parse(argc, argv); - if (pledge("stdio thread rpath accept cpath wpath recvfd sendfd unix fattr", nullptr) < 0) { + if (pledge("stdio getkeymap thread rpath accept cpath wpath recvfd sendfd unix fattr", nullptr) < 0) { perror("pledge"); return 1; } auto app = GUI::Application::construct(argc, argv); - if (pledge("stdio thread rpath accept cpath wpath recvfd sendfd", nullptr) < 0) { + if (pledge("stdio getkeymap thread rpath accept cpath wpath recvfd sendfd", nullptr) < 0) { perror("pledge"); return 1; } @@ -69,6 +69,11 @@ int main(int argc, char** argv) keyboard_mapper_widget->load_from_system(); } + if (pledge("stdio thread rpath accept cpath wpath recvfd sendfd", nullptr) < 0) { + perror("pledge"); + return 1; + } + // Actions auto open_action = GUI::CommonActions::make_open_action( [&](auto&) { diff --git a/Userland/Utilities/keymap.cpp b/Userland/Utilities/keymap.cpp index 1ee4631e25..1f67810a36 100644 --- a/Userland/Utilities/keymap.cpp +++ b/Userland/Utilities/keymap.cpp @@ -32,7 +32,7 @@ int main(int argc, char** argv) { - if (pledge("stdio setkeymap rpath", nullptr) < 0) { + if (pledge("stdio setkeymap getkeymap rpath", nullptr) < 0) { perror("pledge"); return 1; }