// // Created by rick on 15-03-21. // // stack smashing protector #include #if __STDC_HOSTED__ #include #else #include #endif #if UINT32_MAX == UINTPTR_MAX #define STACK_CHK_GUARD 0xe2dee396 #else #define STACK_CHK_GUARD 0x595e9fbd94fda766 #endif // todo this value should be unique every time the kernel starts uintptr_t __stack_chk_guard = STACK_CHK_GUARD; void __attribute__((__noreturn__)) __stack_chk_fail(void) { #if __STDC_HOSTED__ #error "UNKNONONO" abort(); #else k_panics("Stack Smashed!"); #endif }