Skip to contentSkip to conversation

xen: Allow xenstored to map /proc/xen/xsd_kva

PATCH In review Anthony PERARD 2 participants 2 messages Oct 27, 2020 – Nov 5, 2020

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xen: Allow xenstored to map /proc/xen/xsd_kva

xenstored is using mmap() on /proc/xen/xsd_kva, and when the SELinux boolean "domain_can_mmap_files" in CentOS is set to false the mmap() call fails.

---
v2: Declare an interface instead of using allow in xen.te directly.

---
 policy/modules/kernel/filesystem.if | 18 ++++++++++++++++++
 policy/modules/system/xen.te        |  1 +
 2 files changed, 19 insertions(+)
policy/modules/kernel/filesystem.if +18 -0
index b52fc769236b..b85ae2f6e851 100644
@@ -5310,6 +5310,24 @@ interface(`fs_manage_xenfs_files',`
 	manage_files_pattern($1, xenfs_t, xenfs_t)
 ')
 
+########################################
+## <summary>
+##	Map files a XENFS filesystem.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`fs_mmap_xenfs_files',`
+	gen_require(`
+		type xenfs_t;
+	')
+
+	allow $1 xenfs_t:file map;
+')
+
 ########################################
 ## <summary>
 ##	Do not audit attempts to create,
policy/modules/system/xen.te +1 -0
index 2c95d0ca3bbd..82328cbbbaa3 100644
@@ -459,6 +459,7 @@ files_read_usr_files(xenstored_t)
 
 fs_search_xenfs(xenstored_t)
 fs_manage_xenfs_files(xenstored_t)
+fs_mmap_xenfs_files(xenstored_t)
 
 term_use_generic_ptys(xenstored_t)
 
Signature · 1 line
Anthony PERARD
#1 lore raw
Quoted 46 lines · Anthony PERARD

xenstored is using mmap() on /proc/xen/xsd_kva, and when the SELinux boolean "domain_can_mmap_files" in CentOS is set to false the mmap() call fails.

---
v2: Declare an interface instead of using allow in xen.te directly.

---
  policy/modules/kernel/filesystem.if | 18 ++++++++++++++++++
  policy/modules/system/xen.te        |  1 +
  2 files changed, 19 insertions(+)
policy/modules/kernel/filesystem.if +18 -0
index b52fc769236b..b85ae2f6e851 100644
@@ -5310,6 +5310,24 @@ interface(`fs_manage_xenfs_files',`
  	manage_files_pattern($1, xenfs_t, xenfs_t)
  ')
 
+########################################
+## <summary>
+##	Map files a XENFS filesystem.
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain allowed access.
+##	</summary>
+## </param>
+#
+interface(`fs_mmap_xenfs_files',`
+	gen_require(`
+		type xenfs_t;
+	')
+
+	allow $1 xenfs_t:file map;
+')
+
  ########################################
  ## <summary>
  ##	Do not audit attempts to create,
policy/modules/system/xen.te +0 -0
index 2c95d0ca3bbd..82328cbbbaa3 100644

policy/modules/system/xen.te files_read_usr_files(xenstored_t) · line 464

Quoted 6 lines
policy/modules/system/xen.te +1 -0
@@ -459,6 +459,7 @@ files_read_usr_files(xenstored_t)
 
  fs_search_xenfs(xenstored_t)
  fs_manage_xenfs_files(xenstored_t)
+fs_mmap_xenfs_files(xenstored_t)
 
  term_use_generic_ptys(xenstored_t)

Merged.

Signature · 1 line
Chris PeBenito