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 2090711 - [RHEL8.6/PCP/Bug] SELinux AVC when pmda bcc is enabled
Summary: [RHEL8.6/PCP/Bug] SELinux AVC when pmda bcc is enabled
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: selinux-policy
Version: 8.6
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: rc
: 8.8
Assignee: Zdenek Pytela
QA Contact: Milos Malik
Mirek Jahoda
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-05-26 12:17 UTC by Rajesh Dulhani
Modified: 2023-05-16 18:48 UTC (History)
8 users (show)

Fixed In Version: selinux-policy-3.14.3-110.el8
Doc Type: Bug Fix
Doc Text:
.`selinux-policy` now allows `pmcd` to execute its private `memfd:` objects Previously, the SELinux policy did not allow the `pmcd` process from the Performance Co-Pilot (PCP) framework to execute its private memory file-system objects (`memfd:`). Consequently, SELinux denied the Performance Metric Domain Agent (PMDA) BPF Compiler Collection (BCC) service to execute `memfd:` objects. In this update, the SELinux policy contains new rules for `pcmd`. As a result, `pmcd` can now execute `memfd:` objects with SELinux in enforcing mode.
Clone Of:
Environment:
Last Closed: 2023-05-16 09:03:44 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github fedora-selinux selinux-policy pull 1220 0 None open Allow pcp_domain execute its private memfd: objects 2022-06-02 08:52:29 UTC
Red Hat Issue Tracker RHELPLAN-123456 0 None None None 2022-05-26 12:43:57 UTC
Red Hat Product Errata RHBA-2023:2965 0 None None None 2023-05-16 09:04:03 UTC

Description Rajesh Dulhani 2022-05-26 12:17:17 UTC
Description of problem:

After our unit test suite is run we have seen an SELinux AVC of the PCP process when the PMDA bcc is enabled.

The AVC is seen every time the pmcd process is restarted

We have seen the issue only on AWS (using a t3.small instance type), but not yet Azure or VMWare, but that might be just luck.


Steps to Reproduce:

[cb/AWS] hoici@ip-10-215-229-191:~$ sudo  sealert -l 06b9a194-0d5e-4863-9dc7-3363357439a7

SELinux is preventing /usr/libexec/platform-python3.6 from execute access on the file /memfd:libffi (deleted).

*****  Plugin restorecon (99.5 confidence) suggests   ************************

If you want to fix the label.
/memfd:libffi (deleted) default label should be etc_runtime_t.
Then you can run restorecon. The access attempt may have been stopped due to insufficient permissions to access a parent directory in which case try to change the following command accordingly.
Do
# /sbin/restorecon -v /memfd:libffi (deleted)

*****  Plugin catchall (1.49 confidence) suggests   **************************

If you believe that platform-python3.6 should be allowed execute access on the memfd:libffi (deleted) 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:
# ausearch -c 'python3' --raw | audit2allow -M my-python3
# semodule -X 300 -i my-python3.pp


Additional Information:
Source Context                system_u:system_r:pcp_pmcd_t:s0
Target Context                system_u:object_r:pcp_tmpfs_t:s0
Target Objects                /memfd:libffi (deleted) [ file ]
Source                        python3
Source Path                   /usr/libexec/platform-python3.6
Port                          <Unknown>
Host                          ip-10-215-229-191.eu-west-1.compute.internal
Source RPM Packages           platform-python-3.6.8-45.el8.x86_64
Target RPM Packages
SELinux Policy RPM            selinux-policy-targeted-3.14.3-95.el8.noarch
Local Policy RPM              selinux-policy-targeted-3.14.3-95.el8.noarch
Selinux Enabled               True
Policy Type                   targeted
Enforcing Mode                Enforcing
Host Name                     ip-10-215-229-191.eu-west-1.compute.internal
Platform                      Linux ip-10-215-229-191.eu-west-1.compute.internal
                              4.18.0-372.9.1.el8.x86_64 #1 SMP Fri Apr 15
                              22:12:19 EDT 2022 x86_64 x86_64
Alert Count                   4
First Seen                    2022-05-20 11:51:41 UTC
Last Seen                     2022-05-20 12:51:14 UTC
Local ID                      06b9a194-0d5e-4863-9dc7-3363357439a7

Raw Audit Messages
type=AVC msg=audit(1653051074.880:2331328): avc:  denied  { execute } for  pid=2067963 comm="python3" path=2F6D656D66643A6C6962666669202864656C6574656429 dev="tmpfs" ino=13527843 scontext=system_u:system_r:pcp_pmcd_t:s0 tcontext=system_u:object_r:pcp_tmpfs_t:s0 tclass=file permissive=0

type=SYSCALL msg=audit(1653051074.880:2331328): arch=x86_64 syscall=mmap success=no exit=EACCES a0=0 a1=1000 a2=5 a3=1 items=0 ppid=2067954 pid=2067963 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=python3 exe=/usr/libexec/platform-python3.6 subj=system_u:system_r:pcp_pmcd_t:s0 key=(null)

Hash: python3,pcp_pmcd_t,pcp_tmpfs_t,file,execute

[cb/AWS] hoici@ip-10-215-229-191:~$


Actual results:

~~~
PCP pmda bcc might not work
~~~

Expected results:

~~~
PCP pmda bcc should work
~~~

Comment 2 Zdenek Pytela 2022-10-20 14:19:03 UTC
Commit to backport:
commit be552a81762e2b9520e91808b96deeb679b15c9f
Author: Zdenek Pytela <zpytela>
Date:   Thu Jun 2 10:40:42 2022 +0200

    Allow pcp_domain execute its private memfd: objects

Comment 14 errata-xmlrpc 2023-05-16 09:03:44 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 (selinux-policy 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-2023:2965


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