diff options
author | Andreas Kling <kling@serenityos.org> | 2021-12-11 21:16:57 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-12-11 21:18:42 +0100 |
commit | 813593a485671e78f17c4e79f1ce12c31dd35aa6 (patch) | |
tree | 8b864f7a781a6b16ab7d94cd09149e3897592979 /Kernel/Memory | |
parent | ecccd511fac7662f9ab9bf499cbe0c2be49b2440 (diff) | |
download | serenity-813593a485671e78f17c4e79f1ce12c31dd35aa6.zip |
Kernel: Fix overly loose MemoryManager::kernel_region_from_vaddr()
It's not enough to just find the largest-address-not-above the argument,
we must also check that the found region actually contains the argument.
Regressed in a23edd42b869a16e11f4d6ca9071d6b570dc219c, thanks to Idan
for pointing this out.
Diffstat (limited to 'Kernel/Memory')
-rw-r--r-- | Kernel/Memory/MemoryManager.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/Kernel/Memory/MemoryManager.cpp b/Kernel/Memory/MemoryManager.cpp index 81f5da7c1d..bf9acc51fd 100644 --- a/Kernel/Memory/MemoryManager.cpp +++ b/Kernel/Memory/MemoryManager.cpp @@ -623,7 +623,7 @@ Region* MemoryManager::kernel_region_from_vaddr(VirtualAddress vaddr) auto* region_ptr = MM.m_kernel_regions.find_largest_not_above(vaddr.get()); if (!region_ptr) return nullptr; - return *region_ptr; + return (*region_ptr)->contains(vaddr) ? *region_ptr : nullptr; } Region* MemoryManager::find_user_region_from_vaddr_no_lock(AddressSpace& space, VirtualAddress vaddr) |