summaryrefslogtreecommitdiff
path: root/kernel/arch
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2023-11-10 15:19:49 +0100
committerAnton Kling <anton@kling.gg>2023-11-10 15:19:49 +0100
commit0cb4afef6da5488a128e5aaece435e9aa5f5797e (patch)
treeb77f05fa03878bad5542c31e42f19f4c99034149 /kernel/arch
parent8ffef83741948964171ca111fd7c90534515ae87 (diff)
Kernel/Memory: Fill new allocations with random data.
This should make it easier to spot uninitalized memory being used.
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 9f20ce0..53aa5dd 100644
--- a/kernel/arch/i386/mmu.c
+++ b/kernel/arch/i386/mmu.c
@@ -3,6 +3,7 @@
#include <log.h>
#include <math.h>
#include <mmu.h>
+#include <random.h>
#define INDEX_FROM_BIT(a) (a / (32))
#define OFFSET_FROM_BIT(a) (a % (32))
@@ -35,6 +36,7 @@ void *ksbrk(size_t s) {
// If there is no active pagedirectory we
// just assume that the memory is
// already mapped.
+ get_random((void *)rc, data_end - rc);
return (void *)rc;
}
// Determine whether we are approaching a unallocated table
@@ -57,6 +59,7 @@ void *ksbrk(size_t s) {
assert(((uintptr_t)rc % PAGE_SIZE) == 0);
memset((void *)rc, 0x00, s);
+ get_random((void *)rc, data_end - rc);
return (void *)rc;
}