serenity/Kernel/Syscalls
Brian Gianforcaro fc91eb365d Kernel: Do not cancel stale timers when servicing sys$alarm
The sys$alarm() syscall has logic to cache a m_alarm_timer to avoid
allocating a new timer for every call to alarm. Unfortunately that
logic was broken, and there were conditions in which we could have
a timer allocated, but it was no longer on the timer queue, and we
would attempt to cancel that timer again resulting in an infinite
loop waiting for the timers callback to fire.

To fix this, we need to track if a timer is currently in use or not,
allowing us to avoid attempting to cancel inactive timers.

Luke and Tom did the initial investigation, I just happened to have
time to write a repro and attempt a fix, so I'm adding them as the
as co-authors of this commit.

Co-authored-by: Luke <luke.wilde@live.co.uk>
Co-authored-by: Tom <tomut@yahoo.com>
2021-08-03 18:44:01 +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: Do not cancel stale timers when servicing sys$alarm 2021-08-03 18:44:01 +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: Remove unused header includes 2021-08-01 08:10:16 +02:00
chmod.cpp Kernel: Remove unused header includes 2021-08-01 08:10:16 +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 unused header includes 2021-08-01 08:10:16 +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: Remove unused header includes 2021-08-01 08:10:16 +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: Fail madvise() volatile change with EINVAL for non-purgeable mem 2021-07-28 20:42:49 +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: Remove unused header includes 2021-08-01 08:10:16 +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: Remove unused header includes 2021-08-01 08:10:16 +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: Remove unused header includes 2021-08-01 08:10:16 +02:00
ptrace.cpp Kernel: Remove ThreadTracer.h include from Process.h / Thread.h 2021-08-01 08:10:16 +02:00
purge.cpp Kernel: Remove unused header includes 2021-08-01 08:10:16 +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: Remove unused header includes 2021-08-01 08:10:16 +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: Remove unused header includes 2021-08-01 08:10:16 +02:00
socket.cpp Kernel: Remove unused header includes 2021-08-01 08:10:16 +02:00
stat.cpp Kernel: Remove unused header includes 2021-08-01 08:10:16 +02:00
statvfs.cpp Kernel: Remove unused header includes 2021-08-01 08:10:16 +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: Remove unused header includes 2021-08-01 08:10:16 +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