1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:37:46 +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

@ -467,8 +467,6 @@ private:
bool add_thread(Thread&);
bool remove_thread(Thread&);
PerformanceEventBuffer& ensure_perf_events();
Process(RefPtr<Thread>& first_thread, const String& name, uid_t, gid_t, ProcessID ppid, bool is_kernel_process, RefPtr<Custody> cwd = nullptr, RefPtr<Custody> executable = nullptr, TTY* = nullptr, Process* fork_parent = nullptr);
static ProcessID allocate_pid();
@ -476,6 +474,7 @@ private:
void kill_all_threads();
bool dump_core();
bool dump_perfcore();
bool create_perf_events_buffer_if_needed();
KResult do_exec(NonnullRefPtr<FileDescription> main_program_description, Vector<String> arguments, Vector<String> environment, RefPtr<FileDescription> interpreter_description, Thread*& new_main_thread, u32& prev_flags, const Elf32_Ehdr& main_program_header);
KResultOr<ssize_t> do_write(FileDescription&, const UserOrKernelBuffer&, size_t);