qemu: explicitly disable SSP support
PATCH 1/1 qemu: explicitly disable SSP support
Even though the QEMU configure script does a full compile and link test to detect SSP support, it does so by using the compiler option -fstack-protector-strong (and then -fstack-protector-all if that fails).
The problem with this method is that the test program passes the check with -fstack-protector-strong even when SSP support is not available in the toolchain, since that option restricts stack protection to only a subset of all the functions in a program and (in the case of the test program) no "canary" code gets inserted, producing a false-positive. This causes a subsequent failure when the probe for pthreads is performed.
To avoid patching the configure script, fix that by simply disabling the use of stack protector when SSP is known to be unavailable in the toolchain.
Fixes:
http://autobuild.buildroot.net/results/efb/efbb4e940543894b8745bb405478a096c90a5ae2/
http://autobuild.buildroot.net/results/32d/32d6d984febad2dee1f0d31c5fa0aea823297096/
http://autobuild.buildroot.net/results/aa6/aa6e71c957fb6f07e7bded35a8e47be4dadd042c/
...and many others.
--- package/qemu/qemu.mk | 6 ++++++ 1 file changed, 6 insertions(+)
package/qemu/qemu.mk +6 -0
@@ -133,6 +133,12 @@ QEMU_VARS = \ PYTHON=$(HOST_DIR)/usr/bin/python2 \ PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages +# Force disable stack protector when SSP isn't available in toolchain as +# QEMU configure script fails to properly detect that. +ifeq ($(BR2_TOOLCHAIN_HAS_SSP),) +QEMU_OPTS += --disable-stack-protector +endif + # If we want to specify only a subset of targets, we must still enable all # of them, so that QEMU properly builds its list of default targets, from # which it then checks if the specified sub-set is valid. That's what we
Signature · 1 line
2.1.4
PATCH 1/1 qemu: explicitly disable SSP support
Hi Rodrigo,
Quoted 33 lines · Rodrigo Rebello
Even though the QEMU configure script does a full compile and link test to detect SSP support, it does so by using the compiler option -fstack-protector-strong (and then -fstack-protector-all if that fails).
The problem with this method is that the test program passes the check with -fstack-protector-strong even when SSP support is not available in the toolchain, since that option restricts stack protection to only a subset of all the functions in a program and (in the case of the test program) no "canary" code gets inserted, producing a false-positive. This causes a subsequent failure when the probe for pthreads is performed.
To avoid patching the configure script, fix that by simply disabling the use of stack protector when SSP is known to be unavailable in the toolchain.
Fixes:
http://autobuild.buildroot.net/results/efb/efbb4e940543894b8745bb405478a096c90a5ae2/
http://autobuild.buildroot.net/results/32d/32d6d984febad2dee1f0d31c5fa0aea823297096/
http://autobuild.buildroot.net/results/aa6/aa6e71c957fb6f07e7bded35a8e47be4dadd042c/
...and many others.Signed-off-by Rodrigo Rebello <[email protected]>--- package/qemu/qemu.mk | 6 ++++++ 1 file changed, 6 insertions(+)package/qemu/qemu.mk +0
-0
package/qemu/qemu.mk QEMU_VARS = \ · line 140
Quoted 8 lines
package/qemu/qemu.mk +5
-0@@ -133,6 +133,12 @@ QEMU_VARS = \ PYTHON=$(HOST_DIR)/usr/bin/python2 \ PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages +# Force disable stack protector when SSP isn't available in toolchain as +# QEMU configure script fails to properly detect that. +ifeq ($(BR2_TOOLCHAIN_HAS_SSP),) +QEMU_OPTS += --disable-stack-protector +endif
Typically when explicitly adding enable/disable configure options both cases of enabling or disabling the option are put within buildroot. So for this case, it would become:
# Force disable stack protector when SSP isn't available in toolchain as # QEMU configure script fails to properly detect that.
ifeq ($(BR2_TOOLCHAIN_HAS_SSP),y)QEMU_OPTS += --enable-stack-protector
elseQEMU_OPTS += --disable-stack-protector
endif
package/qemu/qemu.mk QEMU_VARS = \ · line 144
Quoted 4 lines
package/qemu/qemu.mk +1
-0+ # If we want to specify only a subset of targets, we must still enable all # of them, so that QEMU properly builds its list of default targets, from # which it then checks if the specified sub-set is valid. That's what we
Thanks,
-Ryan
Signature · 5 lines
Ryan Barnett / Sr Software Engineer Airborne Information Systems / Secure Platforms MS 131-100, C Ave NE, Cedar Rapids, IA, 52498, USA ryan.barnett at rockwellcollins.com www.rockwellcollins.com
PATCH 1/1 qemu: explicitly disable SSP support
Hi, Ryan
2015-11-10 17:49 GMT-02:00 Ryan Barnett <[email protected]>:
Quoted 49 lines
Hi Rodrigo,
Quoted 33 lines · Rodrigo Rebello
Even though the QEMU configure script does a full compile and link test to detect SSP support, it does so by using the compiler option -fstack-protector-strong (and then -fstack-protector-all if that fails).
The problem with this method is that the test program passes the check with -fstack-protector-strong even when SSP support is not available in the toolchain, since that option restricts stack protection to only a subset of all the functions in a program and (in the case of the test program) no "canary" code gets inserted, producing a false-positive. This causes a subsequent failure when the probe for pthreads is performed.
To avoid patching the configure script, fix that by simply disabling the use of stack protector when SSP is known to be unavailable in the toolchain.
Fixes:
http://autobuild.buildroot.net/results/efb/efbb4e940543894b8745bb405478a096c90a5ae2/
http://autobuild.buildroot.net/results/32d/32d6d984febad2dee1f0d31c5fa0aea823297096/
http://autobuild.buildroot.net/results/aa6/aa6e71c957fb6f07e7bded35a8e47be4dadd042c/
...and many others.Signed-off-by Rodrigo Rebello <[email protected]>--- package/qemu/qemu.mk | 6 ++++++ 1 file changed, 6 insertions(+)package/qemu/qemu.mk +0
-0package/qemu/qemu.mk QEMU_VARS = \ · line 140
Quoted 8 lines
package/qemu/qemu.mk +5
-0@@ -133,6 +133,12 @@ QEMU_VARS = \ PYTHON=$(HOST_DIR)/usr/bin/python2 \ PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages +# Force disable stack protector when SSP isn't available in toolchain as +# QEMU configure script fails to properly detect that. +ifeq ($(BR2_TOOLCHAIN_HAS_SSP),) +QEMU_OPTS += --disable-stack-protector +endifTypically when explicitly adding enable/disable configure options both cases of enabling or disabling the option are put within buildroot. So for this case, it would become:
Quoted 8 lines
# Force disable stack protector when SSP isn't available in toolchain as # QEMU configure script fails to properly detect that.
ifeq ($(BR2_TOOLCHAIN_HAS_SSP),y)QEMU_OPTS+= --enable-stack-protector
elseQEMU_OPTS+= --disable-stack-protector
endif
Ok, then. I'll do as you suggested and send a new patch.
Quoted 8 lines
package/qemu/qemu.mk QEMU_VARS = \ · line 144
Quoted 4 lines
package/qemu/qemu.mk +1
-0+ # If we want to specify only a subset of targets, we must still enable all # of them, so that QEMU properly builds its list of default targets, from # which it then checks if the specified sub-set is valid. That's what weThanks,
-Ryan
Quoted 6 lines
--
Ryan Barnett / Sr Software Engineer Airborne Information Systems / Secure Platforms MS 131-100, C Ave NE, Cedar Rapids, IA, 52498, USA ryan.barnett at rockwellcollins.com www.rockwellcollins.com
Regards,
Rodrigo
PATCH 1/1 qemu: explicitly disable SSP support
In reply to Rodrigo RebelloQuoted 12 lines · Rodrigo Rebello
Even though the QEMU configure script does a full compile and link test to detect SSP support, it does so by using the compiler option -fstack-protector-strong (and then -fstack-protector-all if that fails).
The problem with this method is that the test program passes the check with -fstack-protector-strong even when SSP support is not available in the toolchain, since that option restricts stack protection to only a subset of all the functions in a program and (in the case of the test program) no "canary" code gets inserted, producing a false-positive. This causes a subsequent failure when the probe for pthreads is performed.
Quoted 3 lines
To avoid patching the configure script, fix that by simply disabling the use of stack protector when SSP is known to be unavailable in the toolchain.
Actually, it doesn't look too hard to patch the configure script, and that
would be upstreamable.
But if you feel that that is too difficult, I'm OK with this patch.
Regards,
Arnout
Quoted 31 lines
Fixes:
http://autobuild.buildroot.net/results/efb/efbb4e940543894b8745bb405478a096c90a5ae2/
http://autobuild.buildroot.net/results/32d/32d6d984febad2dee1f0d31c5fa0aea823297096/
http://autobuild.buildroot.net/results/aa6/aa6e71c957fb6f07e7bded35a8e47be4dadd042c/
...and many others.Signed-off-by Rodrigo Rebello <[email protected]>--- package/qemu/qemu.mk | 6 ++++++ 1 file changed, 6 insertions(+)package/qemu/qemu.mk +6
-0@@ -133,6 +133,12 @@ QEMU_VARS = \ PYTHON=$(HOST_DIR)/usr/bin/python2 \ PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packages +# Force disable stack protector when SSP isn't available in toolchain as +# QEMU configure script fails to properly detect that. +ifeq ($(BR2_TOOLCHAIN_HAS_SSP),) +QEMU_OPTS += --disable-stack-protector +endif + # If we want to specify only a subset of targets, we must still enable all # of them, so that QEMU properly builds its list of default targets, from # which it then checks if the specified sub-set is valid. That's what we
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH 1/1 qemu: explicitly disable SSP support
Arnout, All
2015-11-10 19:11 GMT-02:00 Arnout Vandecappelle <[email protected]>:
Quoted 13 lines · Rodrigo Rebello
Quoted 12 lines
Even though the QEMU configure script does a full compile and link test to detect SSP support, it does so by using the compiler option -fstack-protector-strong (and then -fstack-protector-all if that fails).
The problem with this method is that the test program passes the check with -fstack-protector-strong even when SSP support is not available in the toolchain, since that option restricts stack protection to only a subset of all the functions in a program and (in the case of the test program) no "canary" code gets inserted, producing a false-positive. This causes a subsequent failure when the probe for pthreads is performed.
Quoted 7 lines
Quoted 3 lines
To avoid patching the configure script, fix that by simply disabling the use of stack protector when SSP is known to be unavailable in the toolchain.
Actually, it doesn't look too hard to patch the configure script, and that
would be upstreamable.
I agree, that would be a better solution indeed. I'll consider patching the configure script then, and if I come up with a working solution, I'll send the patch upstream as well.
Quoted 39 lines
But if you feel that that is too difficult, I'm OK with this patch.
Regards,
ArnoutQuoted 21 lines
Fixes:
http://autobuild.buildroot.net/results/efb/efbb4e940543894b8745bb405478a096c90a5ae2/
http://autobuild.buildroot.net/results/32d/32d6d984febad2dee1f0d31c5fa0aea823297096/
http://autobuild.buildroot.net/results/aa6/aa6e71c957fb6f07e7bded35a8e47be4dadd042c/
...and many others.Signed-off-by Rodrigo Rebello <[email protected]>--- package/qemu/qemu.mk | 6 ++++++ 1 file changed, 6 insertions(+)package/qemu/qemu.mk +0
-0@@ -133,6 +133,12 @@ QEMU_VARS = \ PYTHON=$(HOST_DIR)/usr/bin/python2 \ PYTHONPATH=$(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/site-packagespackage/qemu/qemu.mk QEMU_VARS = \ · line 144
Quoted 10 lines
package/qemu/qemu.mk +6
-0+# Force disable stack protector when SSP isn't available in toolchain as +# QEMU configure script fails to properly detect that. +ifeq ($(BR2_TOOLCHAIN_HAS_SSP),) +QEMU_OPTS += --disable-stack-protector +endif + # If we want to specify only a subset of targets, we must still enable all # of them, so that QEMU properly builds its list of default targets, from # which it then checks if the specified sub-set is valid. That's what we--
Quoted 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Regards,
Rodrigo