mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 23:50:19 +00:00
Kernel: Mark syscalls that get/set user/group ID as not needing big lock
Now that these operate on the neatly atomic and immutable Credentials object, they should no longer require the process big lock for synchronization. :^)
This commit is contained in:
parent
122d7d9533
commit
998c1152ef
Notes:
sideshowbarker
2024-07-17 08:25:15 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/998c1152ef
3 changed files with 30 additions and 30 deletions
|
@ -82,10 +82,10 @@ enum class NeedsBigProcessLock {
|
|||
S(get_stack_bounds, NeedsBigProcessLock::No) \
|
||||
S(get_thread_name, NeedsBigProcessLock::Yes) \
|
||||
S(getcwd, NeedsBigProcessLock::No) \
|
||||
S(getegid, NeedsBigProcessLock::Yes) \
|
||||
S(geteuid, NeedsBigProcessLock::Yes) \
|
||||
S(getgid, NeedsBigProcessLock::Yes) \
|
||||
S(getgroups, NeedsBigProcessLock::Yes) \
|
||||
S(getegid, NeedsBigProcessLock::No) \
|
||||
S(geteuid, NeedsBigProcessLock::No) \
|
||||
S(getgid, NeedsBigProcessLock::No) \
|
||||
S(getgroups, NeedsBigProcessLock::No) \
|
||||
S(gethostname, NeedsBigProcessLock::No) \
|
||||
S(getkeymap, NeedsBigProcessLock::No) \
|
||||
S(getpeername, NeedsBigProcessLock::Yes) \
|
||||
|
@ -94,14 +94,14 @@ enum class NeedsBigProcessLock {
|
|||
S(getpid, NeedsBigProcessLock::No) \
|
||||
S(getppid, NeedsBigProcessLock::Yes) \
|
||||
S(getrandom, NeedsBigProcessLock::No) \
|
||||
S(getresgid, NeedsBigProcessLock::Yes) \
|
||||
S(getresuid, NeedsBigProcessLock::Yes) \
|
||||
S(getresgid, NeedsBigProcessLock::No) \
|
||||
S(getresuid, NeedsBigProcessLock::No) \
|
||||
S(getrusage, NeedsBigProcessLock::Yes) \
|
||||
S(getsid, NeedsBigProcessLock::Yes) \
|
||||
S(getsockname, NeedsBigProcessLock::Yes) \
|
||||
S(getsockopt, NeedsBigProcessLock::No) \
|
||||
S(gettid, NeedsBigProcessLock::No) \
|
||||
S(getuid, NeedsBigProcessLock::Yes) \
|
||||
S(getuid, NeedsBigProcessLock::No) \
|
||||
S(inode_watcher_add_watch, NeedsBigProcessLock::Yes) \
|
||||
S(inode_watcher_remove_watch, NeedsBigProcessLock::Yes) \
|
||||
S(ioctl, NeedsBigProcessLock::Yes) \
|
||||
|
@ -153,19 +153,19 @@ enum class NeedsBigProcessLock {
|
|||
S(set_mmap_name, NeedsBigProcessLock::Yes) \
|
||||
S(set_process_name, NeedsBigProcessLock::Yes) \
|
||||
S(set_thread_name, NeedsBigProcessLock::Yes) \
|
||||
S(setegid, NeedsBigProcessLock::Yes) \
|
||||
S(seteuid, NeedsBigProcessLock::Yes) \
|
||||
S(setgid, NeedsBigProcessLock::Yes) \
|
||||
S(setgroups, NeedsBigProcessLock::Yes) \
|
||||
S(setegid, NeedsBigProcessLock::No) \
|
||||
S(seteuid, NeedsBigProcessLock::No) \
|
||||
S(setgid, NeedsBigProcessLock::No) \
|
||||
S(setgroups, NeedsBigProcessLock::No) \
|
||||
S(sethostname, NeedsBigProcessLock::No) \
|
||||
S(setkeymap, NeedsBigProcessLock::No) \
|
||||
S(setpgid, NeedsBigProcessLock::Yes) \
|
||||
S(setresgid, NeedsBigProcessLock::Yes) \
|
||||
S(setresuid, NeedsBigProcessLock::Yes) \
|
||||
S(setreuid, NeedsBigProcessLock::Yes) \
|
||||
S(setresgid, NeedsBigProcessLock::No) \
|
||||
S(setresuid, NeedsBigProcessLock::No) \
|
||||
S(setreuid, NeedsBigProcessLock::No) \
|
||||
S(setsid, NeedsBigProcessLock::Yes) \
|
||||
S(setsockopt, NeedsBigProcessLock::No) \
|
||||
S(setuid, NeedsBigProcessLock::Yes) \
|
||||
S(setuid, NeedsBigProcessLock::No) \
|
||||
S(shutdown, NeedsBigProcessLock::No) \
|
||||
S(sigaction, NeedsBigProcessLock::Yes) \
|
||||
S(sigaltstack, NeedsBigProcessLock::Yes) \
|
||||
|
|
|
@ -10,35 +10,35 @@ namespace Kernel {
|
|||
|
||||
ErrorOr<FlatPtr> Process::sys$getuid()
|
||||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
|
||||
VERIFY_NO_PROCESS_BIG_LOCK(this);
|
||||
TRY(require_promise(Pledge::stdio));
|
||||
return uid().value();
|
||||
}
|
||||
|
||||
ErrorOr<FlatPtr> Process::sys$getgid()
|
||||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
|
||||
VERIFY_NO_PROCESS_BIG_LOCK(this);
|
||||
TRY(require_promise(Pledge::stdio));
|
||||
return gid().value();
|
||||
}
|
||||
|
||||
ErrorOr<FlatPtr> Process::sys$geteuid()
|
||||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
|
||||
VERIFY_NO_PROCESS_BIG_LOCK(this);
|
||||
TRY(require_promise(Pledge::stdio));
|
||||
return euid().value();
|
||||
}
|
||||
|
||||
ErrorOr<FlatPtr> Process::sys$getegid()
|
||||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
|
||||
VERIFY_NO_PROCESS_BIG_LOCK(this);
|
||||
TRY(require_promise(Pledge::stdio));
|
||||
return egid().value();
|
||||
}
|
||||
|
||||
ErrorOr<FlatPtr> Process::sys$getresuid(Userspace<UserID*> user_ruid, Userspace<UserID*> user_euid, Userspace<UserID*> user_suid)
|
||||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
|
||||
VERIFY_NO_PROCESS_BIG_LOCK(this);
|
||||
TRY(require_promise(Pledge::stdio));
|
||||
|
||||
auto credentials = this->credentials();
|
||||
|
@ -54,7 +54,7 @@ ErrorOr<FlatPtr> Process::sys$getresuid(Userspace<UserID*> user_ruid, Userspace<
|
|||
|
||||
ErrorOr<FlatPtr> Process::sys$getresgid(Userspace<GroupID*> user_rgid, Userspace<GroupID*> user_egid, Userspace<GroupID*> user_sgid)
|
||||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
|
||||
VERIFY_NO_PROCESS_BIG_LOCK(this);
|
||||
TRY(require_promise(Pledge::stdio));
|
||||
|
||||
auto credentials = this->credentials();
|
||||
|
@ -70,7 +70,7 @@ ErrorOr<FlatPtr> Process::sys$getresgid(Userspace<GroupID*> user_rgid, Userspace
|
|||
|
||||
ErrorOr<FlatPtr> Process::sys$getgroups(size_t count, Userspace<GroupID*> user_gids)
|
||||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
|
||||
VERIFY_NO_PROCESS_BIG_LOCK(this);
|
||||
TRY(require_promise(Pledge::stdio));
|
||||
|
||||
auto credentials = this->credentials();
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Kernel {
|
|||
|
||||
ErrorOr<FlatPtr> Process::sys$seteuid(UserID new_euid)
|
||||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
|
||||
VERIFY_NO_PROCESS_BIG_LOCK(this);
|
||||
TRY(require_promise(Pledge::id));
|
||||
|
||||
if (new_euid == (uid_t)-1)
|
||||
|
@ -41,7 +41,7 @@ ErrorOr<FlatPtr> Process::sys$seteuid(UserID new_euid)
|
|||
|
||||
ErrorOr<FlatPtr> Process::sys$setegid(GroupID new_egid)
|
||||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
|
||||
VERIFY_NO_PROCESS_BIG_LOCK(this);
|
||||
TRY(require_promise(Pledge::id));
|
||||
|
||||
if (new_egid == (uid_t)-1)
|
||||
|
@ -72,7 +72,7 @@ ErrorOr<FlatPtr> Process::sys$setegid(GroupID new_egid)
|
|||
|
||||
ErrorOr<FlatPtr> Process::sys$setuid(UserID new_uid)
|
||||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
|
||||
VERIFY_NO_PROCESS_BIG_LOCK(this);
|
||||
TRY(require_promise(Pledge::id));
|
||||
|
||||
if (new_uid == (uid_t)-1)
|
||||
|
@ -103,7 +103,7 @@ ErrorOr<FlatPtr> Process::sys$setuid(UserID new_uid)
|
|||
|
||||
ErrorOr<FlatPtr> Process::sys$setgid(GroupID new_gid)
|
||||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
|
||||
VERIFY_NO_PROCESS_BIG_LOCK(this);
|
||||
TRY(require_promise(Pledge::id));
|
||||
|
||||
if (new_gid == (uid_t)-1)
|
||||
|
@ -134,7 +134,7 @@ ErrorOr<FlatPtr> Process::sys$setgid(GroupID new_gid)
|
|||
|
||||
ErrorOr<FlatPtr> Process::sys$setreuid(UserID new_ruid, UserID new_euid)
|
||||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
|
||||
VERIFY_NO_PROCESS_BIG_LOCK(this);
|
||||
TRY(require_promise(Pledge::id));
|
||||
|
||||
auto credentials = this->credentials();
|
||||
|
@ -171,7 +171,7 @@ ErrorOr<FlatPtr> Process::sys$setreuid(UserID new_ruid, UserID new_euid)
|
|||
|
||||
ErrorOr<FlatPtr> Process::sys$setresuid(UserID new_ruid, UserID new_euid, UserID new_suid)
|
||||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
|
||||
VERIFY_NO_PROCESS_BIG_LOCK(this);
|
||||
TRY(require_promise(Pledge::id));
|
||||
|
||||
auto credentials = this->credentials();
|
||||
|
@ -207,7 +207,7 @@ ErrorOr<FlatPtr> Process::sys$setresuid(UserID new_ruid, UserID new_euid, UserID
|
|||
|
||||
ErrorOr<FlatPtr> Process::sys$setresgid(GroupID new_rgid, GroupID new_egid, GroupID new_sgid)
|
||||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
|
||||
VERIFY_NO_PROCESS_BIG_LOCK(this);
|
||||
TRY(require_promise(Pledge::id));
|
||||
|
||||
auto credentials = this->credentials();
|
||||
|
@ -243,7 +243,7 @@ ErrorOr<FlatPtr> Process::sys$setresgid(GroupID new_rgid, GroupID new_egid, Grou
|
|||
|
||||
ErrorOr<FlatPtr> Process::sys$setgroups(size_t count, Userspace<GroupID const*> user_gids)
|
||||
{
|
||||
VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this);
|
||||
VERIFY_NO_PROCESS_BIG_LOCK(this);
|
||||
TRY(require_promise(Pledge::id));
|
||||
|
||||
auto credentials = this->credentials();
|
||||
|
|
Loading…
Reference in a new issue