From df7d847978c9caaf10500406b4c03c753231d740 Mon Sep 17 00:00:00 2001 From: Themis Demetriades Date: Mon, 2 Dec 2024 21:07:17 +0000 Subject: [PATCH] fix: remove stack fault checks for page faults outside user non-present addresses --- src/userprog/exception.c | 6 +----- src/vm/stackgrowth.c | 3 +-- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/userprog/exception.c b/src/userprog/exception.c index cecd143..2fe8648 100644 --- a/src/userprog/exception.c +++ b/src/userprog/exception.c @@ -149,14 +149,10 @@ page_fault (struct intr_frame *f) #ifdef VM if (user && not_present) { - if (handle_stack_fault (fault_addr, f->esp)) - return; + if (handle_stack_fault (fault_addr, f->esp)) return; } else { - if (handle_stack_fault (fault_addr, thread_current ()->curr_esp)) - return; - f->eip = (void *)f->eax; f->eax = 0xffffffff; return; diff --git a/src/vm/stackgrowth.c b/src/vm/stackgrowth.c index 8dae21a..cf44ed5 100644 --- a/src/vm/stackgrowth.c +++ b/src/vm/stackgrowth.c @@ -26,8 +26,7 @@ handle_stack_fault (const void *ptr, const void *esp) static bool is_stack_fault (const void *addr, const void *esp) { - return (is_user_vaddr (addr) && - (uint32_t*)addr >= ((uint32_t*)esp - MAX_STACK_ACCESS_DIST) && + return ((uint32_t*)addr >= ((uint32_t*)esp - MAX_STACK_ACCESS_DIST) && ((PHYS_BASE - pg_round_down (addr)) <= MAX_STACK_SIZE)); }