From fd98c9a86eb8100b19cb81dc9d84df6067d093c9 Mon Sep 17 00:00:00 2001 From: Matthias Kruk Date: Wed, 25 Sep 2019 19:03:51 +0900 Subject: [PATCH] Make sure PAGE_ATTR_USER is set on page tables when we're mapping something with PAGE_ATTR_USER within them (IA-32 legacy paging) --- kernel/arch/paging.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/arch/paging.c b/kernel/arch/paging.c index 7f5a624..222df81 100644 --- a/kernel/arch/paging.c +++ b/kernel/arch/paging.c @@ -723,6 +723,11 @@ static int _pg_dir_map_legacy(page_table_t *pd, u32_t paddr, u32_t vaddr, pt = (page_table_t*)(pd->pt_entries[pde] & 0xfffff000); + /* make sure PAGE_ATTR_USER is set on the page table, if necessary */ + if(flags & PAGE_ATTR_USER) { + pd->pt_entries[pde] |= PAGE_ATTR_USER; + } + if(pt->pt_entries[pte] & PAGE_ATTR_PRESENT) { ret_val = -EALREADY; break; -- 2.47.3