Skip to content

Commit 909159a

Browse files
authored
selinux-policy: Add cloud-utils-growpart tmpfs fix. (#12872)
Signed-off-by: Chris PeBenito <chpebeni@linux.microsoft.com>
1 parent db8dbfe commit 909159a

2 files changed

Lines changed: 46 additions & 9 deletions

File tree

SPECS/selinux-policy/0036-fstools-Add-additional-perms-for-cloud-utils-growpar.patch

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
From b9d020a7a6ec6a9f63f53c461c84ac88ea32c1d5 Mon Sep 17 00:00:00 2001
1+
From 35bea40b88739358a0f8e5a104e7cb1180e20f8b Mon Sep 17 00:00:00 2001
22
From: Chris PeBenito <chpebeni@linux.microsoft.com>
33
Date: Tue, 6 Aug 2024 11:35:33 -0400
44
Subject: [PATCH 36/37] fstools: Add additional perms for cloud-utils-growpart.
@@ -7,10 +7,11 @@ Missed in previous growpart patch due to testing errors.
77

88
Signed-off-by: Chris PeBenito <chpebeni@linux.microsoft.com>
99
---
10-
policy/modules/admin/cloudinit.if | 38 +++++++++++++++++++++++++++++++
11-
policy/modules/system/fstools.fc | 2 ++
12-
policy/modules/system/fstools.te | 14 ++++++++++--
13-
3 files changed, 52 insertions(+), 2 deletions(-)
10+
policy/modules/admin/cloudinit.if | 38 +++++++++++++++++++++++++++++
11+
policy/modules/kernel/filesystem.if | 20 +++++++++++++++
12+
policy/modules/system/fstools.fc | 2 ++
13+
policy/modules/system/fstools.te | 16 ++++++++++--
14+
4 files changed, 74 insertions(+), 2 deletions(-)
1415

1516
diff --git a/policy/modules/admin/cloudinit.if b/policy/modules/admin/cloudinit.if
1617
index 6d427e771..25e94729e 100644
@@ -65,6 +66,37 @@ index 6d427e771..25e94729e 100644
6566
+ files_search_tmp($1)
6667
+ manage_files_pattern($1, cloud_init_tmp_t, cloud_init_tmp_t)
6768
+')
69+
diff --git a/policy/modules/kernel/filesystem.if b/policy/modules/kernel/filesystem.if
70+
index 2f5412c30..f6ba45dd2 100644
71+
--- a/policy/modules/kernel/filesystem.if
72+
+++ b/policy/modules/kernel/filesystem.if
73+
@@ -5552,6 +5552,26 @@ interface(`fs_getattr_tmpfs',`
74+
allow $1 tmpfs_t:filesystem getattr;
75+
')
76+
77+
+########################################
78+
+## <summary>
79+
+## Do not audit attempts to get the attributes of a tmpfs
80+
+## filesystem.
81+
+## </summary>
82+
+## <param name="domain">
83+
+## <summary>
84+
+## Domain to not audit.
85+
+## </summary>
86+
+## </param>
87+
+## <rolecap/>
88+
+#
89+
+interface(`fs_dontaudit_getattr_tmpfs',`
90+
+ gen_require(`
91+
+ type tmpfs_t;
92+
+ ')
93+
+
94+
+ dontaudit $1 tmpfs_t:filesystem getattr;
95+
+')
96+
+
97+
########################################
98+
## <summary>
99+
## Allow the type to associate to tmpfs filesystems.
68100
diff --git a/policy/modules/system/fstools.fc b/policy/modules/system/fstools.fc
69101
index 63423802d..0fa9fb5c0 100644
70102
--- a/policy/modules/system/fstools.fc
@@ -86,10 +118,10 @@ index 63423802d..0fa9fb5c0 100644
86118
/usr/sbin/install-mbr -- gen_context(system_u:object_r:fsadm_exec_t,s0)
87119
/usr/sbin/jfs_.* -- gen_context(system_u:object_r:fsadm_exec_t,s0)
88120
diff --git a/policy/modules/system/fstools.te b/policy/modules/system/fstools.te
89-
index d5e090c28..18a42890c 100644
121+
index d5e090c28..49fc02b2c 100644
90122
--- a/policy/modules/system/fstools.te
91123
+++ b/policy/modules/system/fstools.te
92-
@@ -201,8 +201,18 @@ optional_policy(`
124+
@@ -201,8 +201,20 @@ optional_policy(`
93125
')
94126

95127
optional_policy(`
@@ -98,6 +130,8 @@ index d5e090c28..18a42890c 100644
98130
+ cloudinit_manage_tmp_files(fsadm_t)
99131
+ cloudinit_manage_tmp_dirs(fsadm_t)
100132
+
133+
+ fs_dontaudit_getattr_tmpfs(fsadm_t)
134+
+
101135
+ optional_policy(`
102136
+ # cloud-utils-growpart
103137
+ lvm_domtrans(fsadm_t)
@@ -111,5 +145,5 @@ index d5e090c28..18a42890c 100644
111145

112146
optional_policy(`
113147
--
114-
2.46.0
148+
2.48.1
115149

SPECS/selinux-policy/selinux-policy.spec

Lines changed: 4 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: 9%{?dist}
12+
Release: 10%{?dist}
1313
License: GPLv2
1414
Vendor: Microsoft Corporation
1515
Distribution: Azure Linux
@@ -328,6 +328,9 @@ exit 0
328328
selinuxenabled && semodule -nB
329329
exit 0
330330
%changelog
331+
* Thu Mar 06 2025 Chris PeBenito <chpebeni@microsoft.com> - 2.20240226-10
332+
- Add tmpfs fix for cloud-utils-growpart.
333+
331334
* Wed Nov 20 2024 George Mileka <gmileka@microsoft.com> - 2.20240226-9
332335
- Enable SELinux for LiveOS ISO.
333336

0 commit comments

Comments
 (0)