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.
This bug was initially created as a copy of Bug #1756005
Description of problem:
When trying to execute dracut as a service, we can see ldconfig fails due to not being able to read/write files from dracut's temporary directory used as its chroot.
This happens while "ldconfig -r /var/tmp/dracut..." is executed:
/usr/sbin/dracut:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
1628 if ! ldconfig -r "$initdir"; then
1629 if [[ $EUID = 0 ]]; then
1630 derror "ldconfig exited ungracefully"
1631 else
1632 derror "ldconfig might need uid=0 (root) for chroot()"
1633 fi
1634 fi
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
It appears that the policy is missing many rules to allow this (and IMHO this should be allowed, it's perfectly legit to rebuild automatically the initramfs based on some custom trigger):
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
module my-ldconfig 1.0;
require {
type initrc_tmp_t;
type netutils_t;
type ldconfig_t;
class fifo_file write;
class dir { add_name read remove_name write };
class file { create map rename setattr };
}
#============= ldconfig_t ==============
allow ldconfig_t initrc_tmp_t:dir { add_name read remove_name write };
allow ldconfig_t initrc_tmp_t:fifo_file write;
#!!!! This avc can be allowed using the boolean 'domain_can_mmap_files'
allow ldconfig_t initrc_tmp_t:file map;
allow ldconfig_t initrc_tmp_t:file { create rename setattr };
#============= netutils_t ==============
allow netutils_t initrc_tmp_t:fifo_file write;
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
Note that the "netutils_t" rule is needed for giving back the hostname to ldconfig:
well, not so sure, on RHEL7 it was "hostname_t", but now it seems it's arping which is called for that task.
Version-Release number of selected component (if applicable):
selinux-policy-3.14.1-61.el8_0.2.noarch
How reproducible:
Always
Steps to Reproduce:
1. Create a service calling dracut
# cat > /etc/systemd/system/dracut.service << EOF
[Service]
Type=oneshot
ExecStart=/bin/bash -c "dracut -f /boot/initramfs-$(uname -r).img $(uname -r)"
EOF
# systemctl daemon-reload
2. Execute the service
# systemctl start dracut
Actual results:
AVCs
Expected results:
No AVC
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, 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-2020:1773