diff options
author | Andreas Kling <kling@serenityos.org> | 2021-12-21 22:16:33 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-12-23 00:57:36 +0100 |
commit | 601a9321d9e182ec7df234e8ec8b522f6fbe7720 (patch) | |
tree | 7d38619df7c1a04c16b344e05d73f023107b9589 /Kernel | |
parent | cf7bbcc70e6bfc3414fbe13a78ccba1c7cd7ffca (diff) | |
download | serenity-601a9321d9e182ec7df234e8ec8b522f6fbe7720.zip |
Kernel: Don't honor userspace SIGSTOP requests in Thread::block()
Instead, wait until we transition back to userspace. This stops
userspace from being able to suspend a thread indefinitely while it's
running in kernelspace (potentially holding some blocking mutex.)
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/Thread.cpp | 6 | ||||
-rw-r--r-- | Kernel/Thread.h | 5 |
2 files changed, 0 insertions, 11 deletions
diff --git a/Kernel/Thread.cpp b/Kernel/Thread.cpp index 15bfd135b9..1efca786f3 100644 --- a/Kernel/Thread.cpp +++ b/Kernel/Thread.cpp @@ -208,12 +208,6 @@ void Thread::block(Kernel::Mutex& lock, SpinlockLocker<Spinlock>& lock_lock, u32 VERIFY(Processor::in_critical()); SpinlockLocker block_lock2(m_block_lock); - if (should_be_stopped() || state() == Stopped) { - dbgln("Thread should be stopped, current state: {}", state_string()); - set_state(Thread::Blocked); - continue; - } - VERIFY(!m_blocking_lock); m_blocking_lock = previous_blocking_lock; break; diff --git a/Kernel/Thread.h b/Kernel/Thread.h index d085790203..454dc7749e 100644 --- a/Kernel/Thread.h +++ b/Kernel/Thread.h @@ -950,11 +950,6 @@ public: VERIFY(Processor::in_critical()); SpinlockLocker block_lock2(m_block_lock); - if (should_be_stopped() || state() == Stopped) { - dbgln("Thread should be stopped, current state: {}", state_string()); - set_state(Thread::Blocked); - continue; - } if (m_blocker && !m_blocker->can_be_interrupted() && !m_should_die) { block_lock2.unlock(); dbgln("Thread should not be unblocking, current state: {}", state_string()); |