summaryrefslogtreecommitdiff
path: root/Kernel/Syscalls/execve.cpp
diff options
context:
space:
mode:
authorTom <tomut@yahoo.com>2020-12-14 16:36:22 -0700
committerAndreas Kling <kling@serenityos.org>2020-12-16 23:38:17 +0100
commitc4176b0da1000d1cba663fc5cb0f34efb1df394a (patch)
tree3c0ab1f1e11830486498cd17557bea3650df9128 /Kernel/Syscalls/execve.cpp
parent56701f91f90415329fe60a3bb8fb269fb0a71129 (diff)
downloadserenity-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.cpp3
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;