diff options
author | Danny Holman <dholman@gymli.org> | 2024-05-27 13:53:52 -0500 |
---|---|---|
committer | Danny Holman <dholman@gymli.org> | 2024-05-27 13:53:52 -0500 |
commit | aaf7355c5ededfcdc877c7f2989fb1ba02dfb848 (patch) | |
tree | 0c4588650fe1fc1fa1af2972353a2bc920cf1e68 /libk/stack_protector.c | |
parent | 41cff28f5447b5f669db62ce2a73be98bc5bce37 (diff) |
libk: create a subset libc for kernel use
Create a subset of the C library for use inside the kernel.
Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to 'libk/stack_protector.c')
-rw-r--r-- | libk/stack_protector.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/libk/stack_protector.c b/libk/stack_protector.c new file mode 100644 index 0000000..78d0302 --- /dev/null +++ b/libk/stack_protector.c @@ -0,0 +1,11 @@ +#include <kernel/panic.h> +#include <stdint.h> +#include <stddef.h> + +#define STACK_CHK_GUARD 0x32E3429E + +uintptr_t __stack_chk_guard = STACK_CHK_GUARD; + +__attribute__((noreturn)) void __stack_chk_fail(void) { + panic("STACK SMASHING IN KERNEL ADDRESS SPACE"); +} |