ladybird/Kernel/Syscalls
Brian Gianforcaro 4b2651ddab Kernel: Track allocated FileDescriptionAndFlag elements in each Process
The way the Process::FileDescriptions::allocate() API works today means
that two callers who allocate back to back without associating a
FileDescription with the allocated FD, will receive the same FD and thus
one will stomp over the other.

Naively tracking which FileDescriptions are allocated and moving onto
the next would introduce other bugs however, as now if you "allocate"
a fd and then return early further down the control flow of the syscall
you would leak that fd.

This change modifies this behavior by tracking which descriptions are
allocated and then having an RAII type to "deallocate" the fd if the
association is not setup the end of it's scope.
2021-07-28 19:07:00 +02:00
..
access.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
alarm.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
anon_create.cpp Kernel: Track allocated FileDescriptionAndFlag elements in each Process 2021-07-28 19:07:00 +02:00
beep.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
chdir.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
chmod.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
chown.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
chroot.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
clock.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
debug.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
disown.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
dup2.cpp Kernel: Track allocated FileDescriptionAndFlag elements in each Process 2021-07-28 19:07:00 +02:00
emuctl.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
execve.cpp Kernel: Track allocated FileDescriptionAndFlag elements in each Process 2021-07-28 19:07:00 +02:00
exit.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
fcntl.cpp Kernel: Track allocated FileDescriptionAndFlag elements in each Process 2021-07-28 19:07:00 +02:00
fork.cpp Kernel: Remove unnecessary weak pointer from Region to owning Process 2021-07-25 17:28:06 +02:00
ftruncate.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
futex.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
get_dir_entries.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
get_stack_bounds.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
getrandom.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
getuid.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
hostname.cpp Kernel: Disable big process lock in sys$gethostname() sys$sethostname() 2021-07-20 03:21:14 +02:00
inode_watcher.cpp Kernel: Track allocated FileDescriptionAndFlag elements in each Process 2021-07-28 19:07:00 +02:00
ioctl.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
keymap.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
kill.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
link.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
lseek.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
mkdir.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
mknod.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
mmap.cpp Kernel: Remove unused madvise(MADV_GET_VOLATILE) 2021-07-25 17:28:06 +02:00
module.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
mount.cpp Kernel: Use StringView literals for fs_type match in sys$mount(..) 2021-07-23 19:02:25 +02:00
open.cpp Kernel: Track allocated FileDescriptionAndFlag elements in each Process 2021-07-28 19:07:00 +02:00
perf_event.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
pipe.cpp Kernel: Track allocated FileDescriptionAndFlag elements in each Process 2021-07-28 19:07:00 +02:00
pledge.cpp Kernel: Use StringView when parsing pledges in sys$pledge(..) 2021-07-23 19:02:25 +02:00
prctl.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
process.cpp Kernel: Disable big process lock for sys$getpid() 2021-07-20 03:21:14 +02:00
profiling.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
ptrace.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
purge.cpp Kernel: Make purgeable memory a VMObject level concept (again) 2021-07-25 17:28:05 +02:00
read.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
readlink.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
realpath.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
rename.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
rmdir.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
sched.cpp Kernel: Disable big process lock for sys$yield() 2021-07-20 03:21:14 +02:00
select.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
sendfd.cpp Kernel: Track allocated FileDescriptionAndFlag elements in each Process 2021-07-28 19:07:00 +02:00
setpgid.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
setuid.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
shutdown.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
sigaction.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
socket.cpp Kernel: Track allocated FileDescriptionAndFlag elements in each Process 2021-07-28 19:07:00 +02:00
stat.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
statvfs.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
sync.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
sysconf.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
thread.cpp Kernel: Disable big process lock for sys$gettid() 2021-07-20 03:21:14 +02:00
times.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
ttyname.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
umask.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
uname.cpp Kernel: Disable big process lock for sys$uname() 2021-07-20 03:21:14 +02:00
unlink.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
unveil.cpp Kernel: Migrate sys$unveil to use the KString API 2021-07-23 19:02:25 +02:00
utime.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
waitid.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00
write.cpp Kernel: Annotate all syscalls with VERIFY_PROCESS_BIG_LOCK_ACQUIRED 2021-07-20 03:21:14 +02:00