1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:58:12 +00:00

Kernel: Use Process::credentials() and remove user ID/group ID helpers

Move away from using the group ID/user ID helpers in the process to
allow for us to take advantage of the immutable credentials instead.
This commit is contained in:
Anthony Iacono 2022-08-20 18:21:01 -04:00 committed by Andreas Kling
parent 8026d8926c
commit f86b671de2
27 changed files with 109 additions and 94 deletions

View file

@ -38,7 +38,8 @@ ErrorOr<FlatPtr> Process::sys$clock_settime(clockid_t clock_id, Userspace<timesp
VERIFY_NO_PROCESS_BIG_LOCK(this);
TRY(require_promise(Pledge::settime));
if (!is_superuser())
auto credentials = this->credentials();
if (!credentials->is_superuser())
return EPERM;
auto time = TRY(copy_time_from_user(user_ts));
@ -120,7 +121,8 @@ ErrorOr<FlatPtr> Process::sys$adjtime(Userspace<timeval const*> user_delta, User
if (user_delta) {
TRY(require_promise(Pledge::settime));
if (!is_superuser())
auto credentials = this->credentials();
if (!credentials->is_superuser())
return EPERM;
auto delta = TRY(copy_time_from_user(user_delta));