1From c6d1345732c463cb45d8ba490081ad92936bfd69 Mon Sep 17 00:00:00 2001
2From: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3Date: Tue, 28 Nov 2023 22:30:01 +0100
4Subject: [PATCH] policy/modules/services/smartmon.te: make fstools optional
5
6Make fstools optional to avoid the following build failure raised since
7version 2.20231002 and
8https://github.com/SELinuxProject/refpolicy/commit/cb068f09d224f90a97fa63a574fb423bbe1ceeda:
9
10 Compiling targeted policy.33
11 env LD_LIBRARY_PATH="/home/thomas/autobuild/instance-2/output-1/host/lib:/home/thomas/autobuild/instance-2/output-1/host/usr/lib" /home/thomas/autobuild/instance-2/output-1/host/usr/bin/checkpolicy -c 33 -U deny -S -O -E policy.conf -o policy.33
12 policy/modules/services/smartmon.te:146:ERROR 'type fsadm_exec_t is not within scope' at token ';' on line 237472:
13 	allow smartmon_update_drivedb_t fsadm_exec_t:file { { getattr open map read execute ioctl } ioctl lock execute_no_trans };
14 #line 146
15 checkpolicy:  error(s) encountered while parsing configuration
16 make[1]: *** [Rules.monolithic:80: policy.33] Error 1
17
18Fixes:
19 - http://autobuild.buildroot.org/results/a01123de9a8c1927060e7e4748666bebfc82ea44
20
21Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
22Upstream: https://github.com/SELinuxProject/refpolicy/pull/738
23---
24 policy/modules/services/smartmon.te | 4 +++-
25 1 file changed, 3 insertions(+), 1 deletion(-)
26
27diff --git a/policy/modules/services/smartmon.te b/policy/modules/services/smartmon.te
28index 32c80f712..761280c11 100644
29--- a/policy/modules/services/smartmon.te
30+++ b/policy/modules/services/smartmon.te
31@@ -143,7 +143,9 @@ corenet_tcp_connect_http_port(smartmon_update_drivedb_t)
32
33 files_read_etc_files(smartmon_update_drivedb_t)
34
35-fstools_exec(smartmon_update_drivedb_t)
36+optional_policy(`
37+	fstools_exec(smartmon_update_drivedb_t)
38+')
39
40 kernel_dontaudit_read_system_state(smartmon_update_drivedb_t)
41
42--
432.42.0
44
45