From 99ee4d26dc07c3eadfbf6793db26ef9dfb1551e5 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 27 Aug 2017 22:26:49 +0200 Subject: hurd: Fix static initialization with -fstack-protector-strong 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). --- mach/Makefile | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'mach/Makefile') diff --git a/mach/Makefile b/mach/Makefile index 127cad00ca..b4f18b1525 100644 --- a/mach/Makefile +++ b/mach/Makefile @@ -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) # Translate GNU names for CPUs into the names used in Mach header files. mach-machine = $(patsubst powerpc,ppc,$(base-machine)) -- cgit 1.4.1