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 2081131 - annobin: Workaround for libc_nonshared.a no longer effective.
Summary: annobin: Workaround for libc_nonshared.a no longer effective.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: annobin
Version: 9.1
Hardware: All
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Nick Clifton
QA Contact: Václav Kadlčík
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-05-02 20:13 UTC by Carlos O'Donell
Modified: 2023-07-18 14:25 UTC (History)
6 users (show)

Fixed In Version: annobin-10.68-1.el9
Doc Type: No Doc Update
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-11-15 09:52:25 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-120811 0 None None None 2022-05-02 20:15:26 UTC
Red Hat Product Errata RHBA-2022:7957 0 None None None 2022-11-15 09:52:30 UTC

Description Carlos O'Donell 2022-05-02 20:13:38 UTC
In glibc we need to workaround annobin annotations in libc_nonshared.a.

We do this workaround like this:
1394 # libc_nonshared.a cannot be built with the default hardening flags
1395 # because the glibc build system is incompatible with
1396 # -D_FORTIFY_SOURCE.  The object files need to be marked as to be
1397 # skipped in annobin annotations.  (The -specs= variant of activating
1398 # annobin does not work here because of flag ordering issues.)
1399 # See <https://bugzilla.redhat.com/show_bug.cgi?id=1668822>.
1400 BuildFlagsNonshared="-fplugin=annobin -fplugin-arg-annobin-disable -Wa,--generate-missing-build-notes=yes"

In glibc-2.34-29.el9 the build of atexit generates a correct note:
annobin-10.58-1.el9.x86_64 1647268214 1077646 3a6efa6eea1bd1fab072741a5bcbae69 installed
gcc-plugin-annobin-11.2.1-9.4.el9.x86_64 1644551076 53682 5f9e7264a7b89b0dd199b7497d560d8e installed

In glibc-2.34-32.el9 the build of atexit generates a missing note:
annobin-10.58-1.el9.x86_64 1647268214 1077646 3a6efa6eea1bd1fab072741a5bcbae69 installed
gcc-plugin-annobin-11.3.1-2.el9.x86_64 1650922467 53690 9ee9f9ea07b4002cdafcd4f8635ffa3c installed

The -32 build results in the following CI/CD failure:

Hardened: ./atexit_strp: FAIL: fortify test because -D_FORTIFY_SOURCE=2 was not present on the command line (function: atexit) 
Hardened: ./atexit_strp: info: For more information visit: https://sourceware.org/annobin/annobin.html/Test-fortify.html
Hardened: ./atexit_strp: PASS: glibcxx-assertions test 
Hardened: ./atexit_strp: PASS: pic test 
Hardened: ./atexit_strp: FAIL: fortify test because -D_FORTIFY_SOURCE=2 was not present on the command line (function: atexit) 
Hardened: ./atexit_strp: info: For more information visit: https://sourceware.org/annobin/annobin.html/Test-fortify.html

Did something change between gcc-plugin-annobin-11.2.1-9.4.el9.x86_64 and gcc-plugin-annobin-11.3.1-2.el9.x86_64?

The test case is fairly straight forward:

cat >> atexit.c <<EOF
#define _GNU_SOURCE
#include <stdlib.h>
#include <stdio.h>

int main()
{
    /* Print the address of the functions, to force an non-inline copy
       of these functions from libc_nonshared.a into the link.  */
    printf ("%p\n", atexit);
    return 0;
}
EOF
gcc -v -O2 -g -Wl,-z,now -pie -fpie -Wa,--generate-missing-build-notes=yes -fcf-protection atexit.c -o atexit &> gcc-atexit.txt
strip -g -o atexit_strp atexit
annocheck -v atexit_strp | grep FAIL

This worked with glibc-2.34-29.el9 build and fails now with -32, and we didn't change anything specifically in the area of libc_nonshared.a and atexit handling.

The -29 libc_nonshared.a (glibc-devel) is fairly empty. While the -32 libc_nonshared.a has a lot of annobin notes present.

Comment 3 Nick Clifton 2022-05-06 13:40:17 UTC
Fixed in annobin-10.68-1.el9

Comment 8 errata-xmlrpc 2022-11-15 09:52: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-2022:7957


Note You need to log in before you can comment on or make changes to this bug.