Skip to content

Commit

Permalink
x86_64: paging fixes for no-execute pages of user space
Browse files Browse the repository at this point in the history
  • Loading branch information
jewelcodes committed Sep 8, 2024
1 parent 83b2220 commit 7939d91
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/platform/x86_64/cpu/paging.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,10 @@ uint64_t clonePagingLayer(uint64_t ptr, int layer) {
newPhys = pmmAllocate();
if(!newPhys) return 0;

oldPhys = parent[i] & ~(PAGE_SIZE-1);
oldPhys = parent[i] & ~(PAGE_SIZE-1) & ~PT_PAGE_NXE;
memcpy((void *)vmmMMIO(newPhys, true), (const void *)vmmMMIO(oldPhys, true), PAGE_SIZE);

clone[i] = newPhys | (parent[i] & (PAGE_SIZE-1)); // copy the parent's permissions
clone[i] = newPhys | (parent[i] & ((PAGE_SIZE-1) | PT_PAGE_NXE)); // copy the parent's permissions
} else {
// here we're working with either the PDP or PD that is also present
newPhys = pmmAllocate();
Expand Down

0 comments on commit 7939d91

Please sign in to comment.