Skip to content

tests: [workaround] containerd 2.2 SELinux mmap denial for container images#676

Merged
bfjelds merged 2 commits into
mainfrom
user/bfjelds/containerd-selinux-mmap-fix
Jun 8, 2026
Merged

tests: [workaround] containerd 2.2 SELinux mmap denial for container images#676
bfjelds merged 2 commits into
mainfrom
user/bfjelds/containerd-selinux-mmap-fix

Conversation

@bfjelds

@bfjelds bfjelds commented Jun 8, 2026

Copy link
Copy Markdown
Member

Summary

containerd 2.2+ introduces a MountManager plugin that mmap()s a bbolt DB under /run/containerd/. The AZL 3.0 SELinux policy (refpolicy RELEASE_2_20240226) grants manage_file_perms on container_runtime_t:file which does not include the map permission, causing a cascade failure that surfaces as:

\
docker: Error response from daemon: failed to create task for container:
unknown service containerd.services.tasks.v1.Tasks: not implemented
\\

Upstream refpolicy fixed this in commit [\7876e51510](https://github.com/SELinuxProject/refpolicy/commit/7876e51510) (May 2024), but AZL's pinned version predates it.

Validation

https://dev.azure.com/mariner-org/ECF/_build/results?buildId=1134778

AZL bug

https://microsoft.visualstudio.com/OS/_workitems/edit/62602180

Changes

  • Add a CIL policy module (containerd-mmap-fix.cil) that grants the missing map permission on container_runtime_t:file for container_engine_system_domain
  • Add selinux-policy package to both container images
  • Load the CIL module during image build via a postCustomization script
  • Applied to both trident-container-installer and trident-container-testimage

Note: Existing workarounds (enforcing=0 kernel param on installer, setenforce 0 in testimage service) are intentionally kept in place. They should be removed in a follow-up PR after this fix is validated.

Related

bfjelds and others added 2 commits June 8, 2026 08:55
…ages

containerd 2.2+ introduces a MountManager plugin that mmap()s a bbolt DB
under /run/containerd/. The AZL 3.0 SELinux policy (refpolicy
RELEASE_2_20240226) grants manage_file_perms on container_runtime_t:file
which does not include the 'map' permission, causing a cascade failure
that surfaces as 'unknown service containerd.services.tasks.v1.Tasks'.

Add a CIL policy module that backports the upstream fix (refpolicy commit
7876e51510) to grant the missing 'map' permission. Apply it to both
container-installer and container-testimage via postCustomization.

Changes:
- Add containerd-mmap-fix.cil and load-containerd-selinux-fix.sh to both
  container-installer and container-testimage
- Install selinux-policy package in both images
- Remove enforcing=0 kernel param from container-installer
- Remove setenforce 0 workaround from container-testimage service file
  (resolves bug #9508 TODO)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep existing SELinux workarounds in place. The CIL policy fix is
additive — removing the workarounds should be a separate step after
validation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@bfjelds bfjelds changed the title tests/images: fix containerd 2.2 SELinux mmap denial for container images tests: [workaround] containerd 2.2 SELinux mmap denial for container images Jun 8, 2026
@bfjelds bfjelds marked this pull request as ready for review June 8, 2026 16:44
@bfjelds bfjelds requested a review from a team as a code owner June 8, 2026 16:44
Copilot AI review requested due to automatic review settings June 8, 2026 16:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a targeted SELinux policy backport/workaround for Azure Linux’s pinned refpolicy version so containerd 2.2+ can mmap() its MountManager bbolt DB under /run/containerd/ without SELinux map denials, preventing downstream container engine failures in enforcing mode.

Changes:

  • Adds a small CIL policy module granting map on container_runtime_t:file to container_engine_system_domain.
  • Ensures selinux-policy is present in both container images and stages the CIL module into the image filesystem.
  • Loads the module during image build via a new postCustomization script for both the installer and test image.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/images/trident-container-testimage/base/scripts/load-containerd-selinux-fix.sh Installs the CIL module during the image build customization phase.
tests/images/trident-container-testimage/base/files/containerd-mmap-fix.cil Defines the minimal SELinux allow rule granting map for the affected type/domain pair.
tests/images/trident-container-testimage/base/baseimg.yaml Installs selinux-policy, stages the CIL file, and runs the loader script during build.
tests/images/trident-container-installer/base/scripts/load-containerd-selinux-fix.sh Installs the same CIL module during the installer image build customization phase.
tests/images/trident-container-installer/base/files/containerd-mmap-fix.cil Same SELinux CIL allow rule for the installer image.
tests/images/trident-container-installer/base/baseimg.yaml Installs selinux-policy, stages the CIL file, and runs the loader script during build.

@bfjelds bfjelds merged commit 2cf4256 into main Jun 8, 2026
97 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants