diff options
author | Andreas Kling <kling@serenityos.org> | 2023-04-03 18:43:20 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-04-04 10:33:42 +0200 |
commit | bd46397e1fb5bb2db0c406427801039a2611bbe4 (patch) | |
tree | dc6cb9cfcc6938323d8b0c536a3320e0f283a129 | |
parent | 08d79c757a13c88f5525737e74aa62431d6459e7 (diff) | |
download | serenity-bd46397e1fb5bb2db0c406427801039a2611bbe4.zip |
Kernel: Mark inode watcher syscalls as not needing the big lock
These syscalls are already protected by existing locking mechanisms,
including the mutex inside InodeWatcher.
-rw-r--r-- | Kernel/API/Syscall.h | 310 | ||||
-rw-r--r-- | Kernel/Syscalls/inode_watcher.cpp | 4 |
2 files changed, 157 insertions, 157 deletions
diff --git a/Kernel/API/Syscall.h b/Kernel/API/Syscall.h index 1e80efc73e..5eb7ba9bb3 100644 --- a/Kernel/API/Syscall.h +++ b/Kernel/API/Syscall.h @@ -44,161 +44,161 @@ enum class NeedsBigProcessLock { // - VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this) // - VERIFY_NO_PROCESS_BIG_LOCK(this) // -#define ENUMERATE_SYSCALLS(S) \ - S(accept4, NeedsBigProcessLock::No) \ - S(adjtime, NeedsBigProcessLock::No) \ - S(alarm, NeedsBigProcessLock::No) \ - S(allocate_tls, NeedsBigProcessLock::Yes) \ - S(anon_create, NeedsBigProcessLock::No) \ - S(annotate_mapping, NeedsBigProcessLock::No) \ - S(beep, NeedsBigProcessLock::No) \ - S(bind, NeedsBigProcessLock::No) \ - S(chdir, NeedsBigProcessLock::No) \ - S(chmod, NeedsBigProcessLock::No) \ - S(chown, NeedsBigProcessLock::No) \ - S(clock_gettime, NeedsBigProcessLock::No) \ - S(clock_nanosleep, NeedsBigProcessLock::No) \ - S(clock_getres, NeedsBigProcessLock::No) \ - S(clock_settime, NeedsBigProcessLock::No) \ - S(close, NeedsBigProcessLock::No) \ - S(connect, NeedsBigProcessLock::No) \ - S(create_inode_watcher, NeedsBigProcessLock::No) \ - S(create_thread, NeedsBigProcessLock::Yes) \ - S(dbgputstr, NeedsBigProcessLock::No) \ - S(detach_thread, NeedsBigProcessLock::Yes) \ - S(disown, NeedsBigProcessLock::No) \ - S(dump_backtrace, NeedsBigProcessLock::No) \ - S(dup2, NeedsBigProcessLock::No) \ - S(emuctl, NeedsBigProcessLock::No) \ - S(execve, NeedsBigProcessLock::Yes) \ - S(exit, NeedsBigProcessLock::Yes) \ - S(exit_thread, NeedsBigProcessLock::Yes) \ - S(faccessat, NeedsBigProcessLock::Yes) \ - S(fchdir, NeedsBigProcessLock::No) \ - S(fchmod, NeedsBigProcessLock::No) \ - S(fchown, NeedsBigProcessLock::No) \ - S(fcntl, NeedsBigProcessLock::No) \ - S(fork, NeedsBigProcessLock::Yes) \ - S(fstat, NeedsBigProcessLock::No) \ - S(fstatvfs, NeedsBigProcessLock::No) \ - S(fsync, NeedsBigProcessLock::No) \ - S(ftruncate, NeedsBigProcessLock::No) \ - S(futex, NeedsBigProcessLock::Yes) \ - S(get_dir_entries, NeedsBigProcessLock::Yes) \ - S(get_root_session_id, NeedsBigProcessLock::No) \ - S(get_stack_bounds, NeedsBigProcessLock::No) \ - S(get_thread_name, NeedsBigProcessLock::No) \ - S(getcwd, NeedsBigProcessLock::No) \ - 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) \ - S(getpgid, NeedsBigProcessLock::No) \ - S(getpgrp, NeedsBigProcessLock::No) \ - S(getpid, NeedsBigProcessLock::No) \ - S(getppid, NeedsBigProcessLock::No) \ - S(getrandom, NeedsBigProcessLock::No) \ - S(getresgid, NeedsBigProcessLock::No) \ - S(getresuid, NeedsBigProcessLock::No) \ - S(getrusage, NeedsBigProcessLock::No) \ - S(getsid, NeedsBigProcessLock::No) \ - S(getsockname, NeedsBigProcessLock::Yes) \ - S(getsockopt, NeedsBigProcessLock::No) \ - S(gettid, NeedsBigProcessLock::No) \ - S(getuid, NeedsBigProcessLock::No) \ - S(inode_watcher_add_watch, NeedsBigProcessLock::Yes) \ - S(inode_watcher_remove_watch, NeedsBigProcessLock::Yes) \ - S(ioctl, NeedsBigProcessLock::Yes) \ - S(join_thread, NeedsBigProcessLock::Yes) \ - S(jail_create, NeedsBigProcessLock::No) \ - S(jail_attach, NeedsBigProcessLock::No) \ - S(kill, NeedsBigProcessLock::No) \ - S(kill_thread, NeedsBigProcessLock::Yes) \ - S(killpg, NeedsBigProcessLock::No) \ - S(link, NeedsBigProcessLock::No) \ - S(listen, NeedsBigProcessLock::No) \ - S(lseek, NeedsBigProcessLock::No) \ - S(madvise, NeedsBigProcessLock::Yes) \ - S(map_time_page, NeedsBigProcessLock::Yes) \ - S(mkdir, NeedsBigProcessLock::No) \ - S(mknod, NeedsBigProcessLock::No) \ - S(mmap, NeedsBigProcessLock::Yes) \ - S(mount, NeedsBigProcessLock::Yes) \ - S(mprotect, NeedsBigProcessLock::Yes) \ - S(mremap, NeedsBigProcessLock::Yes) \ - S(msync, NeedsBigProcessLock::Yes) \ - S(munmap, NeedsBigProcessLock::Yes) \ - S(open, NeedsBigProcessLock::No) \ - S(perf_event, NeedsBigProcessLock::Yes) \ - S(perf_register_string, NeedsBigProcessLock::Yes) \ - S(pipe, NeedsBigProcessLock::No) \ - S(pledge, NeedsBigProcessLock::No) \ - S(poll, NeedsBigProcessLock::Yes) \ - S(posix_fallocate, NeedsBigProcessLock::No) \ - S(prctl, NeedsBigProcessLock::No) \ - S(profiling_disable, NeedsBigProcessLock::Yes) \ - S(profiling_enable, NeedsBigProcessLock::Yes) \ - S(profiling_free_buffer, NeedsBigProcessLock::Yes) \ - S(ptrace, NeedsBigProcessLock::Yes) \ - S(purge, NeedsBigProcessLock::Yes) \ - S(read, NeedsBigProcessLock::Yes) \ - S(pread, NeedsBigProcessLock::Yes) \ - S(readlink, NeedsBigProcessLock::No) \ - S(readv, NeedsBigProcessLock::Yes) \ - S(realpath, NeedsBigProcessLock::No) \ - S(recvfd, NeedsBigProcessLock::No) \ - S(recvmsg, NeedsBigProcessLock::Yes) \ - S(rename, NeedsBigProcessLock::No) \ - S(rmdir, NeedsBigProcessLock::No) \ - S(scheduler_get_parameters, NeedsBigProcessLock::No) \ - S(scheduler_set_parameters, NeedsBigProcessLock::No) \ - S(sendfd, NeedsBigProcessLock::No) \ - S(sendmsg, NeedsBigProcessLock::Yes) \ - S(set_mmap_name, NeedsBigProcessLock::Yes) \ - S(set_thread_name, NeedsBigProcessLock::No) \ - 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(setregid, NeedsBigProcessLock::No) \ - S(setresgid, NeedsBigProcessLock::No) \ - S(setresuid, NeedsBigProcessLock::No) \ - S(setreuid, NeedsBigProcessLock::No) \ - S(setsid, NeedsBigProcessLock::Yes) \ - S(setsockopt, NeedsBigProcessLock::No) \ - S(setuid, NeedsBigProcessLock::No) \ - S(shutdown, NeedsBigProcessLock::No) \ - S(sigaction, NeedsBigProcessLock::Yes) \ - S(sigaltstack, NeedsBigProcessLock::Yes) \ - S(sigpending, NeedsBigProcessLock::No) \ - S(sigprocmask, NeedsBigProcessLock::No) \ - S(sigreturn, NeedsBigProcessLock::No) \ - S(sigsuspend, NeedsBigProcessLock::No) \ - S(sigtimedwait, NeedsBigProcessLock::No) \ - S(socket, NeedsBigProcessLock::No) \ - S(socketpair, NeedsBigProcessLock::No) \ - S(stat, NeedsBigProcessLock::No) \ - S(statvfs, NeedsBigProcessLock::No) \ - S(symlink, NeedsBigProcessLock::No) \ - S(sync, NeedsBigProcessLock::No) \ - S(sysconf, NeedsBigProcessLock::No) \ - S(times, NeedsBigProcessLock::No) \ - S(umask, NeedsBigProcessLock::No) \ - S(umount, NeedsBigProcessLock::Yes) \ - S(uname, NeedsBigProcessLock::No) \ - S(unlink, NeedsBigProcessLock::No) \ - S(unveil, NeedsBigProcessLock::No) \ - S(utime, NeedsBigProcessLock::No) \ - S(utimensat, NeedsBigProcessLock::No) \ - S(waitid, NeedsBigProcessLock::Yes) \ - S(write, NeedsBigProcessLock::Yes) \ - S(pwritev, NeedsBigProcessLock::Yes) \ +#define ENUMERATE_SYSCALLS(S) \ + S(accept4, NeedsBigProcessLock::No) \ + S(adjtime, NeedsBigProcessLock::No) \ + S(alarm, NeedsBigProcessLock::No) \ + S(allocate_tls, NeedsBigProcessLock::Yes) \ + S(anon_create, NeedsBigProcessLock::No) \ + S(annotate_mapping, NeedsBigProcessLock::No) \ + S(beep, NeedsBigProcessLock::No) \ + S(bind, NeedsBigProcessLock::No) \ + S(chdir, NeedsBigProcessLock::No) \ + S(chmod, NeedsBigProcessLock::No) \ + S(chown, NeedsBigProcessLock::No) \ + S(clock_gettime, NeedsBigProcessLock::No) \ + S(clock_nanosleep, NeedsBigProcessLock::No) \ + S(clock_getres, NeedsBigProcessLock::No) \ + S(clock_settime, NeedsBigProcessLock::No) \ + S(close, NeedsBigProcessLock::No) \ + S(connect, NeedsBigProcessLock::No) \ + S(create_inode_watcher, NeedsBigProcessLock::No) \ + S(create_thread, NeedsBigProcessLock::Yes) \ + S(dbgputstr, NeedsBigProcessLock::No) \ + S(detach_thread, NeedsBigProcessLock::Yes) \ + S(disown, NeedsBigProcessLock::No) \ + S(dump_backtrace, NeedsBigProcessLock::No) \ + S(dup2, NeedsBigProcessLock::No) \ + S(emuctl, NeedsBigProcessLock::No) \ + S(execve, NeedsBigProcessLock::Yes) \ + S(exit, NeedsBigProcessLock::Yes) \ + S(exit_thread, NeedsBigProcessLock::Yes) \ + S(faccessat, NeedsBigProcessLock::Yes) \ + S(fchdir, NeedsBigProcessLock::No) \ + S(fchmod, NeedsBigProcessLock::No) \ + S(fchown, NeedsBigProcessLock::No) \ + S(fcntl, NeedsBigProcessLock::No) \ + S(fork, NeedsBigProcessLock::Yes) \ + S(fstat, NeedsBigProcessLock::No) \ + S(fstatvfs, NeedsBigProcessLock::No) \ + S(fsync, NeedsBigProcessLock::No) \ + S(ftruncate, NeedsBigProcessLock::No) \ + S(futex, NeedsBigProcessLock::Yes) \ + S(get_dir_entries, NeedsBigProcessLock::Yes) \ + S(get_root_session_id, NeedsBigProcessLock::No) \ + S(get_stack_bounds, NeedsBigProcessLock::No) \ + S(get_thread_name, NeedsBigProcessLock::No) \ + S(getcwd, NeedsBigProcessLock::No) \ + 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) \ + S(getpgid, NeedsBigProcessLock::No) \ + S(getpgrp, NeedsBigProcessLock::No) \ + S(getpid, NeedsBigProcessLock::No) \ + S(getppid, NeedsBigProcessLock::No) \ + S(getrandom, NeedsBigProcessLock::No) \ + S(getresgid, NeedsBigProcessLock::No) \ + S(getresuid, NeedsBigProcessLock::No) \ + S(getrusage, NeedsBigProcessLock::No) \ + S(getsid, NeedsBigProcessLock::No) \ + S(getsockname, NeedsBigProcessLock::Yes) \ + S(getsockopt, NeedsBigProcessLock::No) \ + S(gettid, NeedsBigProcessLock::No) \ + S(getuid, NeedsBigProcessLock::No) \ + S(inode_watcher_add_watch, NeedsBigProcessLock::No) \ + S(inode_watcher_remove_watch, NeedsBigProcessLock::No) \ + S(ioctl, NeedsBigProcessLock::Yes) \ + S(join_thread, NeedsBigProcessLock::Yes) \ + S(jail_create, NeedsBigProcessLock::No) \ + S(jail_attach, NeedsBigProcessLock::No) \ + S(kill, NeedsBigProcessLock::No) \ + S(kill_thread, NeedsBigProcessLock::Yes) \ + S(killpg, NeedsBigProcessLock::No) \ + S(link, NeedsBigProcessLock::No) \ + S(listen, NeedsBigProcessLock::No) \ + S(lseek, NeedsBigProcessLock::No) \ + S(madvise, NeedsBigProcessLock::Yes) \ + S(map_time_page, NeedsBigProcessLock::Yes) \ + S(mkdir, NeedsBigProcessLock::No) \ + S(mknod, NeedsBigProcessLock::No) \ + S(mmap, NeedsBigProcessLock::Yes) \ + S(mount, NeedsBigProcessLock::Yes) \ + S(mprotect, NeedsBigProcessLock::Yes) \ + S(mremap, NeedsBigProcessLock::Yes) \ + S(msync, NeedsBigProcessLock::Yes) \ + S(munmap, NeedsBigProcessLock::Yes) \ + S(open, NeedsBigProcessLock::No) \ + S(perf_event, NeedsBigProcessLock::Yes) \ + S(perf_register_string, NeedsBigProcessLock::Yes) \ + S(pipe, NeedsBigProcessLock::No) \ + S(pledge, NeedsBigProcessLock::No) \ + S(poll, NeedsBigProcessLock::Yes) \ + S(posix_fallocate, NeedsBigProcessLock::No) \ + S(prctl, NeedsBigProcessLock::No) \ + S(profiling_disable, NeedsBigProcessLock::Yes) \ + S(profiling_enable, NeedsBigProcessLock::Yes) \ + S(profiling_free_buffer, NeedsBigProcessLock::Yes) \ + S(ptrace, NeedsBigProcessLock::Yes) \ + S(purge, NeedsBigProcessLock::Yes) \ + S(read, NeedsBigProcessLock::Yes) \ + S(pread, NeedsBigProcessLock::Yes) \ + S(readlink, NeedsBigProcessLock::No) \ + S(readv, NeedsBigProcessLock::Yes) \ + S(realpath, NeedsBigProcessLock::No) \ + S(recvfd, NeedsBigProcessLock::No) \ + S(recvmsg, NeedsBigProcessLock::Yes) \ + S(rename, NeedsBigProcessLock::No) \ + S(rmdir, NeedsBigProcessLock::No) \ + S(scheduler_get_parameters, NeedsBigProcessLock::No) \ + S(scheduler_set_parameters, NeedsBigProcessLock::No) \ + S(sendfd, NeedsBigProcessLock::No) \ + S(sendmsg, NeedsBigProcessLock::Yes) \ + S(set_mmap_name, NeedsBigProcessLock::Yes) \ + S(set_thread_name, NeedsBigProcessLock::No) \ + 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(setregid, NeedsBigProcessLock::No) \ + S(setresgid, NeedsBigProcessLock::No) \ + S(setresuid, NeedsBigProcessLock::No) \ + S(setreuid, NeedsBigProcessLock::No) \ + S(setsid, NeedsBigProcessLock::Yes) \ + S(setsockopt, NeedsBigProcessLock::No) \ + S(setuid, NeedsBigProcessLock::No) \ + S(shutdown, NeedsBigProcessLock::No) \ + S(sigaction, NeedsBigProcessLock::Yes) \ + S(sigaltstack, NeedsBigProcessLock::Yes) \ + S(sigpending, NeedsBigProcessLock::No) \ + S(sigprocmask, NeedsBigProcessLock::No) \ + S(sigreturn, NeedsBigProcessLock::No) \ + S(sigsuspend, NeedsBigProcessLock::No) \ + S(sigtimedwait, NeedsBigProcessLock::No) \ + S(socket, NeedsBigProcessLock::No) \ + S(socketpair, NeedsBigProcessLock::No) \ + S(stat, NeedsBigProcessLock::No) \ + S(statvfs, NeedsBigProcessLock::No) \ + S(symlink, NeedsBigProcessLock::No) \ + S(sync, NeedsBigProcessLock::No) \ + S(sysconf, NeedsBigProcessLock::No) \ + S(times, NeedsBigProcessLock::No) \ + S(umask, NeedsBigProcessLock::No) \ + S(umount, NeedsBigProcessLock::Yes) \ + S(uname, NeedsBigProcessLock::No) \ + S(unlink, NeedsBigProcessLock::No) \ + S(unveil, NeedsBigProcessLock::No) \ + S(utime, NeedsBigProcessLock::No) \ + S(utimensat, NeedsBigProcessLock::No) \ + S(waitid, NeedsBigProcessLock::Yes) \ + S(write, NeedsBigProcessLock::Yes) \ + S(pwritev, NeedsBigProcessLock::Yes) \ S(yield, NeedsBigProcessLock::No) namespace Syscall { diff --git a/Kernel/Syscalls/inode_watcher.cpp b/Kernel/Syscalls/inode_watcher.cpp index 2cbbe24ebc..476abd2f69 100644 --- a/Kernel/Syscalls/inode_watcher.cpp +++ b/Kernel/Syscalls/inode_watcher.cpp @@ -39,7 +39,7 @@ ErrorOr<FlatPtr> Process::sys$create_inode_watcher(u32 flags) ErrorOr<FlatPtr> Process::sys$inode_watcher_add_watch(Userspace<Syscall::SC_inode_watcher_add_watch_params const*> user_params) { - VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this); + VERIFY_NO_PROCESS_BIG_LOCK(this); TRY(require_promise(Pledge::rpath)); auto params = TRY(copy_typed_from_user(user_params)); @@ -57,7 +57,7 @@ ErrorOr<FlatPtr> Process::sys$inode_watcher_add_watch(Userspace<Syscall::SC_inod ErrorOr<FlatPtr> Process::sys$inode_watcher_remove_watch(int fd, int wd) { - VERIFY_PROCESS_BIG_LOCK_ACQUIRED(this); + VERIFY_NO_PROCESS_BIG_LOCK(this); auto description = TRY(open_file_description(fd)); if (!description->is_inode_watcher()) return EBADF; |