mirror of
https://github.com/RGBCube/serenity
synced 2025-05-14 05:54:58 +00:00
Kernel: Stop locking the scheduler spinlock before the ptrace mutex
Locking a mutex while holding a spinlock is always wrong, but in the case of the scheduler lock, it also causes an assertion failure. (Which would be triggered by 2 separate threads trying to ptrace at the same time).
This commit is contained in:
parent
03cb3e5370
commit
458e990b7b
1 changed files with 1 additions and 1 deletions
|
@ -18,7 +18,6 @@ namespace Kernel {
|
|||
|
||||
static ErrorOr<FlatPtr> handle_ptrace(Kernel::Syscall::SC_ptrace_params const& params, Process& caller)
|
||||
{
|
||||
SpinlockLocker scheduler_lock(g_scheduler_lock);
|
||||
if (params.request == PT_TRACE_ME) {
|
||||
if (Process::current().tracer())
|
||||
return EBUSY;
|
||||
|
@ -39,6 +38,7 @@ static ErrorOr<FlatPtr> handle_ptrace(Kernel::Syscall::SC_ptrace_params const& p
|
|||
return ESRCH;
|
||||
|
||||
MutexLocker ptrace_locker(peer->process().ptrace_lock());
|
||||
SpinlockLocker scheduler_lock(g_scheduler_lock);
|
||||
|
||||
auto peer_credentials = peer->process().credentials();
|
||||
auto caller_credentials = caller.credentials();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue