Blame SOURCES/gssproxy_ticket_147_0001-Add-PIE-and-RELRO-compiler-flags-for-hardening.patch

69b15c
From 0f33846367ea29d06c30a8b881675dfc2fb8892c Mon Sep 17 00:00:00 2001
69b15c
From: Roland Mainz <rmainz@redhat.com>
69b15c
Date: Thu, 7 May 2015 20:21:21 +0200
69b15c
Subject: [PATCH] Add PIE and RELRO compiler flags for hardening
69b15c
69b15c
Add PIE (=position independent code) and RELRO (=read-only jump
69b15c
tables and relocation addresses) compiler flags for hardening.
69b15c
69b15c
Fixes: https://fedorahosted.org/gss-proxy/ticket/147
69b15c
Signed-off-by: Roland Mainz <rmainz@redhat.com>
69b15c
Reviewed-by: Stephen Gallagher <sgallagh@redhat.com>
69b15c
Reviewed-by: Lukas Slebodnik <lslebodn@redhat.com>
69b15c
---
69b15c
 proxy/Makefile.am | 7 ++++++-
69b15c
 1 file changed, 6 insertions(+), 1 deletion(-)
69b15c
69b15c
diff --git a/proxy/Makefile.am b/proxy/Makefile.am
69b15c
index 821362502483f046c46209c16ef422d796c4b384..39674f6764da914f5d54d68672b6b1bcd4247f8f 100644
69b15c
--- a/proxy/Makefile.am
69b15c
+++ b/proxy/Makefile.am
69b15c
@@ -31,6 +31,10 @@ pkgconfigdir = $(libdir)/pkgconfig
69b15c
 gpstatedir = @gpstatedir@
69b15c
 gpclidir = @gpstatedir@/clients
69b15c
 
69b15c
+# Flags for hardening (separated out so we can override them for testing)
69b15c
+PIE_CFLAGS	= -fPIE
69b15c
+RELRO_CFLAGS	= -Wl,-z,relro,-z,now
69b15c
+
69b15c
 AM_CFLAGS =
69b15c
 if WANT_AUX_INFO
69b15c
     AM_CFLAGS += -aux-info $@.X
69b15c
@@ -41,7 +45,8 @@ if HAVE_GCC
69b15c
     AM_CFLAGS += -Wall -Wshadow -Wstrict-prototypes -Wpointer-arith \
69b15c
                  -Wcast-qual -Wcast-align -Wwrite-strings \
69b15c
                  -fstrict-aliasing -Wstrict-aliasing -Werror=strict-aliasing \
69b15c
-                 -Werror-implicit-function-declaration
69b15c
+                 -Werror-implicit-function-declaration \
69b15c
+                 $(PIE_CFLAGS) $(RELRO_CFLAGS)
69b15c
 endif
69b15c
 
69b15c
 dist_pkgconfig_DATA =
69b15c
-- 
69b15c
2.4.0
69b15c