Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/2] tpm2-* fix build errors
@ 2018-03-25  3:59 Carlos Santos
  2018-03-25  3:59 ` [Buildroot] [PATCH 1/2] toolchain: fix detection of SSP support Carlos Santos
  2018-03-25  3:59 ` [Buildroot] [PATCH 2/2] tpm2-tools: fix compilation error due to uninitialized variable Carlos Santos
  0 siblings, 2 replies; 5+ messages in thread
From: Carlos Santos @ 2018-03-25  3:59 UTC (permalink / raw)
  To: buildroot

- Properly detect the support for SSP.
- Fix CodeSourcery NIOSII toolchain configuration, which incorrectly selected
  BR2_TOOLCHAIN_HAS_SSP.
- Fix compilation error in tpm2-tools due to uninitialized variable.

Notice that the first two changes CAN NOT be sent as separete patches because
the first one would break any build using CodeSourcery NIOSII toolchain.

Carlos Santos (2):
  toolchain: fix detection of SSP support
  tpm2-tools: fix compilation error due to uninitialized variable

 ...y-fix-type-may-be-used-uninitialized-warn.patch | 36 ++++++++++++++++++++++
 toolchain/helpers.mk                               |  2 +-
 .../Config.in                                      |  1 -
 3 files changed, 37 insertions(+), 2 deletions(-)
 create mode 100644 package/tpm2-tools/0001-tpm2_certify-fix-type-may-be-used-uninitialized-warn.patch

-- 
2.14.3

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

* [Buildroot] [PATCH 1/2] toolchain: fix detection of SSP support
  2018-03-25  3:59 [Buildroot] [PATCH 0/2] tpm2-* fix build errors Carlos Santos
@ 2018-03-25  3:59 ` Carlos Santos
  2018-03-25 21:21   ` Thomas Petazzoni
  2018-03-25  3:59 ` [Buildroot] [PATCH 2/2] tpm2-tools: fix compilation error due to uninitialized variable Carlos Santos
  1 sibling, 1 reply; 5+ messages in thread
From: Carlos Santos @ 2018-03-25  3:59 UTC (permalink / raw)
  To: buildroot

GCC issues a warning message if -fstack-protector is passed but SSP is
not available, so in order to force the compilation to fail we must also
pass -Werror.

All external toolchains were verified. The only one whose configuration
incorrectly selected BR2_TOOLCHAIN_HAS_SSP was CodeSourcery NIOSII.

Fixes:
  http://autobuild.buildroot.net/results/ce8fe8ac9cf0db01ae15d476ea714ff176965cfb
  http://autobuild.buildroot.net/results/09ce8f05e28c0219f499ce55130e896cae0c8b45

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
 toolchain/helpers.mk                                                    | 2 +-
 .../toolchain-external/toolchain-external-codesourcery-niosII/Config.in | 1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index 63ef6fb4b0..1792286add 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -421,7 +421,7 @@ check_unusable_toolchain = \
 #
 check_toolchain_ssp = \
 	__CROSS_CC=$(strip $1) ; \
-	__HAS_SSP=`echo 'void main(){}' | $${__CROSS_CC} -fstack-protector -x c - -o $(BUILD_DIR)/.br-toolchain-test.tmp >/dev/null 2>&1 && echo y` ; \
+	__HAS_SSP=`echo 'void main(){}' | $${__CROSS_CC} -Werror -fstack-protector -x c - -o $(BUILD_DIR)/.br-toolchain-test.tmp >/dev/null 2>&1 && echo y` ; \
 	if [ "$(BR2_TOOLCHAIN_HAS_SSP)" != "y" -a "$${__HAS_SSP}" = "y" ] ; then \
 		echo "SSP support available in this toolchain, please enable BR2_TOOLCHAIN_EXTERNAL_HAS_SSP" ; \
 		exit 1 ; \
diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in b/toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in
index 7563995eb6..4ac9c95c86 100644
--- a/toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in
+++ b/toolchain/toolchain-external/toolchain-external-codesourcery-niosII/Config.in
@@ -5,7 +5,6 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII
 	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
 	depends on !BR2_STATIC_LIBS
 	select BR2_TOOLCHAIN_EXTERNAL_GLIBC
-	select BR2_TOOLCHAIN_HAS_SSP
 	select BR2_TOOLCHAIN_HAS_NATIVE_RPC
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
-- 
2.14.3

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

* [Buildroot] [PATCH 2/2] tpm2-tools: fix compilation error due to uninitialized variable
  2018-03-25  3:59 [Buildroot] [PATCH 0/2] tpm2-* fix build errors Carlos Santos
  2018-03-25  3:59 ` [Buildroot] [PATCH 1/2] toolchain: fix detection of SSP support Carlos Santos
@ 2018-03-25  3:59 ` Carlos Santos
  2018-03-25 13:44   ` Peter Korsgaard
  1 sibling, 1 reply; 5+ messages in thread
From: Carlos Santos @ 2018-03-25  3:59 UTC (permalink / raw)
  To: buildroot

Backport a patch alreary submitted upstream, at

  https://github.com/tpm2-software/tpm2-tools/pull/954

Fixes:
  http://autobuild.buildroot.net/results/ae1e151576b365380ab711a1b8ffcd92ad0050e2
  http://autobuild.buildroot.net/results/ee80c2fe54c89589532efd47eb93bd27637c690f

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
---
 ...y-fix-type-may-be-used-uninitialized-warn.patch | 36 ++++++++++++++++++++++
 1 file changed, 36 insertions(+)
 create mode 100644 package/tpm2-tools/0001-tpm2_certify-fix-type-may-be-used-uninitialized-warn.patch

diff --git a/package/tpm2-tools/0001-tpm2_certify-fix-type-may-be-used-uninitialized-warn.patch b/package/tpm2-tools/0001-tpm2_certify-fix-type-may-be-used-uninitialized-warn.patch
new file mode 100644
index 0000000000..b472666f46
--- /dev/null
+++ b/package/tpm2-tools/0001-tpm2_certify-fix-type-may-be-used-uninitialized-warn.patch
@@ -0,0 +1,36 @@
+From e15b01a1eb27e31964308892fcaa9c7d4f17f181 Mon Sep 17 00:00:00 2001
+From: Carlos Santos <casantos@datacom.ind.br>
+Date: Sat, 24 Mar 2018 22:46:46 -0300
+Subject: [PATCH] tpm2_certify: fix "'type' may be used uninitialized" warning
+
+get_key_type does not assign a value to 'type' on error conditions,
+which makes the compiler believe that it will be used uninitialized in
+the LOG_ERR call, in set_scheme. In practice this will never happen
+because set_scheme returns immediately if get_key_type retuns false but
+the compiler does not understand that logic and fails because warnings
+are treated as errors.
+
+Adapted for version 3.0.3 from the change submitted upstream:
+
+  https://github.com/tpm2-software/tpm2-tools/pull/954
+
+Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
+---
+ tools/tpm2_certify.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/tools/tpm2_certify.c b/tools/tpm2_certify.c
+index eaac02f..cbc42a9 100644
+--- a/tools/tpm2_certify.c
++++ b/tools/tpm2_certify.c
+@@ -107,6 +107,7 @@ static bool get_key_type(TSS2_SYS_CONTEXT *sapi_context, TPMI_DH_OBJECT object_h
+             &out_public, &name, &qualified_name, &sessions_data_out));
+     if (rval != TPM_RC_SUCCESS) {
+         LOG_ERR("TPM2_ReadPublic failed. Error Code: 0x%x", rval);
++        *type = TPM_ALG_ERROR;
+         return false;
+     }
+ 
+-- 
+2.14.3
+
-- 
2.14.3

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

* [Buildroot] [PATCH 2/2] tpm2-tools: fix compilation error due to uninitialized variable
  2018-03-25  3:59 ` [Buildroot] [PATCH 2/2] tpm2-tools: fix compilation error due to uninitialized variable Carlos Santos
@ 2018-03-25 13:44   ` Peter Korsgaard
  0 siblings, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2018-03-25 13:44 UTC (permalink / raw)
  To: buildroot

>>>>> "Carlos" == Carlos Santos <casantos@datacom.ind.br> writes:

 > Backport a patch alreary submitted upstream, at
 >   https://github.com/tpm2-software/tpm2-tools/pull/954

 > Fixes:
 >   http://autobuild.buildroot.net/results/ae1e151576b365380ab711a1b8ffcd92ad0050e2
 >   http://autobuild.buildroot.net/results/ee80c2fe54c89589532efd47eb93bd27637c690f

 > Signed-off-by: Carlos Santos <casantos@datacom.ind.br>

Committed, thanks.

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [PATCH 1/2] toolchain: fix detection of SSP support
  2018-03-25  3:59 ` [Buildroot] [PATCH 1/2] toolchain: fix detection of SSP support Carlos Santos
@ 2018-03-25 21:21   ` Thomas Petazzoni
  0 siblings, 0 replies; 5+ messages in thread
From: Thomas Petazzoni @ 2018-03-25 21:21 UTC (permalink / raw)
  To: buildroot

Hello,

On Sun, 25 Mar 2018 00:59:52 -0300, Carlos Santos wrote:
> GCC issues a warning message if -fstack-protector is passed but SSP is
> not available, so in order to force the compilation to fail we must also
> pass -Werror.
> 
> All external toolchains were verified. The only one whose configuration
> incorrectly selected BR2_TOOLCHAIN_HAS_SSP was CodeSourcery NIOSII.
> 
> Fixes:
>   http://autobuild.buildroot.net/results/ce8fe8ac9cf0db01ae15d476ea714ff176965cfb
>   http://autobuild.buildroot.net/results/09ce8f05e28c0219f499ce55130e896cae0c8b45
> 
> Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
> ---
>  toolchain/helpers.mk                                                    | 2 +-
>  .../toolchain-external/toolchain-external-codesourcery-niosII/Config.in | 1 -
>  2 files changed, 1 insertion(+), 2 deletions(-)

Applied to master, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

end of thread, other threads:[~2018-03-25 21:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-25  3:59 [Buildroot] [PATCH 0/2] tpm2-* fix build errors Carlos Santos
2018-03-25  3:59 ` [Buildroot] [PATCH 1/2] toolchain: fix detection of SSP support Carlos Santos
2018-03-25 21:21   ` Thomas Petazzoni
2018-03-25  3:59 ` [Buildroot] [PATCH 2/2] tpm2-tools: fix compilation error due to uninitialized variable Carlos Santos
2018-03-25 13:44   ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox