summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--extra/Configs/Config.in18
-rw-r--r--ldso/ldso/ldso.c10
-rw-r--r--libc/misc/internals/__uClibc_main.c13
3 files changed, 33 insertions, 8 deletions
diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
index 1a34cf750..742424f2d 100644
--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -1304,11 +1304,21 @@ config UCLIBC_HAS_SSP
default n
help
Add propolice smashing stack protector to the library.
- This requires a patched version of GCC or GCC 4.1, supporting the
+ This requires GCC 4.1, supporting the -fstack-protector[-all]
+ options. GCC does not have to provide libssp, the needed
+ functions are added to ldso/libc instead.
+ Most people will answer N.
+
+config UCLIBC_HAS_SSP_COMPAT
+ bool "Support for gcc-3.x propolice smashing stack protector"
+ depends on UCLIBC_HAS_SSP
+ default n
+ help
+ Add gcc-3.x propolice smashing stack protector to the library.
+ This requires a patched version of GCC, supporting the
-fstack-protector[-all] options, with the __guard and
- __stack_smash_handler, respectively __stack_chk_guard and
- __stack_chk_fail functions removed from libgcc.
- These functions are added to libc instead.
+ __stack_smash_handler functions removed from libgcc.
+ These functions are added to ldso/libc instead.
More information at:
<http://www.research.ibm.com/trl/projects/security/ssp/>
Most people will answer N.
diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index 050569573..eebd26ebe 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -89,11 +89,16 @@ extern void _start(void);
#ifdef __UCLIBC_HAS_SSP__
#include <dl-osinfo.h>
uintptr_t stack_chk_guard;
-#ifndef THREAD_SET_STACK_GUARD
+# ifndef THREAD_SET_STACK_GUARD
/* Only exported for architectures that don't store the stack guard canary
* in local thread area. */
uintptr_t __stack_chk_guard attribute_relro;
+# ifdef __UCLIBC_HAS_SSP_COMPAT__
strong_alias(__stack_chk_guard,__guard)
+# endif
+# elif __UCLIBC_HAS_SSP_COMPAT__
+uintptr_t __guard attribute_relro;
+# endif
#endif
#endif
@@ -268,6 +273,9 @@ void _dl_get_ready_to_run(struct elf_resolve *tpnt, unsigned long load_addr,
stack_chk_guard = _dl_setup_stack_chk_guard ();
# ifdef THREAD_SET_STACK_GUARD
THREAD_SET_STACK_GUARD (stack_chk_guard);
+# ifdef __UCLIBC_HAS_SSP_COMPAT__
+ __guard = stack_chk_guard;
+# endif
# else
__stack_chk_guard = stack_chk_guard;
# endif
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
index c50244494..a63345d68 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -61,11 +61,15 @@ uintptr_t stack_chk_guard;
/* for gcc-4.1 non-TLS */
uintptr_t __stack_chk_guard attribute_relro;
/* for gcc-3.x + Etoh ssp */
-# ifdef __HAVE_SHARED__
+# ifdef __UCLIBC_HAS_SSP_COMPAT__
+# ifdef __HAVE_SHARED__
strong_alias(__stack_chk_guard,__guard)
-# else
+# else
uintptr_t __guard attribute_relro;
+# endif
# endif
+# elif defined __UCLIBC_HAS_SSP_COMPAT__
+uintptr_t __guard attribute_relro;
# endif
# endif
@@ -210,9 +214,12 @@ void __uClibc_init(void)
stack_chk_guard = _dl_setup_stack_chk_guard();
# ifdef THREAD_SET_STACK_GUARD
THREAD_SET_STACK_GUARD (stack_chk_guard);
+# ifdef __UCLIBC_HAS_SSP_COMPAT__
+ __guard = stack_chk_guard;
+# endif
# else
__stack_chk_guard = stack_chk_guard;
-# ifndef __HAVE_SHARED__
+# if !defined __HAVE_SHARED__ && defined __UCLIBC_HAS_SSP_COMPAT__
__guard = stack_chk_guard;
# endif
# endif