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
commit 98b328754e
Notes: sideshowbarker 2024-07-19 11:26:31 +09:00

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());