mirror of
https://github.com/RGBCube/serenity
synced 2025-07-08 17:27:35 +00:00
Kernel: Make sure the kernel info page is read-only for userspace
To enforce this, we create two separate mappings of the same underlying physical page. A writable mapping for the kernel, and a read-only one for userspace (the one returned by sys$get_kernel_info_page.)
This commit is contained in:
parent
77cf607cda
commit
0a75a46501
3 changed files with 26 additions and 7 deletions
|
@ -369,6 +369,17 @@ OwnPtr<Region> MemoryManager::allocate_user_accessible_kernel_region(size_t size
|
|||
return allocate_kernel_region(size, name, true);
|
||||
}
|
||||
|
||||
OwnPtr<Region> MemoryManager::allocate_kernel_region_with_vmobject(VMObject& vmobject, size_t size, const StringView& name)
|
||||
{
|
||||
InterruptDisabler disabler;
|
||||
ASSERT(!(size % PAGE_SIZE));
|
||||
auto range = kernel_page_directory().range_allocator().allocate_anywhere(size);
|
||||
ASSERT(range.is_valid());
|
||||
auto region = make<Region>(range, vmobject, 0, name, PROT_READ | PROT_WRITE | PROT_EXEC);
|
||||
region->map(kernel_page_directory());
|
||||
return region;
|
||||
}
|
||||
|
||||
void MemoryManager::deallocate_user_physical_page(PhysicalPage&& page)
|
||||
{
|
||||
for (auto& region : m_user_physical_regions) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue