This bug has been migrated to another issue tracking site. It has been closed here and may no longer be being monitored.

If you would like to get updates for this issue, or to participate in it, you may do so at Red Hat Issue Tracker .
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 2230462 - avc: denied { execmod } for pid=335139 comm="sh" path="/bin/sh" dev="dm-4" ino=138505864 scontext=system_u:system_r:spc_t:s0 tcontext=system_u:object_r:container_ro_file_t:s0 tclass=file permissive=0
Summary: avc: denied { execmod } for pid=335139 comm="sh" path="/bin/sh" dev="dm-4"...
Keywords:
Status: CLOSED MIGRATED
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: container-selinux
Version: 9.2
Hardware: ppc64le
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Daniel Walsh
QA Contact: atomic-bugs@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2023-08-09 13:57 UTC by Jeremy Poulin
Modified: 2024-01-10 04:25 UTC (History)
11 users (show)

Fixed In Version: container-selinux-2.219.0-1.rhaos4.13.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2023-09-11 20:30:47 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)
openshift-test run-test output for previously failing testcase (8.39 KB, text/plain)
2023-08-15 21:18 UTC, Hiro Miyamoto
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker   RHEL-3158 0 None Migrated None 2023-09-11 20:30:53 UTC
Red Hat Issue Tracker RHELPLAN-165106 0 None None None 2023-08-09 13:59:05 UTC

Internal Links: 2231861

Description Jeremy Poulin 2023-08-09 13:57:42 UTC
Description of problem:
Since the 27th of July (for OpenShift 4.14), the versions of OpenShift running on an RHCOS based on RHEL 9.2 have been hitting this permission denied error when scheduling a privileged container.

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


How reproducible:
1. Deploy a nightly of OpenShift 4.12,4.13, or 4.14.
2. Run an openshift-test that schedules a privileged container. E.g.:
$ KUBE_TEST_REPO_LIST="" KUBE_TEST_REPO="quay.io/openshift/community-e2e-images" ./openshift-tests run-test '[sig-storage] In-tree Volumes [Driver: hostPath] [Testpattern: Inline-volume (default fs)] volumes should store data [Suite:openshift/conformance/parallel] [Suite:k8s]'
3. Monitor the journal logs on the worker for selinux errors


Actual results:
type=AVC msg=audit(1691587536.149:914): avc:  denied  { execmod } for  pid=335139 comm="sh" path="/bin/sh" dev="dm-4" ino=138505864 scontext=system_u:system_r:spc_t:s0 tcontext=system_u:object_r:container_ro_file_t:s0 tclass=file permissive=0


Expected results:
No avc errors.

Comment 1 Jeremy Poulin 2023-08-09 14:05:33 UTC
Device labels are:

sh-5.1# ls -Z | grep dm-
  system_u:object_r:fixed_disk_device_t:s0 dm-0
  system_u:object_r:fixed_disk_device_t:s0 dm-1
  system_u:object_r:fixed_disk_device_t:s0 dm-2
  system_u:object_r:fixed_disk_device_t:s0 dm-3
  system_u:object_r:fixed_disk_device_t:s0 dm-4
sh-5.1#

Comment 2 Jeremy Poulin 2023-08-09 17:45:15 UTC
This issue seems to have been introduced between the RHCOS releases:
"io.openshift.build.versions": "machine-os=414.92.202307261347-0"
"io.openshift.build.versions": "machine-os=414.92.202307270631-0"

Comment 3 Jeremy Poulin 2023-08-09 18:14:19 UTC
The specific updated packages in those builds where:
container-selinux	3:2.208.0-2.rhaos4.13.el9 → 3:2.215.0-2.rhaos4.13.el9
cri-o	1.27.1-3.rhaos4.14.gited2afb7.el9 → 1.27.1-4.rhaos4.14.gitab7845e.el9


So I suspect this issue is in: 3:2.215.0-2.rhaos4.13.el9

Comment 4 Daniel Walsh 2023-08-09 20:01:19 UTC
This is allowed in container-selinux 2.219

$ audit2allow  -i /tmp/t


#============= spc_t ==============

#!!!! This avc is allowed in the current policy
allow spc_t container_ro_file_t:file execmod;
apiv2 (mounts) $ rpm -q container-selinux
container-selinux-2.219.0-1.fc38.noarch

Comment 5 mkumatag 2023-08-10 10:39:30 UTC
came up with minimal pod spec to reproduce this bug

1 oc create namespace debug-selinux
2 oc adm policy add-scc-to-group privileged system:serviceaccounts:debug-selinux
3 oc adm policy add-scc-to-group anyuid system:serviceaccounts:debug-selinux
4 oc adm policy add-scc-to-group hostmount-anyuid system:serviceaccounts:debug-selinux
5 apply the following yaml

apiVersion: v1
kind: Pod
metadata:
  name: hostpath-pod
  namespace: debug-selinux
spec:
  # This will ensure to schedule the pod to the mentioned node to debug easily.
  nodeName: rdr-cicd-mon01-414-6mk65-worker-c5vk4
  containers:
  - command:
    - /bin/sh
    - -c
    - 'while true ; do sleep 2; done '
    image: quay.io/openshift/community-e2e-images:e2e-7-registry-k8s-io-e2e-test-images-busybox-1-29-4-4zE9mRvED4RQoUxQ
    imagePullPolicy: IfNotPresent
    name: hostpath-pod
    securityContext:
      privileged: true
  restartPolicy: Always


Pod logs:

% oc logs hostpath-pod -n debug-selinux
/bin/sh: error while loading shared libraries: cannot restore segment prot after reloc: Permission denied


Audit logs

$ ausearch -m AVC,USER_AVC,SELINUX_ERR,USER_SELINUX_ERR -ts recent -i
----
type=PROCTITLE msg=audit(08/10/23 10:36:01.111:2909) : proctitle=/bin/sh -c while true ; do sleep 2; done
type=SYSCALL msg=audit(08/10/23 10:36:01.111:2909) : arch=ppc64le syscall=mprotect success=no exit=EACCES(Permission denied) a0=0x13c060000 a1=0x130000 a2=PROT_READ|PROT_EXEC a3=0x113250 items=0 ppid=1125323 pid=1125335 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=sh exe=/bin/sh subj=system_u:system_r:spc_t:s0 key=(null)
type=AVC msg=audit(08/10/23 10:36:01.111:2909) : avc:  denied  { execmod } for  pid=1125335 comm=sh path=/bin/sh dev="dm-4" ino=138505864 scontext=system_u:system_r:spc_t:s0 tcontext=system_u:object_r:container_ro_file_t:s0 tclass=file permissive=0


Observations:
- same pod is working fine in the x86 environment
- same pod works fine when use quay.io/centos/centos:stream9 image

Comment 6 Jindrich Novy 2023-08-10 16:15:21 UTC
Dan, can you please take a look at comment #5?

Comment 7 Jindrich Novy 2023-08-10 16:24:37 UTC
After discussion with Jeremy I'm going to update container-selinux to 2.219.0 as Dan mentions.

Comment 8 Jindrich Novy 2023-08-10 16:45:48 UTC
OCP 4.13 and up is now updated to container-selinux-2.219.0.

Comment 9 mkumatag 2023-08-11 00:29:40 UTC
Tested with patched rpm on the effected system and fix didn't work and still see the issue

----
type=PROCTITLE msg=audit(08/11/23 00:17:42.518:538) : proctitle=/bin/sh -c while true ; do sleep 2; done
type=SYSCALL msg=audit(08/11/23 00:17:42.518:538) : arch=ppc64le syscall=mprotect success=no exit=EACCES(Permission denied) a0=0x11ce10000 a1=0x130000 a2=PROT_READ|PROT_EXEC a3=0x113250 items=0 ppid=8942 pid=8954 auid=unset uid=root gid=root euid=root suid=root fsuid=root egid=root sgid=root fsgid=root tty=(none) ses=unset comm=sh exe=/bin/sh subj=system_u:system_r:spc_t:s0 key=(null)
type=AVC msg=audit(08/11/23 00:17:42.518:538) : avc:  denied  { execmod } for  pid=8954 comm=sh path=/bin/sh dev="dm-4" ino=138505864 scontext=system_u:system_r:spc_t:s0 tcontext=system_u:object_r:container_ro_file_t:s0 tclass=file permissive=0
sh-5.1# date -u
Fri Aug 11 00:18:45 UTC 2023


sh-5.1# rpm -qa | grep container-selinux
container-selinux-2.219.0-1.rhaos4.13.el9.noarch


sh-5.1# rpm-ostree status
State: idle
Deployments:
* ostree-unverified-registry:quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:a0f238c723c13d13f48231421e42b5063c92692e588a2f381572ffa33aca8d9c
                   Digest: sha256:a0f238c723c13d13f48231421e42b5063c92692e588a2f381572ffa33aca8d9c
                  Version: 414.92.202308080233-0 (2023-08-09T04:31:17Z)
           LocalOverrides: container-selinux 3:2.215.0-2.rhaos4.13.el9 -> 3:2.219.0-1.rhaos4.13.el9

sh-5.1# rpm -qi container-selinux-2.219.0-1.rhaos4.13.el9.noarch
Name        : container-selinux
Epoch       : 3
Version     : 2.219.0
Release     : 1.rhaos4.13.el9
Architecture: noarch
Install Date: Fri Aug 11 00:08:38 2023
Group       : Unspecified
Size        : 68308
License     : GPLv2
Signature   : (none)
Source RPM  : container-selinux-2.219.0-1.rhaos4.13.el9.src.rpm
Build Date  : Thu Aug 10 16:41:23 2023
Build Host  : x86-64-02.build.eng.rdu2.redhat.com
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor      : Red Hat, Inc.
URL         : https://github.com/containers/container-selinux
Summary     : SELinux policies for container runtimes
Description :
SELinux policy modules for use with container runtimes.
sh-5.1#

Comment 13 Mick Tarsel 2023-08-15 21:01:19 UTC
I installed the new container-selinux rpm on all of the worker nodes:

sh-5.1# rpm -qa | grep container-selin
container-selinux-2.221.0-1.el9.noarch

sh-5.1#  rpm-ostree status
State: idle
Deployments:
* ostree-unverified-registry:quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:a0f238c723c13d13f48231421e42b5063c92692e588a2f381572ffa33aca8d9c
                   Digest: sha256:a0f238c723c13d13f48231421e42b5063c92692e588a2f381572ffa33aca8d9c
                  Version: 414.92.202308080233-0 (2023-08-09T04:31:13Z)
           LocalOverrides: container-selinux 3:2.215.0-2.rhaos4.13.el9 -> 3:2.221.0-1.el9

Hiro executed the single e2e test and he did not observe any errors from the command line. I went thru the journal logs and did not see any "avc: denied" or related selinux errors after the e2e single test run.

This cluster is still available with the newer container-selinux rpm installed for investigation.

Comment 14 Hiro Miyamoto 2023-08-15 21:18:08 UTC
Created attachment 1983452 [details]
openshift-test run-test output for previously failing testcase

This ran *after* all worker nodes were upgraded with `container-selinux-2.221.0-1.el9.noarch.rpm`.

Comment 15 Jeremy Poulin 2023-08-16 14:24:51 UTC
Please see comments 13 & 14. As verification for the newest patch.

Comment 16 RHEL Program Management 2023-09-11 20:29:10 UTC
Issue migration from Bugzilla to Jira is in process at this time. This will be the last message in Jira copied from the Bugzilla bug.

Comment 17 RHEL Program Management 2023-09-11 20:30:47 UTC
This BZ has been automatically migrated to the issues.redhat.com Red Hat Issue Tracker. All future work related to this report will be managed there.

Due to differences in account names between systems, some fields were not replicated.  Be sure to add yourself to Jira issue's "Watchers" field to continue receiving updates and add others to the "Need Info From" field to continue requesting information.

To find the migrated issue, look in the "Links" section for a direct link to the new issue location. The issue key will have an icon of 2 footprints next to it, and begin with "RHEL-" followed by an integer.  You can also find this issue by visiting https://issues.redhat.com/issues/?jql= and searching the "Bugzilla Bug" field for this BZ's number, e.g. a search like:

"Bugzilla Bug" = 1234567

In the event you have trouble locating or viewing this issue, you can file an issue by sending mail to rh-issues. You can also visit https://access.redhat.com/articles/7032570 for general account information.

Comment 18 Red Hat Bugzilla 2024-01-10 04:25:31 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 120 days


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