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 1756005 - dracut/ldconfig cannot run as a service
Summary: dracut/ldconfig cannot run as a service
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: selinux-policy
Version: 7.7
Hardware: All
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Lukas Vrabec
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-09-26 14:55 UTC by Renaud Métrich
Modified: 2023-10-06 18:36 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-09-27 08:46:34 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Renaud Métrich 2019-09-26 14:55:58 UTC
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< --------
1543     if ! ldconfig -r "$initdir"; then
1544         if [[ $UID = 0 ]]; then
1545             derror "ldconfig exited ungracefully"
1546         else
1547             derror "ldconfig might need uid=0 (root) for chroot()"
1548         fi
1549     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 hostname_t;
	type initrc_tmp_t;
	type ldconfig_t;
	class fifo_file write;
	class lnk_file { getattr unlink create };
	class file { create rename setattr unlink };
	class dir { add_name remove_name read write };
}

#============= hostname_t ==============
allow hostname_t initrc_tmp_t:fifo_file write;

#============= ldconfig_t ==============
allow ldconfig_t initrc_tmp_t:dir { add_name remove_name read write };
allow ldconfig_t initrc_tmp_t:file { create rename setattr unlink };
allow ldconfig_t initrc_tmp_t:fifo_file write;
allow ldconfig_t initrc_tmp_t:lnk_file { getattr unlink create };
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------

Note that the "hostname_t" rule is needed for giving back the hostname to ldconfig.


Version-Release number of selected component (if applicable):

All, up to latest RHEL7 selinux-policy-3.13.1-252.el7.1.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

Comment 2 Renaud Métrich 2019-09-26 15:03:36 UTC
Lowering down Severity/Priority because the issue appears somehow harmless (an error message is printed but the initramfs seems to work, even through there is no "etc/ld.so.cache" file created in the initramfs).

Comment 3 Zdenek Pytela 2019-09-27 08:46:34 UTC
This issue was not selected to be included in Red Hat Enterprise Linux 7 because it is seen either as low or moderate impact to a small number of use-cases. The next minor release will be in Maintenance Support 1 Phase, which means that qualified Critical and Important Security errata advisories (RHSAs) and Urgent Priority Bug Fix errata advisories (RHBAs) may be released as they become available.

We will now close this issue, but if you believe that it qualifies for the Maintenance Support 1 Phase, please re-open; otherwise, we recommend moving the request to Red Hat Enterprise Linux 8 if applicable.


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