|
| 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 | + |
0 commit comments