Skip to contentSkip to conversation

Disable SSP in monitor

PATCH In review Anthony Liguori 2 participants 2 messages Feb 6, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Disable SSP in monitor

Disable GCC's stack protector. Works with older GCC's by using Linux's cc-option function.

Thanks again for GPL'ing KQEMU :-)

Regards,

Anthony Liguori

common/Makefile +11 -0
@@ -21,6 +21,12 @@
 #ARCH=i386
 #ARCH=x86_64
 
+# From the Linux kernel
+# cc-option
+# Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
+cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
+              /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
+
 HOST_CC=gcc
 MON_CC=gcc
 MON_LD=ld
@@ -44,6 +50,11 @@
 CFLAGS=$(COMMON_CFLAGS)
 MON_CFLAGS=$(COMMON_CFLAGS)
 KERNEL_CFLAGS=$(COMMON_CFLAGS)
+
+# Disable SSP if GCC supports it.
+MON_CFLAGS+=$(call cc-option,$(CC),-fno-stack-protector,)
+MON_CFLAGS+=$(call cc-option,$(CC),-fno-stack-protector-all,)
+
 ifeq ($(ARCH), x86_64)
 KERNEL_CFLAGS+=-mcmodel=kernel
 MON_CFLAGS+= -fpic # needed for correct computed goto relocations
#1 lore raw

Hi Fabrice,

Quoted 1 line · Anthony Liguori

Thanks again for GPL'ing KQEMU :-)

I hadn't realised this had happened. Many thanks from me too, Fabrice!

Cheers, Chris.

Signature · 4 lines
_____ __     _
\  __/ / ,__(_)_  | Chris Wilson <0000 at qwirx.com> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer |
\ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |