1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 04:38:11 +00:00

Kernel: Fix bad setup of CoW faults for offset regions

Regions with an offset into their VMObject were incorrectly adding the
page offset when indexing into the CoW bitmap.
This commit is contained in:
Andreas Kling 2019-11-03 23:54:35 +01:00
parent 5b7f8634e3
commit 98b328754e

View file

@ -697,8 +697,7 @@ void MemoryManager::map_region_at_address(PageDirectory& page_directory, Region&
if (physical_page) {
pte.set_physical_page_base(physical_page->paddr().get());
pte.set_present(true); // FIXME: Maybe we should use the is_readable flag here?
// FIXME: It seems wrong that the *region* cow map is essentially using *VMO* relative indices.
if (region.should_cow(region.first_page_index() + i))
if (region.should_cow(i))
pte.set_writable(false);
else
pte.set_writable(region.is_writable());