summaryrefslogtreecommitdiff
path: root/kernel/smashing.c
blob: d4365b901e7c3e9ba5eca6182832333e6c19bcd4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "kernel/kernel.h"
#include "log.h"
#include <stdint.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

uintptr_t __stack_chk_guard = STACK_CHK_GUARD;
 
__attribute__((noreturn))
void __stack_chk_fail(void)
{
	kpanic("Stack smashing detected");
}
//