Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2030667

Summary: Build annobin plugin when building gcc
Product: Red Hat Enterprise Linux 9 Reporter: Nick Clifton <nickc>
Component: gccAssignee: Marek Polacek <mpolacek>
gcc sub component: system-version QA Contact: Václav Kadlčík <vkadlcik>
Status: CLOSED ERRATA Docs Contact:
Severity: unspecified    
Priority: unspecified CC: ahajkova, carl, fberat, fweimer, jakub, jjaburek, mcermak, mpolacek, ngompa13, ohudlick, vkadlcik
Version: 9.0Keywords: Bugfix, Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gcc-11.2.1-7.6.el9 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of:
: 2047356 (view as bug list) Environment:
Last Closed: 2022-05-17 15:55:42 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: 2047356    
Attachments:
Description Flags
Proposed patch to gcc.spec none

Description Nick Clifton 2021-12-09 12:42:32 UTC
Created attachment 1845465 [details]
Proposed patch to gcc.spec

This is a request to apply the uploaded patch to the RHEL-9's gcc.spec file.  The patch adds code to build an annobin plugin every time gcc is built.

I am filing this BZ is in response to the recent problems that RHEL-9 builds have been having with annocheck - namely that it is falsely reporting that -fcf-protection and -fstack-clash-protection have not been enabled.  This is due to the version of gcc in the RHEL-9 buildroot being newer than the version of annobin.

On its own this patch does not solve the problem, since it builds a version of the annobin plugin with a different name.  A second patch, this time to the redhat-rpm-config package, is needed in order to ensure that the correct plugin is chosen whenever a build runs.

Originally I had planned to wait until the Fedora rawhide equivalent of these patches had gone in and been tested for a while.  But given the RHEL-9 build problems it seems like a good idea to expedite the fix.

Comment 1 Nick Clifton 2021-12-09 13:01:16 UTC
The redhat-rpm-config part of this fix has been submitted as: https://bugzilla.redhat.com/show_bug.cgi?id=2030671

Comment 8 Marek Polacek 2022-01-07 17:02:39 UTC
Nick, can you please take a look at Comment 7?

Comment 9 Nick Clifton 2022-01-07 17:23:19 UTC
(In reply to Marek Polacek from comment #8)
> Nick, can you please take a look at Comment 7?

Yes - there is a typo in the patch.  The gcc.spec file looks like this (starting at line 2296):

  %if %{with annobin_plugin}
  %{ANNOBIN_GCC_PLUGIN_DIR}
  %{gver}
  %endif

  %files -f %{name}.lang
  %{_prefix}/bin/cc

It should look like this:

  %files -f %{name}.lang
  %if %{with annobin_plugin}
  %{ANNOBIN_GCC_PLUGIN_DIR}
  %{gver}
  %endif
  %{_prefix}/bin/cc


Ie, the %{gver} and %{ANNOBIN_GCC_PLUGIN_DIR} are meant to be part of the %files section of the spec file, not the %postun section.

Do you want me to submit a patch to fix this, or can you take it from here ?

Cheers
  Nick

Comment 10 Marek Polacek 2022-01-07 17:27:03 UTC
Thanks, I'll take it from here and sorry I didn't notice that before!

Comment 33 Marek Polacek 2022-01-19 15:39:33 UTC
*** Bug 2042476 has been marked as a duplicate of this bug. ***

Comment 67 Jiri Jaburek 2022-02-10 18:44:47 UTC
So, bug 2042476 was closed as a duplicate of this one, but shortly after this one was fixed/verified, I started seeing

  redhat-rpm-config: Both plugins exist, checking version information
  redhat-rpm-config: Both plugin version files exist - comparing...
  redhat-rpm-config: Annobin plugin built by gcc gcc-11.2.1-7.5.el9.x86_64
  redhat-rpm-config: GCC     plugin built by gcc gcc-11.2.1-9.1.el9.x86_64
  redhat-rpm-config: Versions differ - using gcc-built plugin
  redhat-rpm-config: Installing gcc version of redhat-annobin-cc1

when installing redhat-rpm-config.

Could that be related to this BZ or is that just a coincidence?

Thanks,
Jiri

Comment 68 Václav Kadlčík 2022-02-11 05:33:05 UTC
(In reply to Jiri Jaburek from comment #67)
> So, bug 2042476 was closed as a duplicate of this one, but shortly after
> this one was fixed/verified, I started seeing
> 
>   redhat-rpm-config: Both plugins exist, checking version information
>   redhat-rpm-config: Both plugin version files exist - comparing...
>   redhat-rpm-config: Annobin plugin built by gcc gcc-11.2.1-7.5.el9.x86_64
>   redhat-rpm-config: GCC     plugin built by gcc gcc-11.2.1-9.1.el9.x86_64
>   redhat-rpm-config: Versions differ - using gcc-built plugin
>   redhat-rpm-config: Installing gcc version of redhat-annobin-cc1
> 
> when installing redhat-rpm-config.
> 
> Could that be related to this BZ or is that just a coincidence?

Yes, it's related.

#c0 describes a problem of syncing gcc and annobin and proposes
a solution, refined in the follow-up comments and which is still
in process of implementation.

In short, there would be two annobin plugins, one as we know it
(annobin.rpm) and another as part of gcc (gcc-plugin-annobin.rpm).
redhat-rpm-config would select (by maintaining a symlink) which
of the two would be used by gcc when run in rpmbuild.

Technically, this ticket (bz2030667) keeps track of introducing
gcc-plugin-annobin.rpm. Another ticket - bz2030671 - keeps track
of the redhat-rpm-config side of implementation. What you observed
is debugging output of the latter, specifically output of

  http://pkgs.devel.redhat.com/cgit/rpms/redhat-rpm-config/tree/redhat-annobin-plugin-select.sh?h=rhel-9.0.0

Please note that bz2030671 is still in progress. I suppose Nick
will disable or minimize the debugging output once the
implementation settles down. I plan to request it but we are not
at that point, unfortunately.

I hope this briefly answers your question. Nick, please correct
me if there's something wrong in my answer.

Comment 69 Nick Clifton 2022-02-11 12:52:41 UTC
(In reply to Václav Kadlčík from comment #68)

> I hope this briefly answers your question. Nick, please correct
> me if there's something wrong in my answer.

No - that is all correct.  I had actually planned to disable the 
debugging output from redhat-rpm-config when the patch was committed
and only enable it if I had to debug a problem.  But it looks like
I forgot to do so.  Silly me.  

I will turn it off in a week or so unless someone complains before that.

Cheers
  Nick

PS
  It is nice to see that the new system is working...

Comment 71 errata-xmlrpc 2022-05-17 15:55:42 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 (new packages: gcc), 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-2022:3966