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 2232410

Summary: Installing gcc-toolset-12-binutils results in files with incorrect selinux context.
Product: Red Hat Enterprise Linux 8 Reporter: sgardner
Component: binutilsAssignee: Nick Clifton <nickc>
binutils sub component: gcc-toolset-13 QA Contact: Miloš Prchlík <mprchlik>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: unspecified CC: fweimer, mprchlik, peter.vreman
Version: 8.7Keywords: Bugfix, Triaged
Target Milestone: rcFlags: pm-rhel: mirror+
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: gcc-toolset-13-binutils-2.40-15.el8 Doc Type: No Doc Update
Doc Text:
Story Points: ---
Clone Of:
: 2236729 (view as bug list) Environment:
Last Closed: 2024-05-22 09:24:38 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: 2236729    

Description sgardner 2023-08-16 17:18:40 UTC
Description of problem:
When installing the gcc-toolset-11-binutils.  Files within directory "/opt/rh/gcc-toolset-12/root/usr/share/locale/" are created with incorrect context.

The files are expected to get context from gcc-toolset-12-runtime package which has an install script that creates the following selinux rule.
---------------------------------------------------------------------------------
if [ ! -f /opt/rh/gcc-toolset-12/root/etc/selinux-equiv.created ]; then
  /usr/sbin/semanage fcontext -a -e / /opt/rh/gcc-toolset-12/root
  restorecon -R /opt/rh/gcc-toolset-12/root
  touch /opt/rh/gcc-toolset-12/root/etc/selinux-equiv.created
fi
---------------------------------------------------------------------------------

I believe this fails because the context rule is created just before installing these files, and the rule has yet to be written to disk.  This can be avoided by simply installing gcc-toolset-12-runtime first, and then installing gcc-toolset-12-binutils in a separate command.

This is only reproduced when both packages are installed in the same yum command.




Version-Release number of selected component (if applicable):
gcc-toolset-12-binutils-2.38-16.el8.x86_64

NOTE- This is also reproduced on all available version in RHEL8.




How reproducible:
Easily


Steps to Reproduce:
1.# yum remove gcc-toolset-12-runtime
1.# yum install gcc-toolset-12-binutils
2.# restorecon -Rvn /opt/rh/gcc-toolset-12/root/


Actual results:
]# restorecon -Rvn /opt/rh/gcc-toolset-12
Would relabel /opt/rh/gcc-toolset-12/root/usr/lib64/bfd-plugins from system_u:object_r:usr_t:s0 to system_u:object_r:lib_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/bg from system_u:object_r:usr_t:s0 to system_u:object_r:locale_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/bg/LC_MESSAGES from system_u:object_r:usr_t:s0 to system_u:object_r:locale_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/bg/LC_MESSAGES/binutils.mo from system_u:object_r:usr_t:s0 to system_u:object_r:locale_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/bg/LC_MESSAGES/gprof.mo from system_u:object_r:usr_t:s0 to system_u:object_r:locale_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/bg/LC_MESSAGES/ld.mo from system_u:object_r:usr_t:s0 to system_u:object_r:locale_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/ca from system_u:object_r:usr_t:s0 to system_u:object_r:locale_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/ca/LC_MESSAGES from system_u:object_r:usr_t:s0 to system_u:object_r:locale_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/ca/LC_MESSAGES/binutils.mo from system_u:object_r:usr_t:s0 to system_u:object_r:locale_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/da from system_u:object_r:usr_t:s0 to system_u:object_r:locale_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/da/LC_MESSAGES from system_u:object_r:usr_t:s0 to system_u:object_r:locale_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/da/LC_MESSAGES/bfd.mo from system_u:object_r:usr_t:s0 to system_u:object_r:locale_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/da/LC_MESSAGES/binutils.mo from system_u:object_r:usr_t:s0 to system_u:object_r:locale_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/da/LC_MESSAGES/gprof.mo from system_u:object_r:usr_t:s0 to system_u:object_r:locale_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/da/LC_MESSAGES/ld.mo from system_u:object_r:usr_t:s0 to system_u:object_r:locale_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/da/LC_MESSAGES/opcodes.mo from system_u:object_r:usr_t:s0 to system_u:object_r:locale_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/de from system_u:object_r:usr_t:s0 to system_u:object_r:locale_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/de/LC_MESSAGES from system_u:object_r:usr_t:s0 to system_u:object_r:locale_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/de/LC_MESSAGES/gprof.mo from system_u:object_r:usr_t:s0 to system_u:object_r:locale_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/de/LC_MESSAGES/ld.mo from system_u:object_r:usr_t:s0 to system_u:object_r:locale_t:s0
Would relabel /opt/rh/gcc-toolset-12/root/usr/share/locale/de/LC_MESSAGES/opcodes.mo from system_u:object_r:usr_t:s0 to system_u:object_r:l





Expected results:
No relabelling required.




Additional info:
My opinion is to simply run restorecon on the offending directory within the postinstall script for package gcc-toolset-12-binutils.

Comment 1 Nick Clifton 2023-08-21 15:02:47 UTC
Given that there is a workaround for the problem - I am of the opinion that it would be better to fix this for GTS-13/ RHEL 8.10 rather than applying for an exception+ for GTS-12/RHEL-8.9.

Comment 2 Nick Clifton 2023-09-11 13:28:00 UTC
This should be fixed by gcc-toolset-13-binutils-2.40-15.el8.

Comment 4 Miloš Prchlík 2023-10-04 07:42:41 UTC
Bumping ITM - I did bump it Jira, but the bug has not been migrated yet, therefore it was the wrong place to update...

Comment 8 Miloš Prchlík 2023-10-13 07:23:17 UTC
Verified with gcc-toolset-13-binutils-2.40-15.el8:

:: [ 06:52:15 ] :: [  BEGIN   ] :: Running 'restorecon -Rvn /opt/rh/gcc-toolset-13/root'
:: [ 06:52:16 ] :: [   PASS   ] :: Command 'restorecon -Rvn /opt/rh/gcc-toolset-13/root' (Expected 0, got 0)
:: [ 06:52:16 ] :: [  BEGIN   ] :: Running 'grep 'Would relabel' /var/tmp/rlRun_LOG.5phDyowr'
:: [ 06:52:16 ] :: [   PASS   ] :: Command 'grep 'Would relabel' /var/tmp/rlRun_LOG.5phDyowr' (Expected 1, got 1)

Comment 10 errata-xmlrpc 2024-05-22 09:24:38 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 (gcc-toolset-13-binutils 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-2024:2977