Selaa lähdekoodia

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.)
Andreas Kling 3 vuotta sitten
vanhempi
commit
601a9321d9
2 muutettua tiedostoa jossa 0 lisäystä ja 11 poistoa
  1. 0 6
      Kernel/Thread.cpp
  2. 0 5
      Kernel/Thread.h

+ 0 - 6
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;

+ 0 - 5
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());