1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 19:27:44 +00:00

Kernel: Acquire reference to waitee before trying to block in sys$waitid

Previously, we would try to acquire a reference to the all processes
lock or other contended resources while holding both the scheduler lock
and the thread's blocker lock. This could lead to a deadlock if we
actually have to block on those other resources.
This commit is contained in:
Andrew Kaster 2021-08-22 22:01:04 -06:00 committed by Andreas Kling
parent dea62fe93c
commit 54161bf5b4
4 changed files with 43 additions and 66 deletions

View file

@ -14,6 +14,7 @@
#include <AK/OwnPtr.h>
#include <AK/String.h>
#include <AK/Userspace.h>
#include <AK/Variant.h>
#include <AK/WeakPtr.h>
#include <AK/Weakable.h>
#include <Kernel/API/Syscall.h>
@ -541,7 +542,7 @@ private:
KResult do_killall(int signal);
KResult do_killself(int signal);
KResultOr<siginfo_t> do_waitid(idtype_t idtype, int id, int options);
KResultOr<siginfo_t> do_waitid(Variant<Empty, NonnullRefPtr<Process>, NonnullRefPtr<ProcessGroup>> waitee, int options);
KResultOr<NonnullOwnPtr<KString>> get_syscall_path_argument(Userspace<const char*> user_path, size_t path_length) const;
KResultOr<NonnullOwnPtr<KString>> get_syscall_path_argument(const Syscall::StringArgument&) const;