Skip to contentSkip to conversation

mosh: fix build with the Codescape IMG toolchain

PATCH New Baruch Siach 2 participants 6 messages Apr 5, 2016 – Apr 6, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mosh: fix build with the Codescape IMG toolchain

The Codescape IMG toolchain does not provide the ssp library even though it's a glibc toolchain, and thus selects BR2_TOOLCHAIN_HAS_SSP. Add a patch that changes the compile test for -fstack-protector-all to a build test that correctly fails when ssp is missing.

This makes the seeding of ssp related configure variables unnecessary.

---
 ...ure.ac-link-test-for-fstack-protector-all.patch | 33 ++++++++++++++++++++++
 package/mosh/mosh.mk                               | 11 ++------
 2 files changed, 35 insertions(+), 9 deletions(-)
 create mode 100644 package/mosh/0001-configure.ac-link-test-for-fstack-protector-all.patch
package/mosh/0001-configure.ac-link-test-for-fstack-protector-all.patch new file +33 -0
new file mode 100644
index 000000000000..f8dc63b604fd
@@ -0,0 +1,33 @@
+From 5b3b697f50ba31842be544d6b54962df92c44958 Mon Sep 17 00:00:00 2001
+From: Baruch Siach <[email protected]>
+Date: Tue, 5 Apr 2016 15:24:55 +0300
+Subject: [PATCH] configure.ac: link test for -fstack-protector-all
+
+There are (broken) compilers out there that accept -fstack-protector-*
+parameters, but do not provide the needed ssp library. As a result, build does
+not fail, but link does. Use the local check_link_flag autoconf function to
+correctly test for SSP availability.
+
+Signed-off-by: Baruch Siach <[email protected]>
+---
+Upstream status: https://github.com/mobile-shell/mosh/pull/733
+
+ configure.ac | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/configure.ac b/configure.ac
+index 3c9dea03e40a..f5799689f2c1 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -93,7 +93,7 @@ AS_IF([test x"$hardening" != x"no"], [
+   # This one will likely succeed, even on platforms where it does nothing.
+   check_cc_cxx_flag([-D_FORTIFY_SOURCE=2], [HARDEN_CFLAGS="$HARDEN_CFLAGS -D_FORTIFY_SOURCE=2"])
+ 
+-  check_cc_cxx_flag([-fstack-protector-all],
++  check_link_flag([-fstack-protector-all],
+    [HARDEN_CFLAGS="$HARDEN_CFLAGS -fstack-protector-all"
+     check_cc_cxx_flag([-Wstack-protector], [HARDEN_CFLAGS="$HARDEN_CFLAGS -Wstack-protector"],
+       [], [-fstack-protector-all])
+-- 
+2.8.0.rc3
+
package/mosh/mosh.mk +2 -9
index f8c45e8ccd2a..12691009da77 100644
@@ -9,14 +9,7 @@ MOSH_SITE = https://mosh.mit.edu
 MOSH_DEPENDENCIES = zlib ncurses protobuf openssl host-pkgconf
 MOSH_LICENSE = GPLv3+ with exception
 MOSH_LICENSE_FILES = COPYING COPYING.iOS
-
-# help the detection of the SSP support: mosh configure.ac doesn't do
-# a link test, so it doesn't detect when the toolchain doesn't have
-# libssp.
-ifeq ($(BR2_TOOLCHAIN_HAS_SSP),)
-MOSH_CONF_ENV += \
-	ax_cv_check_cflags__Werror___fstack_protector_all=no \
-	ax_cv_check_cxxflags__Werror___fstack_protector_all=no
-endif
+# Patching configure.ac
+MOSH_AUTORECONF = YES
 
 $(eval $(autotools-package))
Signature · 1 line
2.8.0.rc3
#1 lore raw

PATCH 1/1 mosh: fix build with the Codescape IMG toolchain

Hi Buildroot list,

Quoted 6 lines · Baruch Siach

The Codescape IMG toolchain does not provide the ssp library even though it's a glibc toolchain, and thus selects BR2_TOOLCHAIN_HAS_SSP. Add a patch that changes the compile test for -fstack-protector-all to a build test that correctly fails when ssp is missing.

This makes the seeding of ssp related configure variables unnecessary.

If forgot to add autobuild references.

Fixes:
http://autobuild.buildroot.net/results/f57/f571cf13462833984504b6dabad98a6b0fb3facb/
http://autobuild.buildroot.net/results/a20/a206849cae4ecb8b2b9afb077852576ccad3536e/
http://autobuild.buildroot.net/results/86b/86b99fe4df64b47c9b76e75896a7470d84d504d7/

Quoted 1 line

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -
#2 lore raw

PATCH 1/1 mosh: fix build with the Codescape IMG toolchain

In reply to Baruch Siach
Quoted 6 lines · Baruch Siach

The Codescape IMG toolchain does not provide the ssp library even though it's a glibc toolchain, and thus selects BR2_TOOLCHAIN_HAS_SSP. Add a patch that changes the compile test for -fstack-protector-all to a build test that correctly fails when ssp is missing.

This makes the seeding of ssp related configure variables unnecessary.

So, this fixes the issue for mosh, but not for libpam-tacplus, powerpc-utils,
psmisc, ruby, sox, and stunnel...

Wouldn't it be better to fix BR2_TOOLCHAIN_HAS_SSP itself instead? Otherwise
there isn't much point in having this symbol... So it shouldn't be selected by glibc/musl itself, but by the individual external toolchains. Cfr. the previous discussion for sox [1].

That said, it would of course be a great idea to upstream the patch to mosh so
we can remove our workaround at some point.

Regards,
Arnout

[1] http://patchwork.ozlabs.org/patch/590047/

Quoted 7 lines
---
  ...ure.ac-link-test-for-fstack-protector-all.patch | 33 ++++++++++++++++++++++
  package/mosh/mosh.mk                               | 11 ++------
  2 files changed, 35 insertions(+), 9 deletions(-)

create mode 100644 package/mosh/0001-configure.ac-link-test-for-fstack-protector-all.patch

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
#3 lore raw

PATCH 1/1 mosh: fix build with the Codescape IMG toolchain

Quoted 8 lines · Arnout Vandecappelle
Quoted 6 lines · Baruch Siach

The Codescape IMG toolchain does not provide the ssp library even though it's a glibc toolchain, and thus selects BR2_TOOLCHAIN_HAS_SSP. Add a patch that changes the compile test for -fstack-protector-all to a build test that correctly fails when ssp is missing.

This makes the seeding of ssp related configure variables unnecessary.

Quoted 7 lines

So, this fixes the issue for mosh, but not for libpam-tacplus, powerpc-utils,
psmisc, ruby, sox, and stunnel...

Wouldn't it be better to fix BR2_TOOLCHAIN_HAS_SSP itself instead? Otherwise
there isn't much point in having this symbol... So it shouldn't be selected by glibc/musl itself, but by the individual external toolchains. Cfr. the previous discussion for sox [1].

And actually, Vicente already provided a patch for that:
http://patchwork.ozlabs.org/patch/597701/

It is at place fifty-something of my patches-to-review list :-)

Regards,
Arnout

Quoted 19 lines

That said, it would of course be a great idea to upstream the patch to mosh so
we can remove our workaround at some point.

Regards,
Arnout

[1] http://patchwork.ozlabs.org/patch/590047/

Quoted 8 lines
---
  ...ure.ac-link-test-for-fstack-protector-all.patch | 33 ++++++++++++++++++++++
  package/mosh/mosh.mk                               | 11 ++------
  2 files changed, 35 insertions(+), 9 deletions(-)

create mode 100644
package/mosh/0001-configure.ac-link-test-for-fstack-protector-all.patch

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
#4 lore raw

PATCH 1/1 mosh: fix build with the Codescape IMG toolchain

Quoted 12 lines · Arnout Vandecappelle
Quoted 11 lines · Arnout Vandecappelle
Quoted 6 lines · Baruch Siach

The Codescape IMG toolchain does not provide the ssp library even though it's a glibc toolchain, and thus selects BR2_TOOLCHAIN_HAS_SSP. Add a patch that changes the compile test for -fstack-protector-all to a build test that correctly fails when ssp is missing.

This makes the seeding of ssp related configure variables unnecessary.

So, this fixes the issue for mosh, but not for libpam-tacplus, powerpc-utils,
psmisc, ruby, sox, and stunnel...

Quoted 7 lines
Quoted 4 lines

Wouldn't it be better to fix BR2_TOOLCHAIN_HAS_SSP itself instead? Otherwise
there isn't much point in having this symbol... So it shouldn't be selected by glibc/musl itself, but by the individual external toolchains. Cfr. the previous discussion for sox [1].

And actually, Vicente already provided a patch for that:
http://patchwork.ozlabs.org/patch/597701/

Oh, and there is this one as well:

http://patchwork.ozlabs.org/patch/545315/

Quoted 2 lines

It is at place fifty-something of my patches-to-review list :-)

... at place sixty-something :-)

Regards,
Arnout

Quoted 25 lines

Regards,
Arnout

Quoted 19 lines

That said, it would of course be a great idea to upstream the patch to mosh so
we can remove our workaround at some point.

Regards,
Arnout

[1] http://patchwork.ozlabs.org/patch/590047/

Quoted 8 lines
---
  ...ure.ac-link-test-for-fstack-protector-all.patch | 33 ++++++++++++++++++++++
  package/mosh/mosh.mk                               | 11 ++------
  2 files changed, 35 insertions(+), 9 deletions(-)

create mode 100644
package/mosh/0001-configure.ac-link-test-for-fstack-protector-all.patch

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
#5 lore raw

PATCH 1/1 mosh: fix build with the Codescape IMG toolchain

In reply to Arnout Vandecappelle

Hi Arnout,

Quoted 11 lines · Arnout Vandecappelle
Quoted 6 lines · Baruch Siach

The Codescape IMG toolchain does not provide the ssp library even though it's a glibc toolchain, and thus selects BR2_TOOLCHAIN_HAS_SSP. Add a patch that changes the compile test for -fstack-protector-all to a build test that correctly fails when ssp is missing.

This makes the seeding of ssp related configure variables unnecessary.

So, this fixes the issue for mosh, but not for libpam-tacplus,
powerpc-utils, psmisc, ruby, sox, and stunnel...

Quoted 7 lines

Wouldn't it be better to fix BR2_TOOLCHAIN_HAS_SSP itself instead?
Otherwise there isn't much point in having this symbol... So it shouldn't be selected by glibc/musl itself, but by the individual external toolchains. Cfr. the previous discussion for sox [1].

That said, it would of course be a great idea to upstream the patch to mosh
so we can remove our workaround at some point.

Upstream status of the mosh patch is at
https://github.com/mobile-shell/mosh/pull/744.

Quoted 1 line

[1] http://patchwork.ozlabs.org/patch/590047/

baruch

Signature · 3 lines
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -