Skip to content

Commit e8aa790

Browse files
author
Kemal Rasim Sh
committed
selinux: Add SEPolicy rules for CDI access
Allow container runtimes to access /etc/cdi so that Container Device Interface (CDI) configuration files can be loaded correctly. Without this access, runtimes such as containerd may fail with permission errors when attempting to monitor or read CDI specifications. Signed-off-by: Kemal Rasim Sh <kshakir@qti.qualcomm.com>
1 parent 6aacb7f commit e8aa790

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
From 9ff44d61ab0e41a9bcdb30bbaf8654e037db85a5 Mon Sep 17 00:00:00 2001
2+
From: Kemal Rasim Sh <kshakir@qti.qualcomm.com>
3+
Date: Tue, 16 Jun 2026 17:37:41 +0300
4+
Subject: [PATCH 1/1] container: Allow access to /etc/cdi for CDI configuration
5+
6+
Containerd requires access to /etc/cdi to load Container Device
7+
Interface (CDI) configuration files. Without proper permissions,
8+
containers fail to read the CDI specs, resulting in errors such as:
9+
10+
CDI: error associated with spec file /etc/cdi:
11+
failed to monitor for changes: permission denied
12+
13+
avc: denied { watch } for pid=918 comm="containerd"
14+
path="/etc/cdi" dev="sda2" ino=1566137 scontext=system_u:system_r:dockerd
15+
type=SYSCALL msg=audit(83241.927:148): arch=c00000b7 syscall=27
16+
success=no exit=-13 a0=9 a1=6c64631b2870 a2=fc6 a3=0 items=0 ppid=1
17+
pid=918 auid=4294967295 uid=0 gtype=PROCTITLE msg=audit(83241.927:148):
18+
proctitle="/usr/bin/containerd"
19+
20+
Upstream-Status: Backport [https://github.com/SELinuxProject/refpolicy/pull/1163]
21+
22+
Signed-off-by: Kemal Rasim Sh <kshakir@qti.qualcomm.com>
23+
---
24+
policy/modules/services/container.fc | 1 +
25+
1 file changed, 1 insertion(+)
26+
27+
diff --git a/policy/modules/services/container.fc b/policy/modules/services/container.fc
28+
index 010387a3a..812b46cee 100644
29+
--- a/policy/modules/services/container.fc
30+
+++ b/policy/modules/services/container.fc
31+
@@ -40,6 +40,7 @@ HOME_DIR/\.docker(/.*)? gen_context(system_u:object_r:container_conf_home_t,s0)
32+
33+
/etc/containers(/.*)? gen_context(system_u:object_r:container_config_t,s0)
34+
/etc/cni(/.*)? gen_context(system_u:object_r:container_config_t,s0)
35+
+/etc/cdi(/.*)? gen_context(system_u:object_r:container_config_t,s0)
36+
/etc/docker(/.*)? gen_context(system_u:object_r:container_config_t,s0)
37+
/etc/containerd(/.*)? gen_context(system_u:object_r:container_config_t,s0)
38+
39+
--
40+
2.43.0
41+
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
2+
3+
SRC_URI:append:qcom = " \
4+
file://0001-container-Allow-access-to-etc-cdi-for-CDI-configurat.patch \
5+
"

0 commit comments

Comments
 (0)