mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:18:12 +00:00
Kernel: Better handling of allocation failure in profiling
If we can't allocate a PerformanceEventBuffer to store the profiling events, we now fail sys$profiling_enable() and sys$perf_event() with ENOMEM instead of carrying on with a broken buffer.
This commit is contained in:
parent
e7ef729db3
commit
b425c2602c
6 changed files with 26 additions and 18 deletions
|
@ -43,7 +43,8 @@ KResultOr<int> Process::sys$profiling_enable(pid_t pid)
|
|||
return ESRCH;
|
||||
if (!is_superuser() && process->uid() != m_euid)
|
||||
return EPERM;
|
||||
process->ensure_perf_events();
|
||||
if (!process->create_perf_events_buffer_if_needed())
|
||||
return ENOMEM;
|
||||
process->set_profiling(true);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue