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 1151568 - libffi: should open NX bypass descriptor with O_CLOEXEC
Summary: libffi: should open NX bypass descriptor with O_CLOEXEC
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libffi
Version: 7.0
Hardware: x86_64
OS: Linux
unspecified
low
Target Milestone: rc
: ---
Assignee: Andrew Haley
QA Contact: Michael Petlan
URL:
Whiteboard:
Depends On:
Blocks: 1297579 1313485
TreeView+ depends on / blocked
 
Reported: 2014-10-10 17:30 UTC by Tomasz Konefal
Modified: 2016-11-04 05:04 UTC (History)
10 users (show)

Fixed In Version: libffi-3.0.13-18.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1971380 (view as bug list)
Environment:
Last Closed: 2016-11-04 05:04:33 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2016:2385 0 normal SHIPPED_LIVE libffi bug fix update 2016-11-03 13:53:20 UTC

Description Tomasz Konefal 2014-10-10 17:30:05 UTC
Description of problem:

sealert -l 9864c067-b7e7-406e-8e7c-2bf895c667be
SELinux is preventing /usr/sbin/xtables-multi from 'read, write' accesses on the file .

*****  Plugin leaks (86.2 confidence) suggests   *****************************

If you want to ignore xtables-multi trying to read write access the  file, because you believe it should not need this access.
Then you should report this as a bug.
You can generate a local policy module to dontaudit this access.
Do
# grep /usr/sbin/xtables-multi /var/log/audit/audit.log | audit2allow -D -M mypol
# semodule -i mypol.pp

*****  Plugin catchall (14.7 confidence) suggests   **************************

If you believe that xtables-multi should be allowed read write access on the  file by default.
Then you should report this as a bug.
You can generate a local policy module to allow this access.
Do
allow this access for now by executing:
# grep iptables /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp


Additional Information:
Source Context                system_u:system_r:iptables_t:s0
Target Context                system_u:object_r:firewalld_tmpfs_t:s0
Target Objects                 [ file ]
Source                        iptables
Source Path                   /usr/sbin/xtables-multi
Port                          <Unknown>
Host                          (removed)
Source RPM Packages           iptables-1.4.21-13.el7.x86_64
Target RPM Packages
Policy RPM                    selinux-policy-3.12.1-153.el7_0.11.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     (removed)
Platform                      Linux (removed)
                              3.10.0-123.8.1.el7.x86_64 #1 SMP Mon Aug 11
                              13:37:49 EDT 2014 x86_64 x86_64
Alert Count                   48
First Seen                    2014-09-19 15:36:04 PDT
Last Seen                     2014-10-10 10:04:04 PDT
Local ID                      9864c067-b7e7-406e-8e7c-2bf895c667be

Raw Audit Messages
type=AVC msg=audit(1412960644.974:505): avc:  denied  { read write } for  pid=1511 comm="ip6tables" path=2F6465762F73686D2F66666975614B66677A202864656C6574656429 dev="tmpfs" ino=20273 scontext=system_u:system_r:iptables_t:s0 tcontext=system_u:object_r:firewalld_tmpfs_t:s0 tclass=file


type=SYSCALL msg=audit(1412960644.974:505): arch=x86_64 syscall=execve success=yes exit=0 a0=12ec710 a1=12eded0 a2=146a840 a3=7fffe1b0bba0 items=2 ppid=830 pid=1511 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=ip6tables exe=/usr/sbin/xtables-multi subj=system_u:system_r:iptables_t:s0 key=(null)

type=CWD msg=audit(1412960644.974:505): cwd=/

type=PATH msg=audit(1412960644.974:505): item=0 name=/sbin/ip6tables inode=16992821 dev=fd:03 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:iptables_exec_t:s0 objtype=NORMAL

type=PATH msg=audit(1412960644.974:505): item=1 name=(null) inode=1988 dev=fd:03 mode=0100755 ouid=0 ogid=0 rdev=00:00 obj=system_u:object_r:ld_so_t:s0 objtype=NORMAL

Hash: iptables,iptables_t,firewalld_tmpfs_t,file,read,write


Additional info:
Not sure if this is relevant, but I have applied the CIS recommendations (v1.0) for RHEL7. In particular, there is a suggestion of tmpfs being involved.

# mount | grep tmpfs
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=498208k,nr_inodes=124552,mode=755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (rw,nosuid,nodev,noexec,seclabel,mode=755)
none on /run/shm type tmpfs (rw,nosuid,nodev,noexec,relatime,seclabel)

Comment 3 Miroslav Grepl 2015-04-27 14:18:36 UTC
This is a leak coming for firewalld.

Comment 4 Florian Weimer 2015-06-30 15:03:17 UTC
>>> base64.b16decode("2F6465762F73686D2F66666975614B66677A202864656C6574656429")
'/dev/shm/ffiuaKfgz (deleted)'

This is likely the NX bypass from libffi.  firewalld probably uses libffi-generated proxies for girepository access.

For background on the NX bypass with page aliasing, see <http://www.akkadia.org/drepper/selinux-mem.html> (last section).

Comment 5 Florian Weimer 2015-06-30 15:09:21 UTC
This is a libffi bug:

/* Open a temporary file name, and immediately unlink it.  */
static int
open_temp_exec_file_name (char *name)
{
  int fd = mkstemp (name);

  if (fd != -1)
    unlink (name);

  return fd;
}

It should use mkostemp with O_CLOEXEC.

Comment 6 Florian Weimer 2015-08-24 19:30:29 UTC
Already fixed upstream:

https://github.com/atgreen/libffi/commit/8daeed9570af72eb135c8ded460d2888f05b2e68

Comment 7 Deepak Bhole 2016-02-02 20:39:38 UTC
Already fixed upstream. Acking.

Comment 14 Michael Petlan 2016-06-24 11:45:11 UTC
Reproduced with libffi-3.0.13-16.el7 and passed with libffi-3.0.13-18.el7.

VERIFIED.

Comment 16 errata-xmlrpc 2016-11-04 05:04:33 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, 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://rhn.redhat.com/errata/RHBA-2016-2385.html


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