Kernel: Use Process::require_promise() instead of REQUIRE_PROMISE()

This change lays the foundation for making the require_promise return
an error hand handling the process abort outside of the syscall
implementations, to avoid cases where we would leak resources.

It also has the advantage that it makes removes a gs pointer read
to look up the current thread, then process for every syscall. We
can instead go through the Process this pointer in most cases.
This commit is contained in:
Brian Gianforcaro 2021-12-29 00:10:17 -08:00 committed by Andreas Kling
commit bad6d50b86
Notes: sideshowbarker 2024-07-17 21:58:41 +09:00
61 changed files with 133 additions and 132 deletions

View file

@ -99,9 +99,9 @@ ErrorOr<FlatPtr> Process::sys$kill(pid_t pid_or_pgid, int signal)
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
if (pid_or_pgid == pid().value())
REQUIRE_PROMISE(stdio);
require_promise(Pledge::stdio);
else
REQUIRE_PROMISE(proc);
require_promise(Pledge::proc);
if (signal < 0 || signal >= 32)
return EINVAL;
@ -130,7 +130,7 @@ ErrorOr<FlatPtr> Process::sys$kill(pid_t pid_or_pgid, int signal)
ErrorOr<FlatPtr> Process::sys$killpg(pid_t pgrp, int signum)
{
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this)
REQUIRE_PROMISE(proc);
require_promise(Pledge::proc);
if (signum < 1 || signum >= 32)
return EINVAL;
if (pgrp < 0)