summaryrefslogtreecommitdiff
path: root/kernel/arch
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-05-01 18:27:52 +0200
committerAnton Kling <anton@kling.gg>2024-05-01 18:27:52 +0200
commit44e18bb63daa932ed844591de4d2dbb3777d63f7 (patch)
treea61f13aa8c4e80c6eca030742c47b515f33c7519 /kernel/arch
parentc9ee89221426ef441e123c5bdf267d2ea3e0230c (diff)
Bug: Kernel/MMU: Initialize memory after allocation
The memory not being zeroed caused certain flags to be set(presumably no-cache flag) and resulted in the OS being unusually for only certain operations and only in certain cases.
Diffstat (limited to 'kernel/arch')
-rw-r--r--kernel/arch/i386/mmu.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/kernel/arch/i386/mmu.c b/kernel/arch/i386/mmu.c
index bf0d514..9802142 100644
--- a/kernel/arch/i386/mmu.c
+++ b/kernel/arch/i386/mmu.c
@@ -70,6 +70,7 @@ void *ksbrk(size_t s) {
(data_end - (uintptr_t)rc))) {
return (void *)-1;
}
+ get_fast_insecure_random(rc, s);
assert(((uintptr_t)rc % PAGE_SIZE) == 0);
return (void *)rc;
}
@@ -182,6 +183,7 @@ PageTable *clone_table(u32 src_index, PageDirectory *src_directory,
u32 *physical_address) {
PageTable *new_table =
kmalloc_align(sizeof(PageTable), (void **)physical_address);
+ memset(new_table, 0, sizeof(PageTable));
if (!new_table) {
return NULL;
}
@@ -251,6 +253,7 @@ PageDirectory *clone_directory(PageDirectory *original) {
u32 physical_address;
PageDirectory *new_directory =
kmalloc_align(sizeof(PageDirectory), (void **)&physical_address);
+ memset(new_directory, 0, sizeof(PageDirectory));
if (!new_directory) {
return NULL;
}