From e7467e5ce8dadf35ada03f341725aa94103dccef Mon Sep 17 00:00:00 2001 From: Matheus Date: Sun, 8 Jan 2023 19:30:31 -0300 Subject: [PATCH] vmm: make sure there is a thread in the struct in the dealwithrequest call --- src/sys/mm/vmm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sys/mm/vmm.c b/src/sys/mm/vmm.c index 6e9dac3c..f431b29a 100644 --- a/src/sys/mm/vmm.c +++ b/src/sys/mm/vmm.c @@ -639,7 +639,11 @@ bool vmm_allocnowat(void* addr, size_t mmuflags, size_t size){ // called by the page fault handler int vmm_dealwithrequest(void* addr, long error, bool user){ - + + if(!arch_getcls()->thread) // the fault happened before the scheduler was initialised. + return EFAULT; + + if(user && addr > USER_SPACE_END) return EFAULT;