Skip to contentSkip to conversation

tpm2-abrmd: fix build without stack smashing protection (SSP)

PATCH New Carlos Santos 2 participants 6 messages Nov 21, 2018 – Dec 3, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tpm2-abrmd: fix build without stack smashing protection (SSP)

The configuration environment setup that disables SSP if the toolchain does not support it must be updated after the bump to version 2.0.3.

Fixes:
http://autobuild.buildroot.net/results/bd9005eeb24678aa530179a80bbc99b2176f8559
http://autobuild.buildroot.net/results/feff61dcb481a94f5f030117830984c5e09727ea

---
 package/tpm2-abrmd/tpm2-abrmd.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/tpm2-abrmd/tpm2-abrmd.mk +1 -1
index a4d9cfb384..74cc66ba20 100644
@@ -13,7 +13,7 @@ TPM2_ABRMD_DEPENDENCIES = dbus libglib2 tpm2-tss host-pkgconf
 
 # configure.ac doesn't contain a link test, so it doesn't detect when
 # libssp is missing.
-TPM2_ABRMD_CONF_ENV = ax_cv_check_cflags___fstack_protector_all=$(if $(BR2_TOOLCHAIN_HAS_SSP),yes,no)
+TPM2_ABRMD_CONF_ENV = ax_cv_check_cflags___________Werror_______fstack_protector_all=$(if $(BR2_TOOLCHAIN_HAS_SSP),yes,no)
 
 TPM2_ABRMD_CONF_OPTS += \
 	--with-systemdsystemunitdir=$(if $(BR2_INIT_SYSTEMD),/usr/lib/systemd/system,no) \
Signature · 1 line
2.19.1
#1 lore raw

PATCH 1/1 tpm2-abrmd: fix build without stack smashing protection (SSP)

Hello,

Quoted 17 lines · Carlos Santos

The configuration environment setup that disables SSP if the toolchain does not support it must be updated after the bump to version 2.0.3.

Fixes:
http://autobuild.buildroot.net/results/bd9005eeb24678aa530179a80bbc99b2176f8559
http://autobuild.buildroot.net/results/feff61dcb481a94f5f030117830984c5e09727ea

---
 package/tpm2-abrmd/tpm2-abrmd.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/tpm2-abrmd/tpm2-abrmd.mk +0 -0
index a4d9cfb384..74cc66ba20 100644

package/tpm2-abrmd/tpm2-abrmd.mk TPM2_ABRMD_DEPENDENCIES = dbus libglib2 tpm2-tss host-pkgconf · line 16

Quoted 5 lines
package/tpm2-abrmd/tpm2-abrmd.mk +1 -1
@@ -13,7 +13,7 @@ TPM2_ABRMD_DEPENDENCIES = dbus libglib2 tpm2-tss host-pkgconf
 
 # configure.ac doesn't contain a link test, so it doesn't detect when
 # libssp is missing.
-TPM2_ABRMD_CONF_ENV = ax_cv_check_cflags___fstack_protector_all=$(if $(BR2_TOOLCHAIN_HAS_SSP),yes,no)
+TPM2_ABRMD_CONF_ENV = ax_cv_check_cflags___________Werror_______fstack_protector_all=$(if $(BR2_TOOLCHAIN_HAS_SSP),yes,no)

It's a bit annoying to fix this once in a while, what about the following change instead:

m4/flags.m4 +1 -1
index 1b01198..59b6d5b 100644
@@ -5,7 +5,7 @@ dnl   mandatory (configure will fail).
 dnl $1: C compiler flag to add to EXTRA_CFLAGS.
 dnl $2: Set to "required" to cause configure failure if flag not supported..
 AC_DEFUN([AX_ADD_COMPILER_FLAG],[
-    AX_CHECK_COMPILE_FLAG([$1],[
+    AX_CHECK_LINK_FLAG([$1],[
         EXTRA_CFLAGS="$EXTRA_CFLAGS $1"
         AC_SUBST([EXTRA_CFLAGS])],[
         AS_IF([test x$2 != xrequired],[

(entirely untested). It could be submitted upstream.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 tpm2-abrmd: fix build without stack smashing protection (SSP)

Quoted 52 lines

From: "Thomas Petazzoni" <[email protected]>
To: "DATACOM" <[email protected]>
Cc: "buildroot" <[email protected]>
Sent: Quarta-feira, 21 de novembro de 2018 18:06:52
Subject: Re: [Buildroot] [PATCH next] tpm2-abrmd: fix build without stack smashing protection (SSP)

Hello,

Quoted 23 lines · Carlos Santos

The configuration environment setup that disables SSP if the toolchain does not support it must be updated after the bump to version 2.0.3.

Fixes:
http://autobuild.buildroot.net/results/bd9005eeb24678aa530179a80bbc99b2176f8559
http://autobuild.buildroot.net/results/feff61dcb481a94f5f030117830984c5e09727ea

---
 package/tpm2-abrmd/tpm2-abrmd.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/tpm2-abrmd/tpm2-abrmd.mk +1 -1
index a4d9cfb384..74cc66ba20 100644
@@ -13,7 +13,7 @@ TPM2_ABRMD_DEPENDENCIES = dbus libglib2 tpm2-tss host-pkgconf
 
 # configure.ac doesn't contain a link test, so it doesn't detect when
 # libssp is missing.
-TPM2_ABRMD_CONF_ENV = ax_cv_check_cflags___fstack_protector_all=$(if
 $(BR2_TOOLCHAIN_HAS_SSP),yes,no)
+TPM2_ABRMD_CONF_ENV =
Quoted 2 lines

ax_cv_check_cflags___________Werror_______fstack_protector_all=$(if $(BR2_TOOLCHAIN_HAS_SSP),yes,no)

It's a bit annoying to fix this once in a while, what about the following change instead:

m4/flags.m4 +0 -0
index 1b01198..59b6d5b 100644
@@ -5,7 +5,7 @@ dnl   mandatory (configure will fail).

dnl $1: C compiler flag to add to EXTRA_CFLAGS.
dnl $2: Set to "required" to cause configure failure if flag not supported.. AC_DEFUN([AX_ADD_COMPILER_FLAG],[

m4/flags.m4 +1 -1
-    AX_CHECK_COMPILE_FLAG([$1],[
+    AX_CHECK_LINK_FLAG([$1],[
        EXTRA_CFLAGS="$EXTRA_CFLAGS $1"
        AC_SUBST([EXTRA_CFLAGS])],[
        AS_IF([test x$2 != xrequired],[
Quoted 1 line

(entirely untested). It could be submitted upstream.

I can forward your suggestion upstream but for the moment I'd keep the CONF_ENV approach.

Patching flags.m4 would require AUTORECONF, which in its turn would require adding host-autoconf-archive as a build dependency. So more dependencies, a larger build to time and exactly the same result.

Signature · 3 lines
Carlos Santos (Casantos) - DATACOM, P&D
?Marched towards the enemy, spear upright, armed with the certainty
that only the ignorant can have.? ? Epitaph of a volunteer
#3 lore raw

PATCH 1/1 tpm2-abrmd: fix build without stack smashing protection (SSP)

Quoted 59 lines

From: "DATACOM" <[email protected]>
To: "Thomas Petazzoni" <[email protected]>
Cc: "buildroot" <[email protected]>
Sent: Quarta-feira, 21 de novembro de 2018 23:46:58
Subject: Re: [Buildroot] [PATCH next] tpm2-abrmd: fix build without stack smashing protection (SSP)

Quoted 53 lines

From: "Thomas Petazzoni" <[email protected]>
To: "DATACOM" <[email protected]>
Cc: "buildroot" <[email protected]>
Sent: Quarta-feira, 21 de novembro de 2018 18:06:52
Subject: Re: [Buildroot] [PATCH next] tpm2-abrmd: fix build without stack smashing protection (SSP)

Hello,

Quoted 23 lines · Carlos Santos

The configuration environment setup that disables SSP if the toolchain does not support it must be updated after the bump to version 2.0.3.

Fixes:
http://autobuild.buildroot.net/results/bd9005eeb24678aa530179a80bbc99b2176f8559
http://autobuild.buildroot.net/results/feff61dcb481a94f5f030117830984c5e09727ea

---
 package/tpm2-abrmd/tpm2-abrmd.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/tpm2-abrmd/tpm2-abrmd.mk +1 -1
index a4d9cfb384..74cc66ba20 100644
@@ -13,7 +13,7 @@ TPM2_ABRMD_DEPENDENCIES = dbus libglib2 tpm2-tss host-pkgconf
 
 # configure.ac doesn't contain a link test, so it doesn't detect when
 # libssp is missing.
-TPM2_ABRMD_CONF_ENV = ax_cv_check_cflags___fstack_protector_all=$(if
 $(BR2_TOOLCHAIN_HAS_SSP),yes,no)
+TPM2_ABRMD_CONF_ENV =
Quoted 2 lines

ax_cv_check_cflags___________Werror_______fstack_protector_all=$(if $(BR2_TOOLCHAIN_HAS_SSP),yes,no)

It's a bit annoying to fix this once in a while, what about the following change instead:

m4/flags.m4 +0 -0
index 1b01198..59b6d5b 100644
@@ -5,7 +5,7 @@ dnl   mandatory (configure will fail).

dnl $1: C compiler flag to add to EXTRA_CFLAGS.
dnl $2: Set to "required" to cause configure failure if flag not supported.. AC_DEFUN([AX_ADD_COMPILER_FLAG],[

m4/flags.m4 +1 -1
-    AX_CHECK_COMPILE_FLAG([$1],[
+    AX_CHECK_LINK_FLAG([$1],[
        EXTRA_CFLAGS="$EXTRA_CFLAGS $1"
        AC_SUBST([EXTRA_CFLAGS])],[
        AS_IF([test x$2 != xrequired],[
Quoted 8 lines
Quoted 1 line

(entirely untested). It could be submitted upstream.

I can forward your suggestion upstream but for the moment I'd keep the CONF_ENV approach.

Patching flags.m4 would require AUTORECONF, which in its turn would require adding host-autoconf-archive as a build dependency. So more dependencies, a larger build to time and exactly the same result.

Pull request created:

    https://github.com/tpm2-software/tpm2-abrmd/pull/556
Signature · 3 lines
Carlos Santos (Casantos) - DATACOM, P&D
?Marched towards the enemy, spear upright, armed with the certainty
that only the ignorant can have.? ? Epitaph of a volunteer
#4 lore raw

PATCH 1/1 tpm2-abrmd: fix build without stack smashing protection (SSP)

Quoted 71 lines

From: "DATACOM" <[email protected]>
To: "Thomas Petazzoni" <[email protected]>
Cc: "buildroot" <[email protected]>
Sent: Sexta-feira, 23 de novembro de 2018 12:01:24
Subject: Re: [Buildroot] [PATCH next] tpm2-abrmd: fix build without stack smashing protection (SSP)

Quoted 65 lines

From: "DATACOM" <[email protected]>
To: "Thomas Petazzoni" <[email protected]>
Cc: "buildroot" <[email protected]>
Sent: Quarta-feira, 21 de novembro de 2018 23:46:58
Subject: Re: [Buildroot] [PATCH next] tpm2-abrmd: fix build without stack smashing protection (SSP)

Quoted 53 lines

From: "Thomas Petazzoni" <[email protected]>
To: "DATACOM" <[email protected]>
Cc: "buildroot" <[email protected]>
Sent: Quarta-feira, 21 de novembro de 2018 18:06:52
Subject: Re: [Buildroot] [PATCH next] tpm2-abrmd: fix build without stack smashing protection (SSP)

Hello,

Quoted 23 lines · Carlos Santos

The configuration environment setup that disables SSP if the toolchain does not support it must be updated after the bump to version 2.0.3.

Fixes:
http://autobuild.buildroot.net/results/bd9005eeb24678aa530179a80bbc99b2176f8559
http://autobuild.buildroot.net/results/feff61dcb481a94f5f030117830984c5e09727ea

---
 package/tpm2-abrmd/tpm2-abrmd.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
package/tpm2-abrmd/tpm2-abrmd.mk +1 -1
index a4d9cfb384..74cc66ba20 100644
@@ -13,7 +13,7 @@ TPM2_ABRMD_DEPENDENCIES = dbus libglib2 tpm2-tss host-pkgconf
 
 # configure.ac doesn't contain a link test, so it doesn't detect when
 # libssp is missing.
-TPM2_ABRMD_CONF_ENV = ax_cv_check_cflags___fstack_protector_all=$(if
 $(BR2_TOOLCHAIN_HAS_SSP),yes,no)
+TPM2_ABRMD_CONF_ENV =
Quoted 2 lines

ax_cv_check_cflags___________Werror_______fstack_protector_all=$(if $(BR2_TOOLCHAIN_HAS_SSP),yes,no)

It's a bit annoying to fix this once in a while, what about the following change instead:

m4/flags.m4 +0 -0
index 1b01198..59b6d5b 100644
@@ -5,7 +5,7 @@ dnl   mandatory (configure will fail).

dnl $1: C compiler flag to add to EXTRA_CFLAGS.
dnl $2: Set to "required" to cause configure failure if flag not supported.. AC_DEFUN([AX_ADD_COMPILER_FLAG],[

m4/flags.m4 +1 -1
-    AX_CHECK_COMPILE_FLAG([$1],[
+    AX_CHECK_LINK_FLAG([$1],[
        EXTRA_CFLAGS="$EXTRA_CFLAGS $1"
        AC_SUBST([EXTRA_CFLAGS])],[
        AS_IF([test x$2 != xrequired],[
Quoted 1 line

(entirely untested). It could be submitted upstream.

I can forward your suggestion upstream but for the moment I'd keep the CONF_ENV approach.

Quoted 7 lines
Quoted 3 lines

Patching flags.m4 would require AUTORECONF, which in its turn would require adding host-autoconf-archive as a build dependency. So more dependencies, a larger build to time and exactly the same result.

Pull request created:

   https://github.com/tpm2-software/tpm2-abrmd/pull/556

Thomas, could you please accept this patch while we wait for a verdict from upstream on my PR? It is currently blocked by a build error whose solution depends on a subsequent PR:

https://github.com/tpm2-software/tpm2-abrmd/pull/557

Signature · 1 line
Carlos Santos (Casantos) - DATACOM, P&D
#5 lore raw

PATCH 1/1 tpm2-abrmd: fix build without stack smashing protection (SSP)

In reply to Carlos Santos

Hello,

Quoted 11 lines · Carlos Santos

The configuration environment setup that disables SSP if the toolchain does not support it must be updated after the bump to version 2.0.3.

Fixes:
http://autobuild.buildroot.net/results/bd9005eeb24678aa530179a80bbc99b2176f8559
http://autobuild.buildroot.net/results/feff61dcb481a94f5f030117830984c5e09727ea

---
 package/tpm2-abrmd/tpm2-abrmd.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied to master, thanks.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com