public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Bug 20662: checking whether x86_64-pc-linux-gnu-gcc implicitly enables -fstack-protector no (32bit gcc 6.2.0 pie and ssp enable)
@ 2016-10-20 20:02 Magnus Granberg
  2016-10-21  8:58 ` Szabolcs Nagy
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Magnus Granberg @ 2016-10-20 20:02 UTC (permalink / raw)
  To: libc-alpha

[-- Attachment #1: Type: text/plain, Size: 796 bytes --]

When glibc get compile with gcc 6.2 that have been configured with
 --enable-default-pie and --enable-default-ssp. The check that check if the 
compiler use -fstack-protector as default fail on the 32bit part.

checking for libgd... no
checking for _FORTIFY_SOURCE predefine... yes
checking whether x86_64-pc-linux-gnu-gcc -m32 -Wl,-O1 -Wl,--as-needed 
implicitly enables -fstack-protector... no
checking whether the linker provides working __ehdr_start... yes

This patch make so we look for __stack_chk_fail_local in the check.
Tested on x86_64 multilib Gentoo

Changelog:

2016-10-20  Magnus Granberg  <zorry@gentoo.org>
		Denis Kaganovich  <mahatma@eu.by>

		* configure.ac:
		Add check for __stack_chk_fail_local in libc_cv_predef_stack_protector 	
		check.
		* configure: Regenerated.

---

[-- Attachment #2: glibc-gcc6.patch --]
[-- Type: text/x-patch, Size: 1039 bytes --]

diff --git a/configure.ac b/configure.ac
index a64aeb9..de42b6b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1667,12 +1668,14 @@ echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
 # symbols (resolved by the linker), so filter out unknown symbols.
 # This will fail to produce the correct result if the compiler
 # defaults to -fstack-protector but this produces an undefined symbol
-# other than __stack_chk_fail.  However, compilers like that have not
-# been encountered in practice.
-libc_undefs=`echo "$libc_undefs" | egrep '^(foobar|__stack_chk_fail)$'`
+# other than __stack_chk_fail or __stack_chk_fail_local. However,
+# compilers like that have not been encountered in practice.
+libc_undefs=`echo "$libc_undefs" | \
+  egrep '^(foobar|__stack_chk_fail|__stack_chk_fail_local)$'`
 case "$libc_undefs" in
 foobar) libc_cv_predef_stack_protector=no ;;
 '__stack_chk_fail
+foobar'|'__stack_chk_fail_local
 foobar') libc_cv_predef_stack_protector=yes ;;
 *) AC_MSG_ERROR([unexpected symbols in test: $libc_undefs]) ;;
 esac],

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Bug 20662: checking whether x86_64-pc-linux-gnu-gcc implicitly enables -fstack-protector no (32bit gcc 6.2.0 pie and ssp enable)
  2016-10-20 20:02 [PATCH] Bug 20662: checking whether x86_64-pc-linux-gnu-gcc implicitly enables -fstack-protector no (32bit gcc 6.2.0 pie and ssp enable) Magnus Granberg
@ 2016-10-21  8:58 ` Szabolcs Nagy
  2016-10-22 13:03   ` Magnus Granberg
  2016-11-15 19:37 ` [PATCH/committed 2.24] configure: accept __stack_chk_fail_local for ssp support too [BZ #20662] Mike Frysinger
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 6+ messages in thread
From: Szabolcs Nagy @ 2016-10-21  8:58 UTC (permalink / raw)
  To: Magnus Granberg, libc-alpha; +Cc: nd

On 20/10/16 21:01, Magnus Granberg wrote:
> When glibc get compile with gcc 6.2 that have been configured with
>  --enable-default-pie and --enable-default-ssp. The check that check if the 
> compiler use -fstack-protector as default fail on the 32bit part.
> 

i'm not against this patch, just note that any reasonable ssp
implementation would not make a call in case of failure, but
crash the application immediately, i hope gcc will have an
option in the future to do that, which means this check will
not work (the test would have to look for canary access, which
is target specific).


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Bug 20662: checking whether x86_64-pc-linux-gnu-gcc implicitly enables -fstack-protector no (32bit gcc 6.2.0 pie and ssp enable)
  2016-10-21  8:58 ` Szabolcs Nagy
@ 2016-10-22 13:03   ` Magnus Granberg
  0 siblings, 0 replies; 6+ messages in thread
From: Magnus Granberg @ 2016-10-22 13:03 UTC (permalink / raw)
  To: libc-alpha

fredag 21 oktober 2016 kl. 09:58:08 CEST skrev  Szabolcs Nagy:
> On 20/10/16 21:01, Magnus Granberg wrote:
> > When glibc get compile with gcc 6.2 that have been configured with
> > 
> >  --enable-default-pie and --enable-default-ssp. The check that check if
> >  the
> > 
> > compiler use -fstack-protector as default fail on the 32bit part.
> 
> i'm not against this patch, just note that any reasonable ssp
> implementation would not make a call in case of failure, but
> crash the application immediately, i hope gcc will have an
> option in the future to do that, which means this check will
> not work (the test would have to look for canary access, which
> is target specific).
Thanks

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH/committed 2.24] configure: accept __stack_chk_fail_local for ssp support too [BZ #20662]
  2016-10-20 20:02 [PATCH] Bug 20662: checking whether x86_64-pc-linux-gnu-gcc implicitly enables -fstack-protector no (32bit gcc 6.2.0 pie and ssp enable) Magnus Granberg
  2016-10-21  8:58 ` Szabolcs Nagy
@ 2016-11-15 19:37 ` Mike Frysinger
  2016-11-15 19:37 ` [PATCH] Bug 20662: checking whether x86_64-pc-linux-gnu-gcc implicitly enables -fstack-protector no (32bit gcc 6.2.0 pie and ssp enable) Mike Frysinger
  2016-11-15 19:37 ` [PATCH/committed 2.23] configure: accept __stack_chk_fail_local for ssp support too [BZ #20662] Mike Frysinger
  3 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2016-11-15 19:37 UTC (permalink / raw)
  To: libc-alpha

From: Denis Kaganovich <mahatma@eu.by>

When glibc is compiled with gcc 6.2 that has been configured with
--enable-default-pie and --enable-default-ssp, the configure script
fails to detect that the compiler has ssp turned on by default when
being built for i686-linux-gnu.

This is because gcc is emitting __stack_chk_fail_local but the
script is only looking for __stack_chk_fail.  Support both.

Example output:
checking whether x86_64-pc-linux-gnu-gcc -m32 -Wl,-O1 -Wl,--as-needed
implicitly enables -fstack-protector... no

(cherry picked from commit c7409aded44634411a19b0b7178b7faa237835e6)
---
 ChangeLog    | 9 +++++++++
 configure    | 8 +++++---
 configure.ac | 8 +++++---
 3 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index a51771c97668..1e2dcea203b4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2016-11-15  Denis Kaganovich  <mahatma@eu.by>
+	    Magnus Granberg  <zorry@gentoo.org>
+	    Mike Frysinger  <vapier@gentoo.org>
+
+	[BZ #20662]
+	* configure.ac (libc_cv_predef_stack_protector): Also check for
+	__stack_chk_fail_local symbols.
+	* configure: Regenerated.
+
 2016-11-03  Joseph Myers  <joseph@codesourcery.com>
 
 	* conform/Makefile ($(linknamespace-header-tests)): Also depend on
diff --git a/configure b/configure
index 17625e104128..9b5a48604809 100755
--- a/configure
+++ b/configure
@@ -6289,12 +6289,14 @@ echo >&5 "libc_undefs='$libc_undefs'"
 # symbols (resolved by the linker), so filter out unknown symbols.
 # This will fail to produce the correct result if the compiler
 # defaults to -fstack-protector but this produces an undefined symbol
-# other than __stack_chk_fail.  However, compilers like that have not
-# been encountered in practice.
-libc_undefs=`echo "$libc_undefs" | egrep '^(foobar|__stack_chk_fail)$'`
+# other than __stack_chk_fail or __stack_chk_fail_local. However,
+# compilers like that have not been encountered in practice.
+libc_undefs=`echo "$libc_undefs" | \
+  egrep '^(foobar|__stack_chk_fail|__stack_chk_fail_local)$'`
 case "$libc_undefs" in
 foobar) libc_cv_predef_stack_protector=no ;;
 '__stack_chk_fail
+foobar'|'__stack_chk_fail_local
 foobar') libc_cv_predef_stack_protector=yes ;;
 *) as_fn_error $? "unexpected symbols in test: $libc_undefs" "$LINENO" 5 ;;
 esac
diff --git a/configure.ac b/configure.ac
index 33bcd621804e..8277d9f72797 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1626,12 +1626,14 @@ echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
 # symbols (resolved by the linker), so filter out unknown symbols.
 # This will fail to produce the correct result if the compiler
 # defaults to -fstack-protector but this produces an undefined symbol
-# other than __stack_chk_fail.  However, compilers like that have not
-# been encountered in practice.
-libc_undefs=`echo "$libc_undefs" | egrep '^(foobar|__stack_chk_fail)$'`
+# other than __stack_chk_fail or __stack_chk_fail_local. However,
+# compilers like that have not been encountered in practice.
+libc_undefs=`echo "$libc_undefs" | \
+  egrep '^(foobar|__stack_chk_fail|__stack_chk_fail_local)$'`
 case "$libc_undefs" in
 foobar) libc_cv_predef_stack_protector=no ;;
 '__stack_chk_fail
+foobar'|'__stack_chk_fail_local
 foobar') libc_cv_predef_stack_protector=yes ;;
 *) AC_MSG_ERROR([unexpected symbols in test: $libc_undefs]) ;;
 esac],
-- 
2.10.2

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH/committed 2.23] configure: accept __stack_chk_fail_local for ssp support too [BZ #20662]
  2016-10-20 20:02 [PATCH] Bug 20662: checking whether x86_64-pc-linux-gnu-gcc implicitly enables -fstack-protector no (32bit gcc 6.2.0 pie and ssp enable) Magnus Granberg
                   ` (2 preceding siblings ...)
  2016-11-15 19:37 ` [PATCH] Bug 20662: checking whether x86_64-pc-linux-gnu-gcc implicitly enables -fstack-protector no (32bit gcc 6.2.0 pie and ssp enable) Mike Frysinger
@ 2016-11-15 19:37 ` Mike Frysinger
  3 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2016-11-15 19:37 UTC (permalink / raw)
  To: libc-alpha

From: Denis Kaganovich <mahatma@eu.by>

When glibc is compiled with gcc 6.2 that has been configured with
--enable-default-pie and --enable-default-ssp, the configure script
fails to detect that the compiler has ssp turned on by default when
being built for i686-linux-gnu.

This is because gcc is emitting __stack_chk_fail_local but the
script is only looking for __stack_chk_fail.  Support both.

Example output:
checking whether x86_64-pc-linux-gnu-gcc -m32 -Wl,-O1 -Wl,--as-needed
implicitly enables -fstack-protector... no

(cherry picked from commit c7409aded44634411a19b0b7178b7faa237835e6)
---
 ChangeLog    | 9 +++++++++
 configure    | 8 +++++---
 configure.ac | 8 +++++---
 3 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 46820acb1dbb..37cb2f881922 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2016-11-15  Denis Kaganovich  <mahatma@eu.by>
+	    Magnus Granberg  <zorry@gentoo.org>
+	    Mike Frysinger  <vapier@gentoo.org>
+
+	[BZ #20662]
+	* configure.ac (libc_cv_predef_stack_protector): Also check for
+	__stack_chk_fail_local symbols.
+	* configure: Regenerated.
+
 2016-07-18  Siddhesh Poyarekar  <siddhesh@sourceware.org>
 	    Matt Clay  <mclay@lycos.com>
 
diff --git a/configure b/configure
index 8fe59377eacf..ee49f286af3e 100755
--- a/configure
+++ b/configure
@@ -6252,12 +6252,14 @@ echo >&5 "libc_undefs='$libc_undefs'"
 # symbols (resolved by the linker), so filter out unknown symbols.
 # This will fail to produce the correct result if the compiler
 # defaults to -fstack-protector but this produces an undefined symbol
-# other than __stack_chk_fail.  However, compilers like that have not
-# been encountered in practice.
-libc_undefs=`echo "$libc_undefs" | egrep '^(foobar|__stack_chk_fail)$'`
+# other than __stack_chk_fail or __stack_chk_fail_local. However,
+# compilers like that have not been encountered in practice.
+libc_undefs=`echo "$libc_undefs" | \
+  egrep '^(foobar|__stack_chk_fail|__stack_chk_fail_local)$'`
 case "$libc_undefs" in
 foobar) libc_cv_predef_stack_protector=no ;;
 '__stack_chk_fail
+foobar'|'__stack_chk_fail_local
 foobar') libc_cv_predef_stack_protector=yes ;;
 *) as_fn_error $? "unexpected symbols in test: $libc_undefs" "$LINENO" 5 ;;
 esac
diff --git a/configure.ac b/configure.ac
index 3c766b7409f7..5932138bbd5e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1603,12 +1603,14 @@ echo >&AS_MESSAGE_LOG_FD "libc_undefs='$libc_undefs'"
 # symbols (resolved by the linker), so filter out unknown symbols.
 # This will fail to produce the correct result if the compiler
 # defaults to -fstack-protector but this produces an undefined symbol
-# other than __stack_chk_fail.  However, compilers like that have not
-# been encountered in practice.
-libc_undefs=`echo "$libc_undefs" | egrep '^(foobar|__stack_chk_fail)$'`
+# other than __stack_chk_fail or __stack_chk_fail_local. However,
+# compilers like that have not been encountered in practice.
+libc_undefs=`echo "$libc_undefs" | \
+  egrep '^(foobar|__stack_chk_fail|__stack_chk_fail_local)$'`
 case "$libc_undefs" in
 foobar) libc_cv_predef_stack_protector=no ;;
 '__stack_chk_fail
+foobar'|'__stack_chk_fail_local
 foobar') libc_cv_predef_stack_protector=yes ;;
 *) AC_MSG_ERROR([unexpected symbols in test: $libc_undefs]) ;;
 esac],
-- 
2.10.2

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] Bug 20662: checking whether x86_64-pc-linux-gnu-gcc implicitly enables -fstack-protector no (32bit gcc 6.2.0 pie and ssp enable)
  2016-10-20 20:02 [PATCH] Bug 20662: checking whether x86_64-pc-linux-gnu-gcc implicitly enables -fstack-protector no (32bit gcc 6.2.0 pie and ssp enable) Magnus Granberg
  2016-10-21  8:58 ` Szabolcs Nagy
  2016-11-15 19:37 ` [PATCH/committed 2.24] configure: accept __stack_chk_fail_local for ssp support too [BZ #20662] Mike Frysinger
@ 2016-11-15 19:37 ` Mike Frysinger
  2016-11-15 19:37 ` [PATCH/committed 2.23] configure: accept __stack_chk_fail_local for ssp support too [BZ #20662] Mike Frysinger
  3 siblings, 0 replies; 6+ messages in thread
From: Mike Frysinger @ 2016-11-15 19:37 UTC (permalink / raw)
  To: Magnus Granberg; +Cc: libc-alpha

[-- Attachment #1: Type: text/plain, Size: 74 bytes --]

thanks, i cleaned it up a bit and pushed it to master & 2.23 & 2.24
-mike

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-11-15 19:37 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-20 20:02 [PATCH] Bug 20662: checking whether x86_64-pc-linux-gnu-gcc implicitly enables -fstack-protector no (32bit gcc 6.2.0 pie and ssp enable) Magnus Granberg
2016-10-21  8:58 ` Szabolcs Nagy
2016-10-22 13:03   ` Magnus Granberg
2016-11-15 19:37 ` [PATCH/committed 2.24] configure: accept __stack_chk_fail_local for ssp support too [BZ #20662] Mike Frysinger
2016-11-15 19:37 ` [PATCH] Bug 20662: checking whether x86_64-pc-linux-gnu-gcc implicitly enables -fstack-protector no (32bit gcc 6.2.0 pie and ssp enable) Mike Frysinger
2016-11-15 19:37 ` [PATCH/committed 2.23] configure: accept __stack_chk_fail_local for ssp support too [BZ #20662] Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).