fix: invalidate PTEs of evicted pages before eviction occurs to prevent modificationof pages mid-eviction

This commit is contained in:
Themis Demetriades
2024-12-04 15:02:49 +00:00
parent 47a7dfae04
commit 1b73e415d7
4 changed files with 12 additions and 7 deletions

View File

@@ -93,6 +93,13 @@ frame_alloc (enum palloc_flags flags, void *upage, struct thread *owner)
ASSERT (victim != NULL); /* get_victim () should never return null. */
/* 2. Swap out victim into disk. */
/* Mark page as 'not present' and flag the page directory as having
been modified *before* eviction begins to prevent the owner of the
victim page from accessing/modifying it mid-eviction. */
pagedir_clear_page (owner->pagedir, upage);
// TODO: Lock PTE of victim page for victim process.
size_t swap_slot = swap_out (victim->frame);
page_set_swap (victim->owner, victim->upage, swap_slot);