|
|
9ae3a8 |
From d43267efbe5634bfe9c8ca9cccd3d3d0a36759ae Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
Date: Wed, 5 Feb 2014 15:02:19 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 09/28] configure: add option to disable -fstack-protect
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
Message-id: <fbd17542d86a4fd4beb4d9c672df14f237b51a62.1391612088.git.mrezanin@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 57118
|
|
|
9ae3a8 |
O-Subject: [RHEL7 qemu-kvm PATCH 1/2] configure: add option to disable -fstack-protect
|
|
|
9ae3a8 |
Bugzilla: 1044182
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Markus Armbruster <armbru@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
upstream: submitted
|
|
|
9ae3a8 |
(Do not wait for apply to get to RHEL 7.0 before Snapshot 8)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
The -fstack-protector flag family is useful for ensuring safety and for
|
|
|
9ae3a8 |
debugging, but has a performance impact. Here are some boot time comparisons
|
|
|
9ae3a8 |
of the various versions of -fstack-protector using qemu-system-arm on an
|
|
|
9ae3a8 |
x86_64 host:
|
|
|
9ae3a8 |
# -fstack-protector-all
|
|
|
9ae3a8 |
Startup finished in 1.810s (kernel) + 12.331s (initrd) + 49.016s
|
|
|
9ae3a8 |
(userspace) = 1min 3.159s
|
|
|
9ae3a8 |
Startup finished in 1.801s (kernel) + 12.287s (initrd) + 47.925s
|
|
|
9ae3a8 |
(userspace) = 1min 2.013s
|
|
|
9ae3a8 |
Startup finished in 1.812s (kernel) + 12.302s (initrd) + 47.995s
|
|
|
9ae3a8 |
(userspace) = 1min 2.111s
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
# -fstack-protector-strong
|
|
|
9ae3a8 |
Startup finished in 1.744s (kernel) + 11.223s (initrd) + 44.688s
|
|
|
9ae3a8 |
(userspace) = 57.657s
|
|
|
9ae3a8 |
Startup finished in 1.721s (kernel) + 11.222s (initrd) + 44.194s
|
|
|
9ae3a8 |
(userspace) = 57.138s
|
|
|
9ae3a8 |
Startup finished in 1.693s (kernel) + 11.250s (initrd) + 44.426s
|
|
|
9ae3a8 |
(userspace) = 57.370s
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
# -fstack-protector
|
|
|
9ae3a8 |
Startup finished in 1.705s (kernel) + 11.409s (initrd) + 43.563s
|
|
|
9ae3a8 |
(userspace) = 56.677s
|
|
|
9ae3a8 |
Startup finished in 1.877s (kernel) + 11.137s (initrd) + 43.719s
|
|
|
9ae3a8 |
(userspace) = 56.734s
|
|
|
9ae3a8 |
Startup finished in 1.708s (kernel) + 11.141s (initrd) + 43.628s
|
|
|
9ae3a8 |
(userspace) = 56.478s
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
# no stack protector
|
|
|
9ae3a8 |
Startup finished in 1.743s (kernel) + 11.190s (initrd) + 43.709s
|
|
|
9ae3a8 |
(userspace) = 56.643s
|
|
|
9ae3a8 |
Startup finished in 1.763s (kernel) + 11.216s (initrd) + 43.767s
|
|
|
9ae3a8 |
(userspace) = 56.747s
|
|
|
9ae3a8 |
Startup finished in 1.711s (kernel) + 11.283s (initrd) + 43.878s
|
|
|
9ae3a8 |
(userspace) = 56.873s
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
This patch introduces a configure option to disable the stack protector
|
|
|
9ae3a8 |
entirely, and conditional stack protector flag selection (in order, based on
|
|
|
9ae3a8 |
availability): -fstack-protector-strong, -fstack-protector, no stack protector.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Steven Noonan <address@hidden>
|
|
|
9ae3a8 |
Cc: Anthony Liguori <address@hidden>
|
|
|
9ae3a8 |
Reviewed-by: Stefan Weil <address@hidden>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
configure | 18 +++++++++++++++---
|
|
|
9ae3a8 |
1 file changed, 15 insertions(+), 3 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
configure | 18 +++++++++++++++---
|
|
|
9ae3a8 |
1 files changed, 15 insertions(+), 3 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/configure b/configure
|
|
|
9ae3a8 |
index b892b88..3f68220 100755
|
|
|
9ae3a8 |
--- a/configure
|
|
|
9ae3a8 |
+++ b/configure
|
|
|
9ae3a8 |
@@ -134,6 +134,7 @@ audio_win_int=""
|
|
|
9ae3a8 |
cc_i386=i386-pc-linux-gnu-gcc
|
|
|
9ae3a8 |
libs_qga=""
|
|
|
9ae3a8 |
debug_info="yes"
|
|
|
9ae3a8 |
+stack_protector=""
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
# Don't accept a target_list environment variable.
|
|
|
9ae3a8 |
unset target_list
|
|
|
9ae3a8 |
@@ -839,6 +840,10 @@ for opt do
|
|
|
9ae3a8 |
;;
|
|
|
9ae3a8 |
--disable-werror) werror="no"
|
|
|
9ae3a8 |
;;
|
|
|
9ae3a8 |
+ --enable-stack-protector) stack_protector="yes"
|
|
|
9ae3a8 |
+ ;;
|
|
|
9ae3a8 |
+ --disable-stack-protector) stack_protector="no"
|
|
|
9ae3a8 |
+ ;;
|
|
|
9ae3a8 |
--disable-curses) curses="no"
|
|
|
9ae3a8 |
;;
|
|
|
9ae3a8 |
--enable-curses) curses="yes"
|
|
|
9ae3a8 |
@@ -1115,6 +1120,7 @@ echo " --enable-sparse enable sparse checker"
|
|
|
9ae3a8 |
echo " --disable-sparse disable sparse checker (default)"
|
|
|
9ae3a8 |
echo " --disable-strip disable stripping binaries"
|
|
|
9ae3a8 |
echo " --disable-werror disable compilation abort on warning"
|
|
|
9ae3a8 |
+echo " --disable-stack-protector disable compiler-provided stack protection"
|
|
|
9ae3a8 |
echo " --disable-sdl disable SDL"
|
|
|
9ae3a8 |
echo " --enable-sdl enable SDL"
|
|
|
9ae3a8 |
echo " --disable-gtk disable gtk UI"
|
|
|
9ae3a8 |
@@ -1296,9 +1302,15 @@ for flag in $gcc_flags; do
|
|
|
9ae3a8 |
fi
|
|
|
9ae3a8 |
done
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
-if compile_prog "-Werror -fstack-protector-all" "" ; then
|
|
|
9ae3a8 |
- QEMU_CFLAGS="$QEMU_CFLAGS -fstack-protector-all"
|
|
|
9ae3a8 |
- LIBTOOLFLAGS="$LIBTOOLFLAGS -Wc,-fstack-protector-all"
|
|
|
9ae3a8 |
+if test "$stack_protector" != "no" ; then
|
|
|
9ae3a8 |
+ gcc_flags="-fstack-protector-strong -fstack-protector"
|
|
|
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 |
+ break
|
|
|
9ae3a8 |
+ fi
|
|
|
9ae3a8 |
+ done
|
|
|
9ae3a8 |
fi
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
# Workaround for http://gcc.gnu.org/PR55489. Happens with -fPIE/-fPIC and
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|