mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-08 04:15:23 +03: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
Notes:
sideshowbarker
2024-07-18 05:01:22 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/601a9321d9e
@ -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;
|
||||
|
@ -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());
|
||||
|
Loading…
Reference in New Issue
Block a user