Bug 1875340
| Summary: | ffi_closure_alloc() fails when /tmp, /var/tmp and /dev/shm are mounted with "noexec" | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 8 | Reporter: | Renaud Métrich <rmetrich> |
| Component: | libffi | Assignee: | DJ Delorie <dj> |
| Status: | CLOSED ERRATA | QA Contact: | Dennis Brendel <dbrendel> |
| Severity: | high | Docs Contact: | Petr Hybl <phybl> |
| Priority: | high | ||
| Version: | 8.2 | CC: | codonell, dbrendel, dj, fweimer, jvaldez, phybl |
| Target Milestone: | rc | Keywords: | Patch, Triaged |
| Target Release: | 8.0 | Flags: | pm-rhel:
mirror+
|
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | libffi-3.1-23.el8 | Doc Type: | Enhancement |
| Doc Text: |
.New location for pass:q[`libffi`]'s self-modifying code
With this update pass:q[`libffi`]'s self-modifying code takes advantage of a feature in the RHEL 8 kernel to create a suitable file independent of any file system. As a result, pass:q[`libffi`]'s self-modifying code no longer depends on making part of the filesystem insecure.
|
Story Points: | --- |
| Clone Of: | Environment: | ||
| Last Closed: | 2022-05-10 15:24:02 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: | |||
|
Description
Renaud Métrich
2020-09-03 11:11:34 UTC
Unfortunately, this is a consequence of how JIT support works with SELinux. We have a conceptual draft for an ABI-compatible version of libffi that does not require run-time code generation, but there's nothing yet that can be tested. As of libffi-3.1-22.el8 we will allow systems to set the LIBFFI_TMPDIR environment variable to specify a libffi-specific directory which *does* have the required permissions on it, for when the "normal" temp directories are hardened. While we continue to research a better way to handle libffi closures, this workaround is our current answer to this particular problem. This LIBFFI_TMPDIR environment will not really help in the customer's scenario when all tmpfs filesystems and /dev/shm have "noexec" flag. Indeed, services won't be able to use LIBFFI_TMPDIR unless it's somehow hardcoded in their environment. We can do that by modifying default's environment (using "systemctl set-environment" command) to include LIBFFI_TMPDIR and additionally set up a special mount for this. Hence I think we need to involve systemd maintainers as well to come up with a transparent solution. IMHO a real solution for services would be to be able to mount a private tmpfs as /tmp and /var/tmp, which isn't possible yet, there is no systemd properties for that: there is only PrivateTmp=true which basically unshares /tmp and /var/tmp, hence will inherit the "noexec" flag. We are investigating the possibility of using memfd_create() as a potential workaround for filesystems that lack exec support. This may take some time and some upstream work. When applying DISA STIG profile at installation time, the profile automatically sets "noexec" to /tmp, /var/tmp and /dev/shm, hence this is a real problem here:
Kickstart sample:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
# Disk partitioning information
part /boot --fstype="xfs"
part pv.24 --fstype="lvmpv" --noformat
volgroup VolGroup --noformat --useexisting
logvol /tmp --fstype="xfs" --useexisting --name=tmp --vgname=VolGroup
logvol /var/log --fstype="xfs" --useexisting --name=log --vgname=VolGroup
logvol /var --fstype="xfs" --useexisting --name=var --vgname=VolGroup
logvol /home --fstype="xfs" --useexisting --name=home --vgname=VolGroup
logvol /var/log/audit --fstype="xfs" --useexisting --name=audit --vgname=VolGroup
logvol swap --fstype="swap" --size=2048 --useexisting --resize --name=swap --vgname=VolGroup
logvol /var/tmp --fstype="xfs" --useexisting --name=vartmp --vgname=VolGroup
logvol / --fstype="xfs" --size=8192 --useexisting --resize --name=root --vgname=VolGroup
%addon org_fedora_oscap
content-type = scap-security-guide
profile = xccdf_org.ssgproject.content_profile_stig
%end
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
Resulting /etc/fstab options:
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
/dev/mapper/VolGroup-tmp /tmp xfs defaults,nosuid,noexec,nodev 0 0
/dev/mapper/VolGroup-vartmp /var/tmp xfs defaults,noexec,nodev,nosuid 0 0
tmpfs /dev/shm tmpfs defaults,relatime,nodev,noexec,nosuid 0 0
-------- 8< ---------------- 8< ---------------- 8< ---------------- 8< --------
Accidentially overwrote doc text 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 (libffi 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:2054 |