summaryrefslogtreecommitdiff
path: root/libk/stack_protector.c
diff options
context:
space:
mode:
Diffstat (limited to 'libk/stack_protector.c')
-rw-r--r--libk/stack_protector.c11
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");
+}