fa3bfd
Comprehensive stack protector support was added to upstream glibc with
fa3bfd
this commit:
fa3bfd
fa3bfd
commit cecbc7967f0bcac718b6f8f8942b58403c0e917c
fa3bfd
Author: Nick Alcock <nick.alcock@oracle.com>
fa3bfd
Date:   Mon Dec 26 10:09:10 2016 +0100
fa3bfd
fa3bfd
    Enable -fstack-protector=* when requested by configure [BZ #7065]
fa3bfd
fa3bfd
It is a superset of the functionality in this patch.
fa3bfd
12745e
diff -urN glibc-2.17-c758a686/config.make.in glibc-2.17-c758a686/config.make.in
2e9afc
--- glibc-2.17-c758a686/config.make.in	2014-02-27 10:33:11.466763885 -0500
12745e
+++ glibc-2.17-c758a686/config.make.in	2014-02-27 10:36:44.481320149 -0500
2e9afc
@@ -62,6 +62,7 @@
2e9afc
 have-as-vis3 = @libc_cv_sparc_as_vis3@
2e9afc
 gnu89-inline-CFLAGS = @gnu89_inline@
2e9afc
 have-ssp = @libc_cv_ssp@
2e9afc
+have-ssp-strong = @libc_cv_ssp_strong@
2e9afc
 have-selinux = @have_selinux@
2e9afc
 have-libaudit = @have_libaudit@
2e9afc
 have-libcap = @have_libcap@
12745e
diff -urN glibc-2.17-c758a686/configure glibc-2.17-c758a686/configure
2e9afc
--- glibc-2.17-c758a686/configure	2014-02-27 10:33:11.561763687 -0500
12745e
+++ glibc-2.17-c758a686/configure	2014-02-27 10:32:28.885852593 -0500
2e9afc
@@ -610,6 +610,7 @@
2e9afc
 libc_cv_cc_submachine
2e9afc
 exceptions
2e9afc
 gnu89_inline
2e9afc
+libc_cv_ssp_strong
2e9afc
 libc_cv_ssp
2e9afc
 fno_unit_at_a_time
2e9afc
 libc_cv_output_format
2e9afc
@@ -6758,6 +6759,27 @@
2e9afc
 $as_echo "$libc_cv_ssp" >&6; }
2e9afc
 
2e9afc
 
2e9afc
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fstack-protector-strong" >&5
2e9afc
+$as_echo_n "checking for -fstack-protector-strong... " >&6; }
2e9afc
+if ${libc_cv_ssp_strong+:} false; then :
2e9afc
+  $as_echo_n "(cached) " >&6
2e9afc
+else
2e9afc
+  if { ac_try='${CC-cc} $CFLAGS $CPPFLAGS -Werror -fstack-protector-strong -xc /dev/null -S -o /dev/null'
2e9afc
+  { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
2e9afc
+  (eval $ac_try) 2>&5
2e9afc
+  ac_status=$?
2e9afc
+  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
2e9afc
+  test $ac_status = 0; }; }; then :
2e9afc
+  libc_cv_ssp_strong=yes
2e9afc
+else
2e9afc
+  libc_cv_ssp_strong=no
2e9afc
+fi
2e9afc
+
2e9afc
+fi
2e9afc
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libc_cv_ssp_strong" >&5
2e9afc
+$as_echo "$libc_cv_ssp_strong" >&6; }
2e9afc
+
2e9afc
+
2e9afc
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -fgnu89-inline" >&5
2e9afc
 $as_echo_n "checking for -fgnu89-inline... " >&6; }
2e9afc
 if ${libc_cv_gnu89_inline+:} false; then :
12745e
diff -urN glibc-2.17-c758a686/configure.in glibc-2.17-c758a686/configure.in
2e9afc
--- glibc-2.17-c758a686/configure.in	2014-02-27 10:33:11.469763878 -0500
12745e
+++ glibc-2.17-c758a686/configure.in	2014-02-27 10:32:09.171893663 -0500
2e9afc
@@ -1682,6 +1682,13 @@
2e9afc
 ])
2e9afc
 AC_SUBST(libc_cv_ssp)
2e9afc
 
2e9afc
+AC_CACHE_CHECK(for -fstack-protector-strong, libc_cv_ssp_strong, [dnl
2e9afc
+LIBC_TRY_CC_OPTION([$CFLAGS $CPPFLAGS -Werror -fstack-protector-strong],
2e9afc
+		   [libc_cv_ssp_strong=yes],
2e9afc
+		   [libc_cv_ssp_strong=no])
2e9afc
+])
2e9afc
+AC_SUBST(libc_cv_ssp_strong)
2e9afc
+
2e9afc
 AC_CACHE_CHECK(for -fgnu89-inline, libc_cv_gnu89_inline, [dnl
2e9afc
 cat > conftest.c <
2e9afc
 int foo;
12745e
diff -urN glibc-2.17-c758a686/login/Makefile glibc-2.17-c758a686/login/Makefile
2e9afc
--- glibc-2.17-c758a686/login/Makefile	2014-02-27 10:33:11.325764178 -0500
12745e
+++ glibc-2.17-c758a686/login/Makefile	2014-02-27 10:35:30.785473661 -0500
2e9afc
@@ -60,6 +60,9 @@
2e9afc
 ifeq (yes,$(have-ssp))
2e9afc
 pt_chown-cflags += -fstack-protector
2e9afc
 endif
2e9afc
+ifeq (yes,$(have-ssp-strong))
2e9afc
+pt_chown-cflags += -fstack-protector-strong
2e9afc
+endif
2e9afc
 ifeq (yes,$(have-libcap))
2e9afc
 libcap = -lcap
2e9afc
 endif
12745e
diff -urN glibc-2.17-c758a686/nscd/Makefile glibc-2.17-c758a686/nscd/Makefile
2e9afc
--- glibc-2.17-c758a686/nscd/Makefile	2012-12-24 22:02:13.000000000 -0500
12745e
+++ glibc-2.17-c758a686/nscd/Makefile	2014-02-27 10:36:00.017412769 -0500
2e9afc
@@ -87,6 +87,9 @@
2e9afc
 ifeq (yes,$(have-ssp))
2e9afc
 CFLAGS-nonlib += -fstack-protector
2e9afc
 endif
2e9afc
+ifeq (yes,$(have-ssp-strong))
2e9afc
+CFLAGS-nonlib += -fstack-protector-strong
2e9afc
+endif
2e9afc
 
2e9afc
 ifeq (yesyes,$(have-fpie)$(build-shared))
2e9afc
 LDFLAGS-nscd = -Wl,-z,now
12745e
diff -urN glibc-2.17-c758a686/resolv/Makefile glibc-2.17-c758a686/resolv/Makefile
2e9afc
--- glibc-2.17-c758a686/resolv/Makefile	2012-12-24 22:02:13.000000000 -0500
12745e
+++ glibc-2.17-c758a686/resolv/Makefile	2014-02-27 10:36:29.449351461 -0500
2e9afc
@@ -79,6 +79,10 @@
2e9afc
 ifeq (yes,$(have-ssp))
2e9afc
 CFLAGS-libresolv += -fstack-protector
2e9afc
 endif
2e9afc
+ifeq (yes,$(have-ssp-strong))
2e9afc
+CFLAGS-libresolv += -fstack-protector-strong
2e9afc
+endif
2e9afc
+
2e9afc
 CFLAGS-res_hconf.c = -fexceptions
2e9afc
 
2e9afc
 # The BIND code elicits some harmless warnings.