diff options
author | Andreas Kling <kling@serenityos.org> | 2020-02-01 10:26:05 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-02-01 10:56:17 +0100 |
commit | 8d51352b967494d247391686c0df7876fee2a9dd (patch) | |
tree | efa43fbe9450d3b644dd4f5690c04d1d98a49d86 /Kernel/Heap/kmalloc.h | |
parent | f2846e8e08e03699399eb4262d34d5835552ce97 (diff) | |
download | serenity-8d51352b967494d247391686c0df7876fee2a9dd.zip |
Kernel: Add crash logging heuristic for uninitialized kmalloc()/kfree()
Since we scrub both kmalloc() and kfree() with predictable values, we
can log a helpful message when hitting a crash that looks like it might
be a dereference of such scrubbed data.
Diffstat (limited to 'Kernel/Heap/kmalloc.h')
-rw-r--r-- | Kernel/Heap/kmalloc.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Kernel/Heap/kmalloc.h b/Kernel/Heap/kmalloc.h index 772e54112d..a60422ea1e 100644 --- a/Kernel/Heap/kmalloc.h +++ b/Kernel/Heap/kmalloc.h @@ -30,6 +30,9 @@ //#define KMALLOC_DEBUG_LARGE_ALLOCATIONS +#define KMALLOC_SCRUB_BYTE 0xbb +#define KFREE_SCRUB_BYTE 0xaa + void kmalloc_init(); [[gnu::malloc, gnu::returns_nonnull, gnu::alloc_size(1)]] void* kmalloc_impl(size_t); [[gnu::malloc, gnu::returns_nonnull, gnu::alloc_size(1)]] void* kmalloc_eternal(size_t); |