summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordzwdz2022-05-21 18:30:52 +0200
committerdzwdz2022-05-21 18:30:52 +0200
commite0101ecf0d2f29d8860e865e3f333803af918f2e (patch)
treeebe1fb8eaefbd31b9931cb7514d75e09faff6a74 /src
parent0fd9c19c5d66a380ad4b2b881881ce7fba9a6d27 (diff)
syscall/memflag: zero out allocated pages to prevent leaks
Diffstat (limited to 'src')
-rw-r--r--src/kernel/syscalls.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/kernel/syscalls.c b/src/kernel/syscalls.c
index 560cd37..af70e4e 100644
--- a/src/kernel/syscalls.c
+++ b/src/kernel/syscalls.c
@@ -266,8 +266,11 @@ int _syscall_memflag(void __user *addr, size_t len, int flags) {
continue;
}
- if (!pagedir_virt2phys(pages, addr, false, false))
- pagedir_map(pages, addr, page_alloc(1), true, true);
+ if (!pagedir_virt2phys(pages, addr, false, false)) {
+ void *phys = page_alloc(1);
+ memset(phys, 0, PAGE_SIZE); // TODO somehow test this
+ pagedir_map(pages, addr, phys, true, true);
+ }
}
SYSCALL_RETURN(-1);