Kernel: Don't allow profiling a dead process

Work towards #1313.
This commit is contained in:
Andreas Kling 2020-02-27 10:42:31 +01:00
parent 79e79ad1d2
commit 0c1497846e
Notes: sideshowbarker 2024-07-19 09:02:33 +09:00

View File

@ -4511,6 +4511,8 @@ int Process::sys$profiling_enable(pid_t pid)
auto* process = Process::from_pid(pid);
if (!process)
return -ESRCH;
if (process->is_dead())
return -ESRCH;
if (!is_superuser() && process->uid() != m_uid)
return -EPERM;
Profiling::start(*process);