diff mbox

[14/15] Add -fstack-protector-all to CFLAGS

Message ID 1262403933-26881-14-git-send-email-kirill@shutemov.name
State New
Headers show

Commit Message

Kirill A . Shutemov Jan. 2, 2010, 3:45 a.m. UTC
-fstack-protector-all emit extra code to check for buffer overflows,
such as stack smashing attacks.  This is done by adding a guard
variable to functions with vulnerable objects.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
---
 configure |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
diff mbox

Patch

diff --git a/configure b/configure
index 0cdcdb3..ec4175a 100755
--- a/configure
+++ b/configure
@@ -123,6 +123,14 @@  else
     exit 1
 fi
 
+# check -fstack-protector-all
+cat > $TMPC << EOF
+int foo(void) {char X[2]; return 3;}
+EOF
+if compile_object "$QEMU_CFLAGS" -fstack-protector-all; then
+    QEMU_CFLAGS="-fstack-protector-all $QEMU_CFLAGS"
+fi
+
 check_define() {
 cat > $TMPC <<EOF
 #if !defined($1)