From 6e37487477ae3059350a32baa337e376337ad752 Mon Sep 17 00:00:00 2001 From: Idan Horowitz Date: Sat, 15 Jan 2022 04:16:11 +0200 Subject: [PATCH] Kernel: Always remove PageDirectories from the cr3 map on destruction Previously we would only remove them from the map if they were attached to an AddressSpace, even though we would always add them to the map on construction. This results in an assertion failure on destruction if the page directory was never attached to an AddressSpace. (for example, on an allocation failure of said AddressSpace) --- Kernel/Memory/PageDirectory.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Kernel/Memory/PageDirectory.cpp b/Kernel/Memory/PageDirectory.cpp index dda93a48db..c54b95d3c7 100644 --- a/Kernel/Memory/PageDirectory.cpp +++ b/Kernel/Memory/PageDirectory.cpp @@ -151,8 +151,7 @@ UNMAP_AFTER_INIT void PageDirectory::allocate_kernel_directory() PageDirectory::~PageDirectory() { SpinlockLocker lock(s_mm_lock); - if (m_space) - cr3_map().remove(cr3()); + cr3_map().remove(cr3()); } }