diff options
author | dzwdz | 2022-05-21 18:30:52 +0200 |
---|---|---|
committer | dzwdz | 2022-05-21 18:30:52 +0200 |
commit | e0101ecf0d2f29d8860e865e3f333803af918f2e (patch) | |
tree | ebe1fb8eaefbd31b9931cb7514d75e09faff6a74 /src | |
parent | 0fd9c19c5d66a380ad4b2b881881ce7fba9a6d27 (diff) |
syscall/memflag: zero out allocated pages to prevent leaks
Diffstat (limited to 'src')
-rw-r--r-- | src/kernel/syscalls.c | 7 |
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); |