[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 10/23] hurd: Only init early static TLS if it's used to store
From: |
Sergey Bugaev |
Subject: |
[RFC PATCH 10/23] hurd: Only init early static TLS if it's used to store stack or pointer guards |
Date: |
Wed, 3 Jan 2024 20:14:43 +0300 |
This is the case on both x86 architectures, but not on AArch64.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
---
sysdeps/mach/hurd/init-first.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/sysdeps/mach/hurd/init-first.c b/sysdeps/mach/hurd/init-first.c
index 85261916..26ccd37e 100644
--- a/sysdeps/mach/hurd/init-first.c
+++ b/sysdeps/mach/hurd/init-first.c
@@ -38,7 +38,16 @@ extern int __libc_argc attribute_hidden;
extern char **__libc_argv attribute_hidden;
extern char **_dl_argv;
-#ifndef SHARED
+#if !defined (SHARED) && (defined (THREAD_SET_STACK_GUARD) || defined
(THREAD_SET_POINTER_GUARD))
+/* In the static case, we need to set up TLS early so that the stack
+ protection guard can be read at from TLS by the GCC-generated snippets,
+ on architectures that store the guard in TLS and not globally. */
+# define USE_INIT1_TCBHEAD 1
+#else
+# define USE_INIT1_TCBHEAD 0
+#endif
+
+#if USE_INIT1_TCBHEAD
static tcbhead_t __init1_tcbhead;
#endif
@@ -153,9 +162,7 @@ first_init (void)
/* Initialize data structures so we can do RPCs. */
__mach_init ();
-#ifndef SHARED
- /* In the static case, we need to set up TLS early so that the stack
- protection guard can be read at from TLS by the GCC-generated snippets.
*/
+#if USE_INIT1_TCBHEAD
_hurd_tls_init (&__init1_tcbhead, 0);
#endif
--
2.43.0
- Re: [PATCH 04/23] mach: Drop some unnecessary vm_param.h includes, (continued)
- [RFC PATCH 03/23] Allow glibc to be compiled without EXEC_PAGESIZE, Sergey Bugaev, 2024/01/03
- [RFC PATCH 08/23] hurd: Drop x86-specific assembly from init-first.c, Sergey Bugaev, 2024/01/03
- [RFC PATCH 07/23] hurd: Pass the data pointer to _hurd_stack_setup explicitly, Sergey Bugaev, 2024/01/03
- [PATCH 06/23] mach: Drop SNARF_ARGS macro, Sergey Bugaev, 2024/01/03
- [RFC PATCH 09/23] hurd: Make init-first.c no longer x86-specific, Sergey Bugaev, 2024/01/03
- [RFC PATCH 10/23] hurd: Only init early static TLS if it's used to store stack or pointer guards,
Sergey Bugaev <=
- [RFC PATCH 11/23] hurd: Initializy _dl_pagesize early in static builds, Sergey Bugaev, 2024/01/03
- [RFC PATCH 12/23] aarch64: Make cpu-features definitions not Linux-specific, Sergey Bugaev, 2024/01/03
- [RFC PATCH 13/23] aarch64: Add dl-procinfo, Sergey Bugaev, 2024/01/03
- [RFC PATCH 14/23] aarch64: Allow building without kernel support for BTI, Sergey Bugaev, 2024/01/03
- [RFC PATCH 15/23] mach: Add a basic AArch64 port, Sergey Bugaev, 2024/01/03
- [RFC PATCH 16/23] hurd: Add a basic AArch64 port, Sergey Bugaev, 2024/01/03
- [RFC PATCH 19/23] Add FPE_FLTIDO, Sergey Bugaev, 2024/01/03