summaryrefslogtreecommitdiff
path: root/kernel/smashing.c
diff options
context:
space:
mode:
authorMichal Idziorek <m.i@gmx.at>2014-12-02 08:28:18 +0100
committerMichal Idziorek <m.i@gmx.at>2014-12-02 08:28:18 +0100
commitb4e8da9b6e43366eaa7198f349ce30421c1d7bf1 (patch)
treea0378243e934002e9b4a74fc8321ba46da1dbf38 /kernel/smashing.c
parentde8c758de78cd7091f80b582cf706fc441f6ca72 (diff)
little cleanup
Diffstat (limited to 'kernel/smashing.c')
-rw-r--r--kernel/smashing.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/kernel/smashing.c b/kernel/smashing.c
new file mode 100644
index 0000000..a96030c
--- /dev/null
+++ b/kernel/smashing.c
@@ -0,0 +1,22 @@
+#include <stdint.h>
+#include "lib/logger/log.h"
+// 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
+
+#define FOOLOS_MODULE_NAME "ssp"
+
+uintptr_t __stack_chk_guard = STACK_CHK_GUARD;
+
+__attribute__((noreturn))
+void __stack_chk_fail(void)
+{
+ panic(FOOLOS_MODULE_NAME,"Stack smashing detected");
+}
+//