diff options
| author | Michal Idziorek <m.i@gmx.at> | 2014-12-02 08:28:18 +0100 |
|---|---|---|
| committer | Michal Idziorek <m.i@gmx.at> | 2014-12-02 08:28:18 +0100 |
| commit | b4e8da9b6e43366eaa7198f349ce30421c1d7bf1 (patch) | |
| tree | a0378243e934002e9b4a74fc8321ba46da1dbf38 /kernel/smashing.c | |
| parent | de8c758de78cd7091f80b582cf706fc441f6ca72 (diff) | |
little cleanup
Diffstat (limited to 'kernel/smashing.c')
| -rw-r--r-- | kernel/smashing.c | 22 |
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"); +} +// |
