Bug 1861276

Summary: LTO breaks tpm2-pkcs11 build
Product: [Fedora] Fedora Reporter: Dan Horák <dan>
Component: gccAssignee: Jeff Law <law>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: aoliva, dmalcolm, fweimer, jakub, jwakely, law, mpolacek, msebor, nickc, pbrobinson, sipoyare
Target Milestone: ---Keywords: Reopened, Tracking
Target Release: ---   
Hardware: s390x   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-02-01 10:14:11 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 467765, 1789115    

Description Dan Horák 2020-07-28 08:15:50 UTC
With LTO enabled tpm2-pkcs11 build fails with

...
+ make check
make   test/unit/test_twist test/unit/test_log test/unit/test_parser test/unit/test_attr 
make[1]: Entering directory '/builddir/build/BUILD/tpm2-pkcs11-1.3.1'
  CC       test/unit/test_unit_test_twist-test_twist.o
  CCLD     test/unit/test_twist
In function 'memcpy',
    inlined from 'internal_append' at src/lib/twist.c:114:10,
    inlined from 'twistbin_append' at src/lib/twist.c:302:9,
    inlined from 'twistbin_append' at src/lib/twist.c:290:7,
    inlined from 'test_twistbin_new_overflow_3' at test/unit/test_twist.c:264:17:
/usr/include/bits/string_fortified.h:34:10: error: '__builtin_memcpy' specified bound 18446744073709551603 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
   34 |   return __builtin___memcpy_chk (__dest, __src, __len, __bos0 (__dest));
      |          ^
In function 'memset',
    inlined from 'twist_truncate' at src/lib/twist.c:346:3,
    inlined from 'test_twist_truncate_smaller' at test/unit/test_twist.c:825:17:
/usr/include/bits/string_fortified.h:71:10: error: '__builtin_memset' specified bound 18446744073709551612 exceeds maximum object size 9223372036854775807 [-Werror=stringop-overflow=]
   71 |   return __builtin___memset_chk (__dest, __ch, __len, __bos0 (__dest));
      |          ^
lto1: all warnings being treated as errors
lto-wrapper: fatal error: gcc returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status


Please see https://koji.fedoraproject.org/koji/taskinfo?taskID=47999421 for full logs.


Version-Release number of selected component (if applicable):
tpm2-pkcs11-1.3.1-1.fc33
gcc-10.2.1-1.fc33.s390x

Comment 1 Jeff Law 2020-07-29 19:04:41 UTC
All kinds of interesting possibilities here, I'm sure the unique inlining tuning on s390 comes into play.  Thanks for passing it along.

Comment 2 Jeff Law 2020-07-31 04:35:43 UTC
So this is a combination of LTO's cross-module inlining combined with a missed optimization computing ranges for integer overflow tests which results in an infeasible path being left in the CFG.  On that infeasible path we have propagated a negative constant value into the size argument of a memset call and we get the bogus diagnostic.

I've filed an upstream BZ for the missed optimization.  There's actually a good chance this will be solvable with work that Andrew & Aldy are looking to land in gcc-11.

In the immediate term, I think the s390 disablement of LTO is quite reasonable.

Comment 3 Ben Cotton 2020-08-11 13:50:05 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 33 development cycle.
Changing version to 33.

Comment 4 Ben Cotton 2021-11-04 17:30:00 UTC
This message is a reminder that Fedora 33 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 33 on 2021-11-30.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '33'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 33 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 5 Ben Cotton 2021-11-30 16:26:52 UTC
Fedora 33 changed to end-of-life (EOL) status on 2021-11-30. Fedora 33 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 6 Peter Robinson 2021-11-30 19:22:21 UTC
Still actually disabled.