diff options
author | Tom <tomut@yahoo.com> | 2020-12-14 16:36:22 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-16 23:38:17 +0100 |
commit | c4176b0da1000d1cba663fc5cb0f34efb1df394a (patch) | |
tree | 3c0ab1f1e11830486498cd17557bea3650df9128 /Kernel/Syscalls/execve.cpp | |
parent | 56701f91f90415329fe60a3bb8fb269fb0a71129 (diff) | |
download | serenity-c4176b0da1000d1cba663fc5cb0f34efb1df394a.zip |
Kernel: Fix Lock race causing infinite spinning between two threads
We need to account for how many shared lock instances the current
thread owns, so that we can properly release such references when
yielding execution.
We also need to release the process lock when donating.
Diffstat (limited to 'Kernel/Syscalls/execve.cpp')
-rw-r--r-- | Kernel/Syscalls/execve.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Kernel/Syscalls/execve.cpp b/Kernel/Syscalls/execve.cpp index 9fbd7c1a97..6b037b3f1d 100644 --- a/Kernel/Syscalls/execve.cpp +++ b/Kernel/Syscalls/execve.cpp @@ -348,7 +348,8 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve ScopedSpinLock lock(g_scheduler_lock); new_main_thread->set_state(Thread::State::Runnable); } - big_lock().force_unlock_if_locked(); + u32 lock_count_to_restore; + (void)big_lock().force_unlock_if_locked(lock_count_to_restore); ASSERT_INTERRUPTS_DISABLED(); ASSERT(Processor::current().in_critical()); return 0; |