From 0911112286111c59fcc81b5ba80f02f203834863 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Mon, 21 Feb 2022 19:53:39 +0200 Subject: [PATCH] Kernel: VERIFY that signals are not sent to Kernel processes Kernel processes can't handle signals, nor should they ever receive any --- Kernel/Process.cpp | 1 + Kernel/Thread.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/Kernel/Process.cpp b/Kernel/Process.cpp index 0dfe18e52b6265..f870d738ef3c10 100644 --- a/Kernel/Process.cpp +++ b/Kernel/Process.cpp @@ -707,6 +707,7 @@ void Process::terminate_due_to_signal(u8 signal) ErrorOr Process::send_signal(u8 signal, Process* sender) { + VERIFY(is_user_process()); // Try to send it to the "obvious" main thread: auto receiver_thread = Thread::from_tid(pid().value()); // If the main thread has died, there may still be other threads: diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index f7764b85eeb9eb..6f5e6338d364d0 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -721,6 +721,7 @@ u32 Thread::pending_signals_for_state() const void Thread::send_signal(u8 signal, [[maybe_unused]] Process* sender) { VERIFY(signal < 32); + VERIFY(process().is_user_process()); SpinlockLocker scheduler_lock(g_scheduler_lock); // FIXME: Figure out what to do for masked signals. Should we also ignore them here?