diff options
Diffstat (limited to 'userspace/sys')
| -rw-r--r-- | userspace/sys/sys.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/userspace/sys/sys.c b/userspace/sys/sys.c index ef0d1df..1ab3579 100644 --- a/userspace/sys/sys.c +++ b/userspace/sys/sys.c @@ -3,6 +3,30 @@ #include <sys/stat.h> +// CODE FOR Stack Smashing Protector, TODO: MOVE / and do not duplicate +// with kernel.c +// http://wiki.osdev.org/Stack_Smashing_Protector +#include <stdint.h> +#include <stdlib.h> + +#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) +{ + write(1,"stack smashing!\n",16); + exit(99); +} + + +/////////////////// + // required by binutils! long sysconf(int name) |
