1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:47:35 +00:00

Kernel: Track big lock blocked threads in separate list

When we lock a mutex, eventually `Thread::block` is invoked which could
in turn invoke `Process::big_lock().restore_exclusive_lock()`. This
would then try to add the current thread to a different blocked thread
list then the one in use for the original mutex being locked, and
because it's an intrusive list, the thread is removed from its original
list during the `.append()`. When the original mutex eventually
unblocks, we no longer have the thread in the intrusive blocked threads
list and we panic.

Solve this by making the big lock mutex special and giving it its own
blocked thread list. Because the process big lock is temporary and is
being actively removed from e.g. syscalls, it's a matter of time before
we can also remove the fix introduced by this commit.

Fixes issue #9401.
This commit is contained in:
Jelle Raaijmakers 2022-04-06 01:49:30 +02:00 committed by Andreas Kling
parent be26818448
commit 7826729ab2
4 changed files with 48 additions and 13 deletions

View file

@ -809,7 +809,7 @@ private:
size_t m_master_tls_size { 0 };
size_t m_master_tls_alignment { 0 };
Mutex m_big_lock { "Process" };
Mutex m_big_lock { "Process", Mutex::MutexBehavior::BigLock };
Mutex m_ptrace_lock { "ptrace" };
RefPtr<Timer> m_alarm_timer;