Bug 1901971

Summary: annobin: annocheck complains about missing -Wall or -Wformat-security flag when -flto is used
Product: Red Hat Enterprise Linux 8 Reporter: Jiri Danek <jdanek>
Component: annobinAssignee: Nick Clifton <nickc>
annobin sub component: system-version QA Contact: Martin Cermak <mcermak>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: fweimer, mcermak, nickc, tschelle
Version: 8.2Keywords: Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: 8.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: annobin-9.46-1.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-05-18 15:30:25 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:
Attachments:
Description Flags
test logs none

Description Jiri Danek 2020-11-26 13:54:09 UTC
Description of problem:

This is a followup to bug 1743635. I have a RPMDiff failing on annocheck, at https://rpmdiff.engineering.redhat.com/run/474345/7/.

The "-Wall or -Wformat-security" warning there appears errorneous.

It disappears when I disable LTO in the compilation.

Version-Release number of selected component (if applicable):

# rpm -qa annobin binutils gcc glibc redhat-rpm-config
annobin-9.23-1.el8.x86_64
glibc-2.28-127.el8.x86_64
binutils-2.30-79.el8.x86_64
gcc-8.3.1-5.1.el8.x86_64
redhat-rpm-config-123-1.el8.noarch

Additional info:

https://issues.redhat.com/browse/ENTMQCL-2502

[root@5b71cc9c3af3 yum.repos.d]# annocheck --all --verbose /usr/lib64/libqpid-proton-cpp.so.12.7.2 
annocheck: Version 9.23.
Hardened: /usr/lib64/libqpid-proton-cpp.so.12.7.2: info: Set binary producer to gcc version 8.
Hardened: /usr/lib64/libqpid-proton-cpp.so.12.7.2: FAIL: (component: _ZN6proton17messaging_handler18on_container_startERNS_9containerE): Compiled without either -Wall or -Wformat-security.
Hardened: /usr/lib64/libqpid-proton-cpp.so.12.7.2: FAIL: (component: _ZN6proton17messaging_handler21on_sender_drain_startERNS_6senderE): Compiled without either -Wall or -Wformat-security.
Hardened: /usr/lib64/libqpid-proton-cpp.so.12.7.2: FAIL: (component: _ZNSt6vectorIN6proton9container4impl9scheduledESaIS3_EED2Ev): Compiled without either -Wall or -Wformat-security.
Hardened: /usr/lib64/libqpid-proton-cpp.so.12.7.2: WARN: Unable to determine the binary's producer from its DW_AT_producer string.

If this is something that you are interested in fixing soon, I could try to produce a self-contained reproducer. For now, I expect we'll just waive the RPMDiff check.

Comment 1 Nick Clifton 2020-11-26 14:58:28 UTC
Hi Jiri,

  Short version: 
    Known problem. Will be fixed soon. Please waive the result for now.

  Long version:
    This is a known problem.  The issue is that with LTO compilation there are two compilation stages, and the second one ignores all warning options and preprocessor options.  So things like -Wall or -D_FORTIFY_SOUCRE=2 are dropped.  (These options are processed during the first compilation stage, so their effects are not lost).  Since the annobin plugin works during the second stage compilation, it misses the options.

  I have added a workaround to help with this problem to annobin 9.42.  But unfortunately rpmdiff is using annobin 9.41.  (I do have a JIRA tickets open to rebase rpmdiff's annobin to 9.46).

  Note - even if you are using the latest version of annobin, the problem will still appear if you do not provide the debuginfo rpm along with the binary rpm:

    % annocheck qpid-proton-cpp-0.33.0-3.el8.ppc64le.rpm 
    annocheck: Version 9.46.
    Hardened: libqpid-proton-cpp.so.12.7.2: FAIL: Compiled without using either the -Wall or -Wformat-security options.

    % annocheck qpid-proton-cpp-0.33.0-3.el8.ppc64le.rpm --debugrpm qpid-proton-cpp-debuginfo-0.33.0-3.el8.ppc64le.rpm 
    annocheck: Version 9.46.
    Hardened: libqpid-proton-cpp.so.12.7.2: PASS.

  This is because annocheck now also looks at the DW_AT_producer strings in the debuginfo where it is able to find more information about how the binary was compiled.

  I hope that this helps.

  If you are happy with this explanation I can close this BZ now, or leave it open until rpmdiff's machines are updated and another build of libqpid-proton passes without FAILures.  Your choice.

Cheers
  Nick

Comment 2 Jiri Danek 2020-11-26 19:01:39 UTC
I don't need an open bugzilla for my purposes, so feel free to close this if you like.

Thanks for the explanation. I understand the RPMDiff warning is a false warning and we will waive it.

Comment 4 Nick Clifton 2020-11-30 15:32:12 UTC
Fixed in annobin-9.46-1.el8

Comment 5 Martin Cermak 2020-12-04 13:51:35 UTC
Created attachment 1736419 [details]
test logs

Verified with annobin-9.46-1.el8 and qpid-proton-0.33.0-3.el8.

Comment 8 errata-xmlrpc 2021-05-18 15:30:25 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (annobin bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2021:1792