mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Kernel: Create and use USER_RANGE_CEILING
We had an inconsistency in valid user addresses. is_user_range() was checking against the kernel base address, but previous changes caused the maximum valid user addressable range to be 32 MiB below that. This patch stops mmap(MAP_FIXED) of a range between these two bounds from panic-ing the kernel in RangeAllocator::allocate_specific.
This commit is contained in:
parent
ab196b484a
commit
578d45b480
Notes:
sideshowbarker
2024-07-18 09:18:58 +09:00
Author: https://github.com/ADKaster Commit: https://github.com/SerenityOS/serenity/commit/578d45b480c Pull-request: https://github.com/SerenityOS/serenity/pull/8522 Reviewed-by: https://github.com/alimpfard Reviewed-by: https://github.com/awesomekling
3 changed files with 4 additions and 2 deletions
|
@ -19,3 +19,5 @@
|
|||
#define KERNEL_QUICKMAP_PD (KERNEL_PT1024_BASE + 0x7000)
|
||||
#define KERNEL_QUICKMAP_PER_CPU_BASE (KERNEL_PT1024_BASE + 0x8000)
|
||||
#define KERNEL_PHYSICAL_PAGES_BASE (KERNEL_BASE + KERNEL_PD_OFFSET)
|
||||
|
||||
#define USER_RANGE_CEILING 0xBE000000
|
||||
|
|
|
@ -278,7 +278,7 @@ void VMObject::for_each_region(Callback callback)
|
|||
|
||||
inline bool is_user_address(VirtualAddress vaddr)
|
||||
{
|
||||
return vaddr.get() < KERNEL_BASE;
|
||||
return vaddr.get() < USER_RANGE_CEILING;
|
||||
}
|
||||
|
||||
inline bool is_user_range(VirtualAddress vaddr, size_t size)
|
||||
|
|
|
@ -63,7 +63,7 @@ UNMAP_AFTER_INIT void PageDirectory::allocate_kernel_directory()
|
|||
PageDirectory::PageDirectory(const RangeAllocator* parent_range_allocator)
|
||||
{
|
||||
constexpr FlatPtr userspace_range_base = 0x00800000;
|
||||
constexpr FlatPtr userspace_range_ceiling = 0xbe000000;
|
||||
constexpr FlatPtr userspace_range_ceiling = USER_RANGE_CEILING;
|
||||
|
||||
ScopedSpinLock lock(s_mm_lock);
|
||||
if (parent_range_allocator) {
|
||||
|
|
Loading…
Reference in a new issue