From 915791f6acedbb35db73216156c1baa790e384d9 Mon Sep 17 00:00:00 2001 From: Miguel Date: Wed, 26 Sep 2018 11:12:18 +0200 Subject: claning up interrupts --- xxx/smashing.c | 22 ++++++++++++++++++++++ xxx/smashing.h | 1 + 2 files changed, 23 insertions(+) create mode 100644 xxx/smashing.c create mode 100644 xxx/smashing.h (limited to 'xxx') diff --git a/xxx/smashing.c b/xxx/smashing.c new file mode 100644 index 0000000..d4365b9 --- /dev/null +++ b/xxx/smashing.c @@ -0,0 +1,22 @@ +#include "kernel/kernel.h" +#include "log.h" +#include + +// CODE FOR Stack Smashing Protector. +// Do not duplicate with userspace / sys.c +// http://wiki.osdev.org/Stack_Smashing_Protector + +#if UINT32_MAX == UINTPTR_MAX +#define STACK_CHK_GUARD 0xe2dee396 +#else +#define STACK_CHK_GUARD 0x595e9fbd94fda766 +#endif + +uintptr_t __stack_chk_guard = STACK_CHK_GUARD; + +__attribute__((noreturn)) +void __stack_chk_fail(void) +{ + kpanic("Stack smashing detected"); +} +// diff --git a/xxx/smashing.h b/xxx/smashing.h new file mode 100644 index 0000000..760b7c9 --- /dev/null +++ b/xxx/smashing.h @@ -0,0 +1 @@ +/*empty*/ -- cgit v1.2.3