Skip to content

Commit edbe92e

Browse files
Merge PR "[AUTO-CHERRYPICK] selinux-policy: allow container engines to mmap runtime files - branch 3.0-dev" microsoft#17645
Signed-off-by: Aadhar Agarwal <aadagarwal@microsoft.com> Co-authored-by: aadhar-agarwal <108542189+aadhar-agarwal@users.noreply.github.com>
1 parent b00e3e6 commit edbe92e

2 files changed

Lines changed: 53 additions & 1 deletion

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
From ba2452a126593a2c65ef08e2b24cf3870537e9a2 Mon Sep 17 00:00:00 2001
2+
From: Kenton Groombridge <concord@gentoo.org>
3+
Date: Mon, 6 May 2024 16:38:43 -0400
4+
Subject: [PATCH] container: allow system container engines to mmap runtime
5+
files
6+
7+
Backport of upstream refpolicy commit 7876e515103f9e13b861132bb26c72e0a2821159:
8+
https://github.com/SELinuxProject/refpolicy/commit/7876e515103f9e13b861132bb26c72e0a2821159
9+
10+
containerd 2.2 introduces a MountManager plugin that opens a bbolt
11+
database under /run/containerd/ (labeled container_runtime_t). bbolt
12+
uses mmap() to memory-map the database file. The current policy only
13+
grants manage_file_perms for container_runtime_t:file, which does not
14+
include the map permission required for mmap().
15+
16+
Without this fix, SELinux denies the mmap call, causing MountManager
17+
plugin initialization to fail. This cascades through the plugin
18+
dependency chain (MountManager -> TaskManager -> Tasks service),
19+
resulting in the Tasks gRPC service never being registered. Docker
20+
then fails with:
21+
"unknown service containerd.services.tasks.v1.Tasks: not implemented"
22+
23+
Change manage_file_perms to mmap_manage_file_perms, which adds the
24+
map permission needed for mmap() operations on runtime files.
25+
26+
Signed-off-by: Kenton Groombridge <concord@gentoo.org>
27+
---
28+
policy/modules/services/container.te | 2 +-
29+
1 file changed, 1 insertion(+), 1 deletion(-)
30+
31+
diff --git a/policy/modules/services/container.te b/policy/modules/services/container.te
32+
index 096d6c2..9699ac3 100644
33+
--- a/policy/modules/services/container.te
34+
+++ b/policy/modules/services/container.te
35+
@@ -866,7 +866,7 @@ filetrans_pattern(container_engine_system_domain, container_var_lib_t, container
36+
filetrans_pattern(container_engine_system_domain, container_var_lib_t, container_file_t, dir, "volumes")
37+
38+
allow container_engine_system_domain container_runtime_t:dir { manage_dir_perms relabel_dir_perms watch };
39+
-allow container_engine_system_domain container_runtime_t:file { manage_file_perms relabel_file_perms watch };
40+
+allow container_engine_system_domain container_runtime_t:file { mmap_manage_file_perms relabel_file_perms watch };
41+
allow container_engine_system_domain container_runtime_t:fifo_file { manage_fifo_file_perms relabel_fifo_file_perms };
42+
allow container_engine_system_domain container_runtime_t:lnk_file { manage_lnk_file_perms relabel_lnk_file_perms };
43+
allow container_engine_system_domain container_runtime_t:sock_file { manage_sock_file_perms relabel_sock_file_perms };
44+
--
45+
2.43.0
46+

SPECS/selinux-policy/selinux-policy.spec

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
Summary: SELinux policy
1010
Name: selinux-policy
1111
Version: %{refpolicy_major}.%{refpolicy_minor}
12-
Release: 12%{?dist}
12+
Release: 13%{?dist}
1313
License: GPLv2
1414
Vendor: Microsoft Corporation
1515
Distribution: Azure Linux
@@ -57,6 +57,7 @@ Patch35: 0035-rpm-Run-systemd-sysctl-from-post.patch
5757
Patch36: 0036-fstools-Add-additional-perms-for-cloud-utils-growpar.patch
5858
Patch37: 0037-docker-Fix-dockerc-typo-in-container_engine_executab.patch
5959
Patch38: 0038-enable-liveos-iso-flow.patch
60+
Patch39: 0039-container-allow-mmap-runtime-files.patch
6061
Patch41: 0041-rpm-Allow-gpg-agent-run-in-rpm-scripts-to-watch-secr.patch
6162
BuildRequires: bzip2
6263
BuildRequires: checkpolicy >= %{CHECKPOLICYVER}
@@ -329,6 +330,11 @@ exit 0
329330
selinuxenabled && semodule -nB
330331
exit 0
331332
%changelog
333+
* Fri Jun 05 2026 Aadhar Agarwal <aadagarwal@microsoft.com> - 2.20240226-13
334+
- Backport upstream refpolicy fix to allow system container engines to mmap
335+
runtime files (container_runtime_t:file map), fixing containerd 2.2
336+
MountManager initialization failure under SELinux enforcing.
337+
332338
* Thu Aug 18 2025 Chris PeBenito <chpebeni@microsoft.com> - 2.20240226-12
333339
- Include policy.kern otherwise some semanage operations fail without it.
334340

0 commit comments

Comments
 (0)