From 06e96d4ea9c1fe98e5d04f30dd6b80c9cf7926ad Mon Sep 17 00:00:00 2001 From: Baptiste Wicht Date: Sat, 23 Jul 2016 18:06:38 +0200 Subject: [PATCH] Support for SSP in programs --- tlib/src/ssp.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tlib/src/ssp.cpp diff --git a/tlib/src/ssp.cpp b/tlib/src/ssp.cpp new file mode 100644 index 00000000..db1a8d63 --- /dev/null +++ b/tlib/src/ssp.cpp @@ -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 +#include + +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); +} + +}