git-stack-protect-static
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Fri, 26 Jan 2018 22:35:29 +0000 (22:35 +0000)
committerAurelien Jarno <aurel32@debian.org>
Fri, 26 Jan 2018 22:35:29 +0000 (22:35 +0000)
commit 99ee4d26dc07c3eadfbf6793db26ef9dfb1551e5
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date:   Sun Aug 27 22:26:49 2017 +0200

    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).

Gbp-Pq: Topic hurd-i386
Gbp-Pq: Name git-stack-protect-static.diff

hurd/Makefile
mach/Makefile

index a60ecf346dc225636caf10fc60dd7a7ec6111aab..15f7b14a6459d6c75273dd3faf28637198af3fcf 100644 (file)
@@ -84,6 +84,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 88c08ad377d5fc8474d9c2eeefe44aefcc742ca6..958fc7a4c91c17c36c067285f07c49d91c35eb39 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))