mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:37:37 +00:00
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.)
This commit is contained in:
parent
cf7bbcc70e
commit
601a9321d9
2 changed files with 0 additions and 11 deletions
|
@ -208,12 +208,6 @@ void Thread::block(Kernel::Mutex& lock, SpinlockLocker<Spinlock>& lock_lock, u32
|
||||||
VERIFY(Processor::in_critical());
|
VERIFY(Processor::in_critical());
|
||||||
|
|
||||||
SpinlockLocker block_lock2(m_block_lock);
|
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);
|
VERIFY(!m_blocking_lock);
|
||||||
m_blocking_lock = previous_blocking_lock;
|
m_blocking_lock = previous_blocking_lock;
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -950,11 +950,6 @@ public:
|
||||||
VERIFY(Processor::in_critical());
|
VERIFY(Processor::in_critical());
|
||||||
|
|
||||||
SpinlockLocker block_lock2(m_block_lock);
|
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) {
|
if (m_blocker && !m_blocker->can_be_interrupted() && !m_should_die) {
|
||||||
block_lock2.unlock();
|
block_lock2.unlock();
|
||||||
dbgln("Thread should not be unblocking, current state: {}", state_string());
|
dbgln("Thread should not be unblocking, current state: {}", state_string());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue