1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:38: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:
Andreas Kling 2021-03-02 16:55:54 +01:00
parent e7ef729db3
commit b425c2602c
6 changed files with 26 additions and 18 deletions

View file

@ -31,7 +31,9 @@ namespace Kernel {
KResultOr<int> Process::sys$perf_event(int type, FlatPtr arg1, FlatPtr arg2)
{
return ensure_perf_events().append(type, arg1, arg2);
if (!create_perf_events_buffer_if_needed())
return ENOMEM;
return perf_events()->append(type, arg1, arg2);
}
}