banan-os/kernel/kernel/SSP.cpp

23 lines
376 B
C++
Raw Normal View History

#include <kernel/Panic.h>
2022-12-13 12:10:50 +02:00
2022-11-12 23:45:26 +02:00
#include <stdint.h>
#include <stdlib.h>
2022-11-12 23:45:26 +02:00
#if UINT32_MAX == UINTPTR_MAX
#define STACK_CHK_GUARD 0xe2dee396
#else
#define STACK_CHK_GUARD 0x595e9fbd94fda766
#endif
2022-11-12 23:45:26 +02:00
uintptr_t __stack_chk_guard = STACK_CHK_GUARD;
2022-11-15 21:42:14 +02:00
__BEGIN_DECLS
2022-11-12 23:45:26 +02:00
__attribute__((noreturn))
void __stack_chk_fail(void)
{
Kernel::panic("Stack smashing detected");
2022-11-12 23:45:26 +02:00
abort();
2022-11-15 21:42:14 +02:00
}
__END_DECLS