mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 03:17: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
|
@ -483,6 +483,9 @@ int Process::do_exec(NonnullRefPtr<FileDescription> main_program_description, Ve
|
|||
|
||||
// We commit to the new executable at this point. There is no turning back!
|
||||
|
||||
// Prevent other processes from attaching to us with ptrace while we're doing this.
|
||||
Locker ptrace_locker(ptrace_lock());
|
||||
|
||||
// Disable profiling temporarily in case it's running on this process.
|
||||
TemporaryChange profiling_disabler(m_profiling, false);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue