2023-01-09 14:56:20 +02:00
|
|
|
#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>
|
2023-09-09 22:52:03 +03:00
|
|
|
|
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
|
2023-09-09 22:52:03 +03:00
|
|
|
|
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)
|
|
|
|
{
|
2023-02-01 21:05:44 +02:00
|
|
|
Kernel::panic("Stack smashing detected");
|
2022-11-12 23:45:26 +02:00
|
|
|
abort();
|
2022-11-15 21:42:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
__END_DECLS
|