aboutsummaryrefslogtreecommitdiffstats
path: root/main/libc0.9.32/0001-Compatible-stack-protector-for-non-Thread-Local-stor.patch
blob: eb60a50a94cdd1eb78bbf2bf5c8766439da248ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
From d0d708fffcc475973736aea3759f4d7944a4629a Mon Sep 17 00:00:00 2001
From: Natanael Copa <ncopa@alpinelinux.org>
Date: Fri, 23 Dec 2011 14:06:09 +0100
Subject: [PATCH 1/8] Compatible stack protector for non Thread Local storage

Before we had thread local storage the __stack_chk_guard was a global
variable that was referenced to by the older binaries.

We since then have changed ABI so this patch can probably go away.
---
 ldso/ldso/ldso.c                    |    7 +------
 libc/misc/internals/__uClibc_main.c |    8 +-------
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/ldso/ldso/ldso.c b/ldso/ldso/ldso.c
index 014bbf5..7690036 100644
--- a/ldso/ldso/ldso.c
+++ b/ldso/ldso/ldso.c
@@ -121,11 +121,7 @@ extern void _start(void);
 #ifdef __UCLIBC_HAS_SSP__
 # include <dl-osinfo.h>
 static uintptr_t stack_chk_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;
-# endif
 # ifdef __UCLIBC_HAS_SSP_COMPAT__
 uintptr_t __guard attribute_relro;
 # endif
@@ -1189,9 +1185,8 @@ of this helper program; chances are you did not intend to run this program.\n\
 	stack_chk_guard = _dl_setup_stack_chk_guard ();
 # ifdef THREAD_SET_STACK_GUARD
 	THREAD_SET_STACK_GUARD (stack_chk_guard);
-# else
-	__stack_chk_guard = stack_chk_guard;
 # endif
+	__stack_chk_guard = stack_chk_guard;
 # ifdef __UCLIBC_HAS_SSP_COMPAT__
 	__guard = stack_chk_guard;
 # endif
diff --git a/libc/misc/internals/__uClibc_main.c b/libc/misc/internals/__uClibc_main.c
index 71fdbd8..3a24acd 100644
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -46,12 +46,7 @@ void *__libc_stack_end = NULL;
 # ifdef __UCLIBC_HAS_SSP__
 #  include <dl-osinfo.h>
 static uintptr_t stack_chk_guard;
-#  ifndef THREAD_SET_STACK_GUARD
-/* Only exported for architectures that don't store the stack guard canary
- * in thread local area. */
-/* for gcc-4.1 non-TLS */
 uintptr_t __stack_chk_guard attribute_relro;
-#  endif
 /* for gcc-3.x + Etoh ssp */
 #  ifdef __UCLIBC_HAS_SSP_COMPAT__
 uintptr_t __guard attribute_relro;
@@ -251,9 +246,8 @@ void __uClibc_init(void)
     stack_chk_guard = _dl_setup_stack_chk_guard();
 #  ifdef THREAD_SET_STACK_GUARD
     THREAD_SET_STACK_GUARD (stack_chk_guard);
-#  else
-    __stack_chk_guard = stack_chk_guard;
 #  endif
+    __stack_chk_guard = stack_chk_guard;
 #  ifdef __UCLIBC_HAS_SSP_COMPAT__
     __guard = stack_chk_guard;
 #  endif
-- 
1.7.8.4