Skip to content

CRI-O CI broken due to SELinux AVC Denials with latest runc (main branch) build #274

Closed
@sohankunkerkar

Description

@sohankunkerkar

Problem Statement:

For the past few days, the CRI-O CI has been encountering severe issues on both Fedora 36 and RHEL 9.2. Upon investigation, SELinux AVC denials have been identified as the root cause.

----
type=AVC msg=audit(09/29/2023 18:15:50.768:23214) : avc:  denied  { map } for  pid=246169 comm=4 path=/memfd:runc_cloned:runc-dmz (deleted) dev="tmpfs" ino=420 scontext=system_u:system_r:container_t:s0:c4,c5 tcontext=unconfined_u:object_r:container_runtime_tmpfs_t:s0 tclass=file permissive=1 
----
type=AVC msg=audit(09/29/2023 18:15:50.770:23215) : avc:  denied  { read } for  pid=246169 comm=4 path=/memfd:runc_cloned:runc-dmz (deleted) dev="tmpfs" ino=420 scontext=system_u:system_r:container_t:s0:c4,c5 tcontext=unconfined_u:object_r:container_runtime_tmpfs_t:s0 tclass=file permissive=1 
----
type=AVC msg=audit(09/29/2023 18:15:50.770:23216) : avc:  denied  { execute } for  pid=246169 comm=4 path=/memfd:runc_cloned:runc-dmz (deleted) dev="tmpfs" ino=420 scontext=system_u:system_r:container_t:s0:c4,c5 tcontext=unconfined_u:object_r:container_runtime_tmpfs_t:s0 tclass=file permissive=1 
----
type=AVC msg=audit(09/29/2023 18:16:15.850:23337) : avc:  denied  { entrypoint } for  pid=247148 comm=runc:[2:INIT] path=/memfd:runc_cloned:runc-dmz (deleted) dev="tmpfs" ino=421 scontext=system_u:system_r:container_t:s0:c4,c5 tcontext=unconfined_u:object_r:container_runtime_tmpfs_t:s0 tclass=file permissive=1 
----

Setting SELinux to permissive mode resolves the issue.

The following command was used to identify the necessary permissions.

$ sudo grep AVC /var/log/audit/audit.log | audit2allow


#============= container_t ==============
allow container_t container_runtime_tmpfs_t:file { entrypoint execute read };

#!!!! This avc can be allowed using the boolean 'domain_can_mmap_files'
allow container_t container_runtime_tmpfs_t:file map;
allow container_t proc_t:filesystem associate;

#!!!! This avc is a constraint violation.  You would need to modify the attributes of either the source or target types to allow this access.
#Constraint rule: 
#	mlsconstrain file { ioctl read lock execute execute_no_trans } ((h1 dom h2 -Fail-)  or (t1 != mcs_constrained_type -Fail-) ); Constraint DENIED
mlsconstrain file { write setattr append unlink link rename } ((h1 dom h2 -Fail-)  or (t1 != mcs_constrained_type -Fail-) ); Constraint DENIED

#	Possible cause is the source level (s0) and target level (s0:c31,c1005) are different.
allow container_t self:file read;

The problem appears to be related to a recent update in the main branch of runc, specifically in the pull request: opencontainers/runc#3987. According to the runc maintainer, an intermediate binary was added which requires additional permissions to fix this issue.

Expected Behavior:

CRI-O CI tests should run successfully without encountering SELinux AVC denials.

Additional Information:

Operating System: Fedora 36, RHEL 9.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions