1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 12:17:35 +00:00

Kernel: Lock target process when generating core dump

Dumping core can happen at the end of a profiling run, and in that case
we have to protect the target process and take the lock while iterating
over its region map.

Fixes #4509.
This commit is contained in:
Andreas Kling 2020-12-27 00:51:48 +01:00
parent 4395e1b240
commit 87492e723b
2 changed files with 17 additions and 17 deletions

View file

@ -39,13 +39,13 @@ class Process;
class CoreDump {
public:
static OwnPtr<CoreDump> create(Process&, const String& output_path);
static OwnPtr<CoreDump> create(NonnullRefPtr<Process>, const String& output_path);
~CoreDump();
[[nodiscard]] KResult write();
private:
CoreDump(Process&, NonnullRefPtr<FileDescription>&&);
CoreDump(NonnullRefPtr<Process>, NonnullRefPtr<FileDescription>&&);
static RefPtr<FileDescription> create_target_file(const Process&, const String& output_path);
[[nodiscard]] KResult write_elf_header();
@ -57,7 +57,7 @@ private:
ByteBuffer create_notes_threads_data() const;
ByteBuffer create_notes_regions_data() const;
Process& m_process;
NonnullRefPtr<Process> m_process;
NonnullRefPtr<FileDescription> m_fd;
const size_t m_num_program_headers;
};