mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:57:35 +00:00
Kernel: Prevent execve/ptrace race
Add a per-process ptrace lock and use it to prevent ptrace access to a process after it decides to commit to a new executable in sys$execve(). Fixes #5230.
This commit is contained in:
parent
4b7b92c201
commit
4ff0f971f7
3 changed files with 8 additions and 4 deletions
|
@ -57,6 +57,8 @@ static KResultOr<u32> handle_ptrace(const Kernel::Syscall::SC_ptrace_params& par
|
|||
if (!peer)
|
||||
return ESRCH;
|
||||
|
||||
Locker ptrace_locker(peer->process().ptrace_lock());
|
||||
|
||||
if ((peer->process().uid() != caller.euid())
|
||||
|| (peer->process().uid() != peer->process().euid())) // Disallow tracing setuid processes
|
||||
return EACCES;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue