]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Compile the dynamic linker without stack protection [BZ #7065]
authorNick Alcock <nick.alcock@oracle.com>
Mon, 26 Dec 2016 09:08:48 +0000 (10:08 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Mon, 26 Dec 2016 09:08:48 +0000 (10:08 +0100)
Also compile corresponding routines in the static libc.a with the same
flag.

ChangeLog
elf/Makefile
elf/rtld-Rules
sysdeps/i386/Makefile

index 64ccdf7ca098449c20047b53d964f2afc61fafb7..82fc4e29d33185044ab896df128b911105069274 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2016-12-26  Nick Alcock  <nick.alcock@oracle.com>
+
+       [BZ #7065]
+       Compile the dynamic linker without stack protection.
+       * elf/Makefile (elide-stack-protector): New.
+       (CFLAGS-.os): Use it, eliding $(all-rtld-routines).
+       (CFLAGS-.o, CFLAGS-.op): Likewise, but for $(elide-routines.os).
+       * elf/rtld-Rules (rtld-CFLAGS): Add $(no-stack-protector).
+       * sysdeps/i386/Makefile (rtld-CFLAGS): Use +=, not =.
+
 2016-12-26  Nick Alcock  <nick.alcock@oracle.com>
 
        [BZ #7065]
index cd26e1655852eebe82816a4dfb073877d380c424..1e7d7240efaa6f5a89e5679ec8c94aab5048fbba 100644 (file)
@@ -51,6 +51,18 @@ CFLAGS-dl-runtime.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-dl-lookup.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-dl-iterate-phdr.c = $(uses-callbacks)
 
+# Compile rtld itself without stack protection.
+# Also compile all routines in the static library that are elided from
+# the shared libc because they are in libc.a in the same way.
+
+define elide-stack-protector
+$(if $(filter $(@F),$(patsubst %,%$(1),$(2))), $(no-stack-protector))
+endef
+
+CFLAGS-.o += $(call elide-stack-protector,.o,$(elide-routines.os))
+CFLAGS-.op += $(call elide-stack-protector,.op,$(elide-routines.os))
+CFLAGS-.os += $(call elide-stack-protector,.os,$(all-rtld-routines))
+
 ifeq ($(unwind-find-fde),yes)
 routines += unwind-dw2-fde-glibc
 shared-only-routines += unwind-dw2-fde-glibc
index c1bb50687e4b662a5b4ddab641629122ec76597a..84d9387746aa652f2d217c973023a902a2a66fe0 100644 (file)
@@ -144,4 +144,6 @@ cpp-srcs-left := $(rtld-modules:%.os=%)
 lib := rtld
 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
 
+rtld-CFLAGS += $(no-stack-protector)
+
 endif
index e94f2cbd66333ded002b06002738f2e2995f7e1a..e30e1339f0554dd53be1ab881cb4df04de820792 100644 (file)
@@ -88,7 +88,7 @@ endif
 # the first 3 mm/xmm/ymm/zmm registers are used to pass vector parameters
 # which must be preserved.
 # With SSE disabled, ensure -fpmath is not set to use sse either.
-rtld-CFLAGS = -mno-sse -mno-mmx -mfpmath=387
+rtld-CFLAGS += -mno-sse -mno-mmx -mfpmath=387
 ifeq ($(subdir),elf)
 CFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),\
                   $(rtld-CFLAGS))