From 60872cf9c93687e771c1b8bc41bb006bdcdc2e45 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Tue, 24 Apr 2012 18:07:59 -0400 Subject: first attempt at enabling stack protector support the code is written to pre-init the thread pointer in static linked programs that pull in __stack_chk_fail or dynamic-linked programs that lookup the symbol. no explicit canary is set; the canary will be whatever happens to be in the thread structure at the offset gcc hard-coded. this can be improved later. --- src/env/__stack_chk_fail.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/env/__stack_chk_fail.c (limited to 'src/env/__stack_chk_fail.c') diff --git a/src/env/__stack_chk_fail.c b/src/env/__stack_chk_fail.c new file mode 100644 index 00000000..bbba3511 --- /dev/null +++ b/src/env/__stack_chk_fail.c @@ -0,0 +1,14 @@ +#include "pthread_impl.h" +#include "atomic.h" + +void __init_ssp(void) +{ +#ifndef __PIC__ + __pthread_self_init(); +#endif +} + +void __stack_chk_fail(void) +{ + a_crash(); +} -- cgit v1.2.1