Avoid backtrace from __stack_chk_fail [BZ #12189]

Message ID CAMe9rOrDdnxsgoTnV+-8EZzHKHrp+BuRFbqP5UB95aOYtzKvDw@mail.gmail.com
State New, archived
Headers

Commit Message

H.J. Lu July 11, 2017, 8:42 p.m. UTC
  On Tue, Jul 11, 2017 at 1:29 PM, Florian Weimer <fw@deneb.enyo.de> wrote:
> * H. J. Lu:
>
>> On Tue, Jul 11, 2017 at 12:39 PM, Florian Weimer <fw@deneb.enyo.de> wrote:
>>> * H. J. Lu:
>>>
>>>> +CFLAGS-tst-ssp-1.c = -fstack-protector
>>>
>>> This should be -fstack-protector-all, in case the the stack protector
>>> heuristics do not instrument a thirty-byte array.
>>
>> Does GCC 4.9 support  -fstack-protector-all?
>
> It's mentioned in
>
> <https://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html>
>
> so I assume it does.  (-fstack-protector-strong is the recent
> addition.)

Here is the patch.
  

Comments

H.J. Lu July 12, 2017, 2:36 p.m. UTC | #1
On Tue, Jul 11, 2017 at 1:42 PM, H.J. Lu <hjl.tools@gmail.com> wrote:
> On Tue, Jul 11, 2017 at 1:29 PM, Florian Weimer <fw@deneb.enyo.de> wrote:
>> * H. J. Lu:
>>
>>> On Tue, Jul 11, 2017 at 12:39 PM, Florian Weimer <fw@deneb.enyo.de> wrote:
>>>> * H. J. Lu:
>>>>
>>>>> +CFLAGS-tst-ssp-1.c = -fstack-protector
>>>>
>>>> This should be -fstack-protector-all, in case the the stack protector
>>>> heuristics do not instrument a thirty-byte array.
>>>
>>> Does GCC 4.9 support  -fstack-protector-all?
>>
>> It's mentioned in
>>
>> <https://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html>
>>
>> so I assume it does.  (-fstack-protector-strong is the recent
>> addition.)
>
> Here is the patch.
>

I am checking it in.
  

Patch

From 1e306164cc0b673433969994aa6a74d5db99c9f2 Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Tue, 11 Jul 2017 13:40:56 -0700
Subject: [PATCH] Compile tst-ssp-1.c with -fstack-protector-all

Compile tst-ssp-1.c with -fstack-protector-all in case the the stack
protector heuristics do not instrument a thirty-byte array.

	* debug/Makefile (CFLAGS-tst-ssp-1.c): Set to
	-fstack-protector-all.
---
 ChangeLog      | 5 +++++
 debug/Makefile | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index 018e4f2..4140e80 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@ 
+2017-07-11  H.J. Lu  <hongjiu.lu@intel.com>
+
+	* debug/Makefile (CFLAGS-tst-ssp-1.c): Set to
+	-fstack-protector-all.
+
 2017-07-11  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
 
 	* sysdeps/powerpc/powerpc64le/Makefile: Use $(all-object-suffixes)
diff --git a/debug/Makefile b/debug/Makefile
index c6d7872..ce5fa88 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -139,7 +139,7 @@  LDFLAGS-tst-backtrace4 = -rdynamic
 LDFLAGS-tst-backtrace5 = -rdynamic
 LDFLAGS-tst-backtrace6 = -rdynamic
 
-CFLAGS-tst-ssp-1.c = -fstack-protector
+CFLAGS-tst-ssp-1.c = -fstack-protector-all
 
 tests = backtrace-tst tst-longjmp_chk tst-chk1 tst-chk2 tst-chk3 \
 	tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk \
-- 
2.9.4