thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
9ae3a8
From 3938c85004bbd742c5a8c7e1480ed14c2420cd9d Mon Sep 17 00:00:00 2001
9ae3a8
From: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
Date: Tue, 26 Aug 2014 13:33:14 +0200
9ae3a8
Subject: [PATCH 1/6] Enforce stack protector usage
9ae3a8
9ae3a8
Message-id: <1409059994-2966-1-git-send-email-mrezanin@redhat.com>
9ae3a8
Patchwork-id: 60699
9ae3a8
O-Subject: [RHEL-7.1 qemu-kvm PATCH] Enforce stack protector usage
9ae3a8
Bugzilla: 1064260
9ae3a8
RH-Acked-by: Amos Kong <akong@redhat.com>
9ae3a8
RH-Acked-by: Jeff Nelson <jenelson@redhat.com>
9ae3a8
RH-Acked-by: Fam Zheng <famz@redhat.com>
9ae3a8
9ae3a8
From: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
9ae3a8
If --enable-stack-protector is used is used, configure script try to use
9ae3a8
--fstack-protector-strong. In case it's not supported, --fstack-protector-all
9ae3a8
is enabled. If both protectors are not supported, configure does not use
9ae3a8
any protector at all without any notification.
9ae3a8
9ae3a8
This patch reports error when user requests stack protector to be used and
9ae3a8
both protector modes are not supported. Behavior is not changed in case
9ae3a8
user do not use any of --enable-stack-protector/--disable-stack-protector.
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
[Fix non-POSIX operator in test. - Paolo]
9ae3a8
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
9ae3a8
9ae3a8
(cherry picked from commit 3b463a3fa8f7690ffa3ef273993dff349b3a73d3)
9ae3a8
9ae3a8
Conflicts:
9ae3a8
	configure - upstream use -fstack-protector-all as second option
9ae3a8
                we used -fstack-protector.
9ae3a8
                Updated to upstream behavior
9ae3a8
9ae3a8
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
9ae3a8
---
9ae3a8
 configure |    9 ++++++++-
9ae3a8
 1 files changed, 8 insertions(+), 1 deletions(-)
9ae3a8
9ae3a8
diff --git a/configure b/configure
9ae3a8
index 4552e08..0c666e5 100755
9ae3a8
--- a/configure
9ae3a8
+++ b/configure
9ae3a8
@@ -1303,14 +1303,21 @@ for flag in $gcc_flags; do
9ae3a8
 done
9ae3a8
 
9ae3a8
 if test "$stack_protector" != "no" ; then
9ae3a8
-  gcc_flags="-fstack-protector-strong -fstack-protector"
9ae3a8
+  gcc_flags="-fstack-protector-strong -fstack-protector-all"
9ae3a8
+  sp_on=0
9ae3a8
   for flag in $gcc_flags; do
9ae3a8
     if compile_prog "-Werror $flag" "" ; then
9ae3a8
       QEMU_CFLAGS="$QEMU_CFLAGS $flag"
9ae3a8
       LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,$flag"
9ae3a8
+      sp_on=1
9ae3a8
       break
9ae3a8
     fi
9ae3a8
   done
9ae3a8
+  if test "$stack_protector" = yes; then
9ae3a8
+    if test $sp_on = 0; then
9ae3a8
+      error_exit "Stack protector not supported"
9ae3a8
+    fi
9ae3a8
+  fi
9ae3a8
 fi
9ae3a8
 
9ae3a8
 # Workaround for http://gcc.gnu.org/PR55489.  Happens with -fPIE/-fPIC and
9ae3a8
-- 
9ae3a8
1.7.1
9ae3a8