Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 722056 - dev-libs/libtpms fails to compile
Summary: dev-libs/libtpms fails to compile
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Christopher Byrne
URL:
Whiteboard:
Keywords: PullRequest
: 722910 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-05-10 08:42 UTC by Agostino Sarubbo
Modified: 2020-05-14 22:12 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,57.40 KB, text/plain)
2020-05-10 08:42 UTC, Agostino Sarubbo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2020-05-10 08:42:35 UTC
This is an auto-filled bug because dev-libs/libtpms fails to compile.
The issue was originally discovered on amd64, but it may be reproducible on other arches as well.
If you think that a different summary clarifies the issue better, feel free to change it.
Attached build log and emerge --info.
Comment 1 Agostino Sarubbo gentoo-dev 2020-05-10 08:42:45 UTC
Created attachment 637462 [details]
build.log

build log and emerge --info
Comment 2 Michael Weiser 2020-05-12 12:36:12 UTC
Running the compile command manually yields:

x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I.. -include tpm_
library_conf.h -I../include/libtpms -I../include/libtpms -fstack-protector-strong -DTPM_V12 -DTPM_PCCLIENT -DTPM_VOLATILE_LOAD -DTPM_ENABLE_ACTIVAT
E -DTPM_AES -DTPM_LIBTPMS_CALLBACKS -DTPM_NV_DISK -DTPM_POSIX -DTPM_NOMAINTENANCE_COMMANDS -O2 -march=native -pipe -fomit-frame-pointer -DUSE_OPENS
SL_FUNCTIONS_SYMMETRIC=1 -DUSE_OPENSSL_FUNCTIONS_EC=1 -DUSE_OPENSSL_FUNCTIONS_ECDSA=1 -DUSE_OPENSSL_FUNCTIONS_RSA=1 -Wall -Werror -Wreturn-type -Ws
ign-compare -Wno-self-assign -c tpm12/tpm_delegate.c -o tpm12/libtpms_tpm12_la-tpm_delegate.o
tpm12/tpm_delegate.c: In function ‘TPM_Process_DelegateUpdateVerification’:
tpm12/tpm_delegate.c:3575:48: error: ‘d1DelegateTableRow’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 3575 |      d1DelegateTableRow->pub.verificationCount = familyRow->verificationCount;
      |      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
tpm12/tpm_delegate.c: At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: all warnings being treated as errors

This is fixed by
https://github.com/stefanberger/libtpms/commit/0d22a7aea2eb0851d406eaf0c4d6a7a18c033bcc.

Similarly the following error:

libtool: compile:  x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I.. -include tpm_library_conf.h -I../include/libtpms -I../include/libtpms -fstack-protector-strong -DTPM_V12 -DTPM_PCCLIENT -DTPM_VOLATILE_LOAD -DTPM_ENABLE_ACTIVATE -DTPM_AES -DTPM_LIBTPMS_CALLBACKS -DTPM_NV_DISK -DTPM_POSIX -DTPM_NOMAINTENANCE_COMMANDS -O2 -march=native -pipe -fomit-frame-pointer -DUSE_OPENSSL_FUNCTIONS_SYMMETRIC=1 -DUSE_OPENSSL_FUNCTIONS_EC=1 -DUSE_OPENSSL_FUNCTIONS_ECDSA=1 -DUSE_OPENSSL_FUNCTIONS_RSA=1 -Wall -Werror -Wreturn-type -Wsign-compare -Wno-self-assign -c tpm12/tpm_nvfile.c  -fPIC -DPIC -o tpm12/.libs/libtpms_tpm12_la-tpm_nvfile.o
tpm12/tpm_nvfile.c: In function ‘TPM_NVRAM_LoadData’:
tpm12/tpm_nvfile.c:347:27: error: ‘%02lx’ directive writing between 2 and 8 bytes into a region of size between 0 and 4095 [-Werror=format-overflow
=]
  347 |     sprintf(filename, "%s/%02lx.%s", state_directory, (unsigned long)tpm_number, name);
      |                           ^~~~~
tpm12/tpm_nvfile.c:347:23: note: directive argument in the range [0, 4294967295]
  347 |     sprintf(filename, "%s/%02lx.%s", state_directory, (unsigned long)tpm_number, name);
      |                       ^~~~~~~~~~~~~

is fixed by https://github.com/stefanberger/libtpms/commit/7bd2fb0d425991038e7e1de158bf55d8e338b5cc.

And then we run into:

x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I.. -include tpm_library_conf.h -I../include/libtpms -I../include/libtpms -fstack-protector-strong -DTPM_V12 -DTPM_PCCLIENT -DTPM_VOLATILE_LOAD -DTPM_ENABLE_ACTIVATE -DTPM_AES -DTPM_LIBTPMS_CALLBACKS -DTPM_NV_DISK -DTPM_POSIX -DTPM_NOMAINTENANCE_COMMANDS -O2 -march=native -pipe -fomit-frame-pointer -DUSE_OPENSSL_FUNCTIONS_SYMMETRIC=1 -DUSE_OPENSSL_FUNCTIONS_EC=1 -DUSE_OPENSSL_FUNCTIONS_ECDSA=1 -DUSE_OPENSSL_FUNCTIONS_RSA=1 -Wall -Werror -Wreturn-type -Wsign-compare -Wno-self-assign -c tpm12/tpm_nvram.c -o tpm12/libtpms_tpm12_la-tpm_nvram.o
tpm12/tpm_nvram.c: In function ‘TPM_Process_NVReadValue’:
tpm12/tpm_nvram.c:1539:38: error: ‘isGPIO’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 1539 |      if ((returnCode == TPM_SUCCESS) && !isGPIO) {
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
tpm12/tpm_nvram.c: In function ‘TPM_Process_NVWriteValue’:
tpm12/tpm_nvram.c:2323:6: error: ‘isGPIO’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
 2323 |   if (!isGPIO) {
      |      ^
tpm12/tpm_nvram.c: At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: all warnings being treated as errors

Again that's fixed by https://github.com/stefanberger/libtpms/commit/49f3b55de9c7fdfec8cdae49976ce61978890f17.

All apply cleanly to 0.7.0.

And finally I get:

libtool: compile:  x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I.. -include tpm_library_conf.h -I../include/libtpms -I../include/libtpms -fstack-protector-strong -D_POSIX_ -DTPM_POSIX -DTPM_LIBTPMS_CALLBACKS -I ./tpm2 -I ./tpm2/crypto -I ./tpm2/crypto/openssl -O2 -march=native -pipe -fomit-frame-pointer -DUSE_OPENSSL_FUNCTIONS_SYMMETRIC=1 -DUSE_OPENSSL_FUNCTIONS_EC=1 -DUSE_OPENSSL_FUNCTIONS_ECDSA=1 -DUSE_OPENSSL_FUNCTIONS_RSA=1 -Wall -Werror -Wreturn-type -Wsign-compare -Wno-self-assign -c tpm2/NVDynamic.c  -fPIC -DPIC -o tpm2/.libs/libtpms_tpm2_la-NVDynamic.o
tpm2/NVDynamic.c: In function ‘NvNextByType’:
tpm2/NVDynamic.c:127:10: error: ‘nvHandle’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
  127 |  *handle = nvHandle;
      |  ~~~~~~~~^~~~~~~~~~
tpm2/NVDynamic.c: At top level:
cc1: note: unrecognized command-line option ‘-Wno-self-assign’ may have been intended to silence earlier diagnostics
cc1: all warnings being treated as errors

This is reported upstream: https://github.com/stefanberger/libtpms/issues/133.
Comment 3 Michael Weiser 2020-05-12 12:36:55 UTC
Sorry, forgot: All warnings appeared after upgrading to gcc 10.1.0.
Comment 4 Christopher Byrne 2020-05-12 18:59:18 UTC
I've submitted a PR yesterday with 3 of 4 patches, and one i spun on my own; upstream has now patched it so I've re-pushed with upstream's version.
Comment 5 Christopher Byrne 2020-05-14 17:55:16 UTC
*** Bug 722910 has been marked as a duplicate of this bug. ***
Comment 6 Larry the Git Cow gentoo-dev 2020-05-14 22:12:20 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9570993b65a75260234df497710949db861ffd8f

commit 9570993b65a75260234df497710949db861ffd8f
Author:     Salah Coronya <salah.coronya@gmail.com>
AuthorDate: 2020-05-11 16:40:04 +0000
Commit:     Aaron Bauman <bman@gentoo.org>
CommitDate: 2020-05-14 22:12:13 +0000

    dev-libs/libtpms: Fix compiliation under GCC10
    
    Closes: https://bugs.gentoo.org/722056
    Package-Manager: Portage-2.3.99, Repoman-2.3.22
    Signed-off-by: Salah Coronya <salah.coronya@gmail.com>
    Closes: https://github.com/gentoo/gentoo/pull/15750
    Signed-off-by: Aaron Bauman <bman@gentoo.org>

 ...tial-buffer-overflow-in-filename-creation.patch | 105 ++++++++++++++++++++
 ...Initialize-a-few-variables-for-x86-gcc-O3.patch | 108 +++++++++++++++++++++
 ...0-tpm12-Initialize-some-variables-for-gcc.patch |  74 ++++++++++++++
 ...pms-0.7.0-tpm2-Fix-a-gcc-10.1.0-complaint.patch |  53 ++++++++++
 dev-libs/libtpms/libtpms-0.7.0-r1.ebuild           |   7 ++
 5 files changed, 347 insertions(+)