1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 05:27:46 +00:00

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.
This commit is contained in:
Andreas Kling 2020-02-01 10:26:05 +01:00
parent f2846e8e08
commit 8d51352b96
3 changed files with 11 additions and 2 deletions

View file

@ -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);