From 2c9582a8a3d0b294536ede6dabc3066384c85644 Mon Sep 17 00:00:00 2001 From: Barret Rhoden Date: Tue, 2 Jul 2013 13:18:21 -0700 Subject: [PATCH] Fixes memory checking bug on syscall structs The long term fix is to have the kernel handle page faults on user addresses, instead of looking at the page tables (which is insufficient unless we pin, and is slow regardless). --- kern/src/syscall.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/kern/src/syscall.c b/kern/src/syscall.c index b4e51a3..bea3c9c 100644 --- a/kern/src/syscall.c +++ b/kern/src/syscall.c @@ -1702,8 +1702,10 @@ void run_local_syscall(struct syscall *sysc) /* TODO: (UMEM) assert / pin the memory for the sysc */ assert(irq_is_enabled()); /* in case we proc destroy */ - user_mem_assert(pcpui->cur_proc, sysc, sizeof(struct syscall), - sizeof(uintptr_t), PTE_USER_RW); + /* Abort on mem check failure, for now */ + if (!user_mem_check(pcpui->cur_proc, sysc, sizeof(struct syscall), + sizeof(uintptr_t), PTE_USER_RW)) + return; pcpui->cur_sysc = sysc; /* let the core know which sysc it is */ sysc->retval = syscall(pcpui->cur_proc, sysc->num, sysc->arg0, sysc->arg1, sysc->arg2, sysc->arg3, sysc->arg4, sysc->arg5); -- 2.7.4