From 07a3a33719908e7e566e115dc69051d07d0bee2a Mon Sep 17 00:00:00 2001 From: Mathieu Maret Date: Wed, 7 Feb 2024 23:23:35 +0100 Subject: [PATCH] Fix write rights on pageflt --- core/uaddrspace.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/uaddrspace.c b/core/uaddrspace.c index 4278c47..0ae45f5 100644 --- a/core/uaddrspace.c +++ b/core/uaddrspace.c @@ -388,7 +388,7 @@ free_reg: int uAddrSpaceSolvePageFault(struct uAddrSpace *as, vaddr_t faultAddr, int isWriteAccess) { struct uAddrVirtualReg *reg; - int rights = PAGING_MEM_READ; + int rights = PAGING_MEM_READ | PAGING_MEM_USER; reg = findVirtualRegionFromAddr(as, faultAddr, 1); @@ -400,7 +400,7 @@ int uAddrSpaceSolvePageFault(struct uAddrSpace *as, vaddr_t faultAddr, int isWri if (isWriteAccess && !(reg->right & PAGING_MEM_WRITE)) return -EACCES; - if (isWriteAccess) + if (isWriteAccess || (reg->right & PAGING_MEM_WRITE)) rights |= PAGING_MEM_WRITE; if (reg->res->ops->nopage(reg, faultAddr, rights))