From 817e7d0dfea820a369a5b5c2d5d729942b7daf42 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Wed, 10 Feb 2021 17:03:03 -0800 Subject: pk: only access user memory through explicit accessors Enforced with sstatus.SUM. --- pk/elf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'pk/elf.c') diff --git a/pk/elf.c b/pk/elf.c index 3a47e7e..bfc8daa 100644 --- a/pk/elf.c +++ b/pk/elf.c @@ -5,6 +5,7 @@ #include "boot.h" #include "bits.h" #include "elf.h" +#include "usermem.h" #include #include #include @@ -83,7 +84,7 @@ void load_elf(const char* fn, elf_info* info) int prot = get_prot(ph[i].p_flags); if (__do_mmap(vaddr - prepad, ph[i].p_filesz + prepad, prot | PROT_WRITE, flags2, file, ph[i].p_offset - prepad) != vaddr - prepad) goto fail; - memset((void*)vaddr - prepad, 0, prepad); + memset_user((void*)vaddr - prepad, 0, prepad); if (!(prot & PROT_WRITE)) if (do_mprotect(vaddr - prepad, ph[i].p_filesz + prepad, prot)) goto fail; -- cgit v1.1