]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
hurd: Fix static initialization with -fstack-protector-strong
authorSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 27 Aug 2017 20:26:49 +0000 (22:26 +0200)
committerSamuel Thibault <samuel.thibault@ens-lyon.org>
Sun, 27 Aug 2017 20:29:43 +0000 (22:29 +0200)
When linked statically, TLS initialization is not achieved before
mach_init and alike, so ssp accesses to tcbhead's stack_guard would
crash.  We can just avoid using ssp in the few functions needed before
TLS is set up.

* mach/Makefile (CFLAGS-mach_init.o, CFLAGS-RPC_vm_statistics.o,
CFLAGS-RPC_vm_map.o, CFLAGS-RPC_vm_protect.o,
CFLAGS-RPC_i386_set_gdt.o, CFLAGS-RPC_i386_set_ldt.o,
CFLAGS-RPC_task_get_special_port.o): Add $(no-stack-protector).
* hurd/Makefile (CFLAGS-hurdstartup.o,
CFLAGS-RPC_exec_startup_get_info.o): Add $(no-stack-protector).

ChangeLog
hurd/Makefile
mach/Makefile

index 4d94fee93bc28cff8ed807e48d6efb3bf05f7421..a93769f3b5c927e0fe98d649a3e50f628cc6a439 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,12 @@
        stack_chk_fail_local.
        * mach/Versions (GLIBC_2.4): Add __stack_chk_fail.
        * hurd/Versions (GLIBC_2.4): Add __stack_chk_fail.
+       * mach/Makefile (CFLAGS-mach_init.o, CFLAGS-RPC_vm_statistics.o,
+       CFLAGS-RPC_vm_map.o, CFLAGS-RPC_vm_protect.o,
+       CFLAGS-RPC_i386_set_gdt.o, CFLAGS-RPC_i386_set_ldt.o,
+       CFLAGS-RPC_task_get_special_port.o): Add $(no-stack-protector).
+       * hurd/Makefile (CFLAGS-hurdstartup.o,
+       CFLAGS-RPC_exec_startup_get_info.o): Add $(no-stack-protector).
 
 2017-08-25  H.J. Lu  <hongjiu.lu@intel.com>
 
index 9205822b24c042b1a62592776b0081e98d084536..b44b9b80c690a6bedf844be5fbf1db15ea58193c 100644 (file)
@@ -81,6 +81,10 @@ $(inlines:%=$(objpfx)%.c): $(objpfx)%-inlines.c: %.h
         echo '#include "$<"') > $@-new
        mv -f $@-new $@
 generated += $(inlines:=.c)
+
+# Avoid ssp before TLS is initialized.
+CFLAGS-hurdstartup.o = $(no-stack-protector)
+CFLAGS-RPC_exec_startup_get_info.o = $(no-stack-protector)
 \f
 include ../mach/Machrules
 include ../Rules
index 127cad00ca0b84196bc1065d8730cf9877ff23d7..b4f18b15256bd2168823f6c015179b677b124651 100644 (file)
@@ -53,6 +53,15 @@ server-interfaces := mach/exc
 
 # Clear any environment        value.
 generated =
+
+# Avoid ssp before TLS is initialized.
+CFLAGS-mach_init.o = $(no-stack-protector)
+CFLAGS-RPC_vm_statistics.o = $(no-stack-protector)
+CFLAGS-RPC_vm_map.o = $(no-stack-protector)
+CFLAGS-RPC_vm_protect.o = $(no-stack-protector)
+CFLAGS-RPC_i386_set_gdt.o = $(no-stack-protector)
+CFLAGS-RPC_i386_set_ldt.o = $(no-stack-protector)
+CFLAGS-RPC_task_get_special_port.o = $(no-stack-protector)
 \f
 # Translate GNU names for CPUs into the names used in Mach header files.
 mach-machine = $(patsubst powerpc,ppc,$(base-machine))