Skip to content

Commit

Permalink
Kernel: VERIFY that signals are not sent to Kernel processes
Browse files Browse the repository at this point in the history
Kernel processes can't handle signals, nor should they ever receive any
  • Loading branch information
IdanHo authored and awesomekling committed Feb 21, 2022
1 parent 2c996cb commit 0911112
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions Kernel/Process.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,7 @@ void Process::terminate_due_to_signal(u8 signal)

ErrorOr<void> 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:
Expand Down
1 change: 1 addition & 0 deletions Kernel/Thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down

0 comments on commit 0911112

Please sign in to comment.