Bug 1959806

Summary: FAIL: cf-protection test because no protection enabled
Product: [Fedora] Fedora Reporter: Martin Cermak <mcermak>
Component: annobinAssignee: Nick Clifton <nickc>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 35CC: fweimer, jakub, nickc
Target Milestone: ---Keywords: Bugfix
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-12-13 15:23:01 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
reproducer binary none

Description Martin Cermak 2021-05-12 12:18:51 UTC
Fedora gating [1] caught a possibe problem in annobin-9.71-1.fc34:


scr0  f34 x86_64 # b=`mktemp`
scr0  f34 x86_64 # echo 'int main (void) { return 0; }' | gcc -xc -o $b `rpm --eval "%build_cflags %build_ldflags"` -flto  - 
scr0  f34 x86_64 # annocheck -v $b
annocheck: Version 9.71.
Hardened: /tmp/tmp.aZBbdlwREF: PASS: pie test 
Hardened: /tmp/tmp.aZBbdlwREF: info: set binary producer to Gimple version 11.
Hardened: /tmp/tmp.aZBbdlwREF: PASS: optimization test 
Hardened: /tmp/tmp.aZBbdlwREF: PASS: pic test 
Hardened: /tmp/tmp.aZBbdlwREF: PASS: stack-prot test 
Hardened: /tmp/tmp.aZBbdlwREF: PASS: cf-protection test 
Hardened: /tmp/tmp.aZBbdlwREF: info: set binary producer to GCC version 11.
Hardened: /tmp/tmp.aZBbdlwREF: PASS: property-note test 
Hardened: /tmp/tmp.aZBbdlwREF: PASS: writeable-got test 
Hardened: /tmp/tmp.aZBbdlwREF: PASS: dynamic-segment test 
Hardened: /tmp/tmp.aZBbdlwREF: PASS: bind-now test 
Hardened: /tmp/tmp.aZBbdlwREF: info: set binary producer to Gas version 2.
Hardened: /tmp/tmp.aZBbdlwREF: info: notes produced by assembler plugin version 1
Hardened: /tmp/tmp.aZBbdlwREF: info: set binary producer to Gimple version 9.
Hardened: /tmp/tmp.aZBbdlwREF: info: notes produced by lto plugin version 9.71
Hardened: /tmp/tmp.aZBbdlwREF: skip: warnings test because LTO compilation discards preprocessor options 
Hardened: /tmp/tmp.aZBbdlwREF: PASS: lto test 
Hardened: /tmp/tmp.aZBbdlwREF: PASS: stack-clash test 
Hardened: /tmp/tmp.aZBbdlwREF: FAIL: cf-protection test because no protection enabled (function: main) 
Hardened: /tmp/tmp.aZBbdlwREF: skip: fortify test because LTO compilation discards preprocessor options 
Hardened: /tmp/tmp.aZBbdlwREF: skip: glibcxx-assertions test because source language not C++ 
Hardened: /tmp/tmp.aZBbdlwREF: PASS: entry test 
Hardened: /tmp/tmp.aZBbdlwREF: PASS: gnu-stack test because stack segment exists with the correct permissions 
Hardened: /tmp/tmp.aZBbdlwREF: PASS: gnu-relro test 
Hardened: /tmp/tmp.aZBbdlwREF: PASS: notes test because no gaps found 
Hardened: /tmp/tmp.aZBbdlwREF: skip: branch-protection test because not an AArch64 binary 
Hardened: /tmp/tmp.aZBbdlwREF: skip: dynamic-tags test because AArch64 specific 
Hardened: /tmp/tmp.aZBbdlwREF: skip: go-revision test because no GO compiled code found 
Hardened: /tmp/tmp.aZBbdlwREF: skip: only-go test because no GO compiled code found 
Hardened: /tmp/tmp.aZBbdlwREF: PASS: production test 
Hardened: /tmp/tmp.aZBbdlwREF: PASS: run-path test 
Hardened: /tmp/tmp.aZBbdlwREF: PASS: rwx-seg test 
Hardened: /tmp/tmp.aZBbdlwREF: PASS: short-enum test 
Hardened: /tmp/tmp.aZBbdlwREF: skip: stack-realign test because not an x86 executable 
Hardened: /tmp/tmp.aZBbdlwREF: PASS: textrel test 
Hardened: /tmp/tmp.aZBbdlwREF: PASS: threads test 
(1) scr0  f34 x86_64 # rpm --eval "%build_cflags %build_ldflags"
-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64  -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -Wl,-z,relro -Wl,--as-needed  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld 
scr0  f34 x86_64 # rpm -qa | fgrep -e annobin -e gcc -e redhat-rpm-config | sort
annobin-9.71-1.fc34.x86_64
annobin-annocheck-9.71-1.fc34.x86_64
gcc-11.0.1-0.3.fc34.x86_64
libgcc-11.0.1-0.3.fc34.x86_64
redhat-rpm-config-182-1.fc34.noarch
scr0  f34 x86_64 #

-------
[1] https://bodhi.fedoraproject.org/updates/FEDORA-2021-6a13e93204

Comment 1 Martin Cermak 2021-05-12 12:19:11 UTC
*** Bug 1959805 has been marked as a duplicate of this bug. ***

Comment 2 Martin Cermak 2021-05-12 12:21:23 UTC
Created attachment 1782381 [details]
reproducer binary

Comment 3 Martin Cermak 2021-05-12 12:27:50 UTC
I can also reproduce this with Rawhide annobin-9.71-1.fc35, which actually did pass the gating.  But the testcase was slightly rewritten in the rawhide branch.  I need to look into why the rewritten testcase didn't catch this too.

Comment 4 Nick Clifton 2021-05-13 10:01:01 UTC
Hi Martin,

  I wonder if this is another case of a newer version of the annobin plugin being run with an older version of gcc...

  According to the notes in the binary that you uploaded it was built by gcc v11.0.1, which matches the rpm you mention in the description.  But the annobin plugin that made these notes was built by gcc v11.1.1, which I think is the latest version of gcc that is available for Fedora 34.  So a newer plugin with an older gcc.

  Are you able to rerun your test with annobin-9.68-1.fc34 installed rather than annobin-9.71-1.fc34  ?  The 9.68 version was built with gcc 11.0.1. so maybe this will result in a binary that passes the test.

  If this guess is correct however, then it is troubling that the plugin is still so sensitive to minor variations in gcc versions.  I had hoped that we were past this.  Although it does seem that the upgrade of gcc from 11.0.1 to 11.1.1 has been particularly troublesome.  Maybe this is a one-off ?

Cheers
  Nick

Comment 5 Nick Clifton 2021-05-13 10:44:51 UTC
Note - annocheck is supposed to detect the situation where the plugin was built with a newer version of gcc, but I have just found a bug in the code whereby a minor version value of 0 would stop it from complaining.  I have fixed this in the 9.72 sources which should be available in rawhide soon.

Comment 6 Martin Cermak 2021-05-13 11:39:35 UTC
Hi Nick,  after adding some more logging to the rawhide gating tests it turns out that the original Rawhide CI run, where the test passed was with gcc-11.1.1-1.fc35, whereas I was trying to reproduce locally with gcc-11.0.0-0.19.fc35.  After locally updating to gcc-11.1, the test is passing again with annobin-plugin-gcc-9.71-1.fc35.  So the Rawhide failure is sorted out it seems.

The f34 failure still seems real with the other related package versions available in Fedora 34, as the original report shows.

Comment 7 Nick Clifton 2021-05-13 12:50:27 UTC
Hi Martin,

(In reply to Martin Cermak from comment #6)

> The f34 failure still seems real with the other related package versions
> available in Fedora 34, as the original report shows.

Just to check - is the reproducer binary uploaded in comment #2 the one from the rawhide test or the F34 test ?

Plus, I still think that the problem is a discrepancy between the plugin and the compiler.  annobin-2.71-1.fc34 was built by gcc-11.1.1-1.fc34 but the description of this BZ shows that the failing test was built with gcc-11.0.1-0.3.fc34.

If you have a test binary that was built with gcc 11.1.1 but which still fails, please could you upload so that I can take another look ?

Cheers
  Nick

Comment 8 Martin Cermak 2021-05-13 15:23:50 UTC
Nick, the reproducer binary attached in Comment #2 comes from a f34 environment.  I've now re-tested with gcc-11.1.1-1.fc34 and annobin-9.72-1.fc34 and things seem to be looking good.

ITSM annobin-9.72-1.fc34 didn't make it to bodhi yet.  Let's see how gating runs against it..

Comment 9 Ben Cotton 2021-08-10 13:02:21 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 35 development cycle.
Changing version to 35.

Comment 10 Ben Cotton 2022-11-29 16:57:02 UTC
This message is a reminder that Fedora Linux 35 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 35 on 2022-12-13.
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
'version' of '35'.

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

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 35 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 Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 11 Ben Cotton 2022-12-13 15:23:01 UTC
Fedora Linux 35 entered end-of-life (EOL) status on 2022-12-13.

Fedora Linux 35 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 Linux
please feel free to reopen this bug against that version. Note that the version
field may be hidden. Click the "Show advanced fields" button if you do not see
the version field.

If you are unable to reopen this bug, please file a new report against an
active release.

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