mirror of
https://github.com/RGBCube/serenity
synced 2025-05-19 00:35:06 +00:00
Kernel: Quickly reject userspace addresses in kernel_region_from_vaddr()
This avoids taking and releasing the MM lock just to reject an address that we can tell from just looking at it that it won't ever be in the kernel regions tree.
This commit is contained in:
parent
145eeb57ab
commit
5092813a45
1 changed files with 3 additions and 0 deletions
|
@ -645,6 +645,9 @@ UNMAP_AFTER_INIT void MemoryManager::initialize(u32 cpu)
|
|||
|
||||
Region* MemoryManager::kernel_region_from_vaddr(VirtualAddress vaddr)
|
||||
{
|
||||
if (is_user_address(vaddr))
|
||||
return nullptr;
|
||||
|
||||
SpinlockLocker lock(s_mm_lock);
|
||||
auto* region = MM.m_kernel_regions.find_largest_not_above(vaddr.get());
|
||||
if (!region || !region->contains(vaddr))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue