Support for SSP in programs

This commit is contained in:
Baptiste Wicht 2016-07-23 18:06:38 +02:00
parent 09450f1455
commit 06e96d4ea9

23
tlib/src/ssp.cpp Normal file
View File

@ -0,0 +1,23 @@
//=======================================================================
// Copyright Baptiste Wicht 2013-2016.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//=======================================================================
#include <print.hpp>
#include <system.hpp>
extern "C" {
#define STACK_CHK_GUARD 0x595e9fbd94fda766
uintptr_t __stack_chk_guard = STACK_CHK_GUARD;
__attribute__((noreturn)) void __stack_chk_fail(){
printf("Stack smashing detected \n");
//TODO printf("pid=%u\n", scheduler::get_pid());
exit(1);
}
}