1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +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

@ -16,10 +16,11 @@ ErrorOr<FlatPtr> Process::sys$mknod(Userspace<Syscall::SC_mknod_params const*> u
TRY(require_promise(Pledge::dpath));
auto params = TRY(copy_typed_from_user(user_params));
if (!is_superuser() && !is_regular_file(params.mode) && !is_fifo(params.mode) && !is_socket(params.mode))
auto credentials = this->credentials();
if (!credentials->is_superuser() && !is_regular_file(params.mode) && !is_fifo(params.mode) && !is_socket(params.mode))
return EPERM;
auto path = TRY(get_syscall_path_argument(params.path));
TRY(VirtualFileSystem::the().mknod(credentials(), path->view(), params.mode & ~umask(), params.dev, current_directory()));
TRY(VirtualFileSystem::the().mknod(credentials, path->view(), params.mode & ~umask(), params.dev, current_directory()));
return 0;
}