Kernel: Stop trying to write unmapped Process regions into CoreDumps

If we crashed in the middle of mapping in Regions, some of the regions
may not have a page directory yet, and will result in a crash when
Region::remap() is called.
This commit is contained in:
Idan Horowitz 2022-02-10 19:59:26 +02:00
parent 57bce8ab97
commit 75fe51a9ca
Notes: sideshowbarker 2024-07-17 19:01:36 +09:00
2 changed files with 6 additions and 0 deletions

View File

@ -186,6 +186,10 @@ ErrorOr<void> Coredump::write_regions()
if (region->access() == Memory::Region::Access::None)
continue;
// If we crashed in the middle of mapping in Regions, they do not have a page directory yet, and will crash on a remap() call
if (!region->is_mapped())
continue;
region->set_readable(true);
region->remap();

View File

@ -188,6 +188,8 @@ public:
void remap();
[[nodiscard]] bool is_mapped() const { return m_page_directory != nullptr; }
void clear_to_zero();
[[nodiscard]] bool is_syscall_region() const { return m_syscall_region; }