From 04e40da1885f86a23c66dca0f034fe9cbb70665f Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 21 Feb 2020 16:03:03 +0100 Subject: [PATCH] Kernel: Fix crash when reading /proc/PID/vmobjects InodeVMObjects can have nulled-out physical page slots. That just means we haven't cached that page from disk right now. --- Kernel/VM/Region.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Kernel/VM/Region.cpp b/Kernel/VM/Region.cpp index 1db032ec74..2c02c045d3 100644 --- a/Kernel/VM/Region.cpp +++ b/Kernel/VM/Region.cpp @@ -235,7 +235,8 @@ NonnullOwnPtr Region::create_kernel_only(const Range& range, const Strin bool Region::should_cow(size_t page_index) const { - if (vmobject().physical_pages()[page_index]->is_shared_zero_page()) + auto& slot = vmobject().physical_pages()[page_index]; + if (slot && slot->is_shared_zero_page()) return true; if (m_shared) return false;