mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
Kernel: Fix 64-bit address truncation in MemoryManager::ensure_pte()
This commit is contained in:
parent
ed25a6ad0d
commit
f0c4941beb
Notes:
sideshowbarker
2024-07-18 08:48:25 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/f0c4941beb4 Pull-request: https://github.com/SerenityOS/serenity/pull/8795 Reviewed-by: https://github.com/Hendiadyoin1
@ -552,7 +552,8 @@ PageTableEntry* MemoryManager::ensure_pte(PageDirectory& page_directory, Virtual
|
|||||||
pde.set_global(&page_directory == m_kernel_page_directory.ptr());
|
pde.set_global(&page_directory == m_kernel_page_directory.ptr());
|
||||||
// Use page_directory_table_index and page_directory_index as key
|
// Use page_directory_table_index and page_directory_index as key
|
||||||
// This allows us to release the page table entry when no longer needed
|
// This allows us to release the page table entry when no longer needed
|
||||||
auto result = page_directory.m_page_tables.set(vaddr.get() & ~0x1fffff, move(page_table));
|
auto result = page_directory.m_page_tables.set(vaddr.get() & ~(FlatPtr)0x1fffff, move(page_table));
|
||||||
|
// If you're hitting this VERIFY on x86_64 chances are a 64-bit pointer was truncated somewhere
|
||||||
VERIFY(result == AK::HashSetResult::InsertedNewEntry);
|
VERIFY(result == AK::HashSetResult::InsertedNewEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ private:
|
|||||||
#else
|
#else
|
||||||
RefPtr<PhysicalPage> m_directory_pages[4];
|
RefPtr<PhysicalPage> m_directory_pages[4];
|
||||||
#endif
|
#endif
|
||||||
HashMap<u32, RefPtr<PhysicalPage>> m_page_tables;
|
HashMap<FlatPtr, RefPtr<PhysicalPage>> m_page_tables;
|
||||||
RecursiveSpinLock m_lock;
|
RecursiveSpinLock m_lock;
|
||||||
bool m_valid { false };
|
bool m_valid { false };
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user