Skip to contentSkip to conversation

selinux_getattr patch

PATCH Daniel J Walsh 2 participants 3 messages Mar 23, 2007 – Apr 11, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

Some apps doing a getattr of all files in / generate avc messages on /selinux

This patch removes those avc's.

policy/modules/kernel/selinux.if +38 -0
@@ -51,6 +51,44 @@
 
 ########################################
 ## <summary>
+##	Do not audit attempts to get the
+##	attributes of the selinuxfs filesystem
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain to not audit.
+##	</summary>
+## </param>
+#
+interface(`selinux_dontaudit_getattr_fs',`
+	gen_require(`
+		type security_t;
+	')
+
+	dontaudit $1 security_t:filesystem getattr;
+')
+
+########################################
+## <summary>
+##	Allow domain to get the
+##	attributes of the selinuxfs filesystem
+## </summary>
+## <param name="domain">
+##	<summary>
+##	Domain to not audit.
+##	</summary>
+## </param>
+#
+interface(`selinux_getattr_fs',`
+	gen_require(`
+		type security_t;
+	')
+
+	allow $1 security_t:filesystem getattr;
+')
+
+########################################
+## <summary>
 ##	Search selinuxfs.
 ## </summary>
 ## <param name="domain">
policy/modules/system/selinuxutil.if +3 -1
@@ -616,7 +616,7 @@
 	gen_require(`
 		type selinux_config_t;
 	')
-
+	selinux_dontaudit_getattr_fs($1)
 	dontaudit $1 selinux_config_t:dir search;
 	dontaudit $1 selinux_config_t:file { getattr read };
 ')
@@ -637,6 +637,8 @@
 		type selinux_config_t;
 	')
 
+	selinux_getattr_fs($1)
+
 	files_search_etc($1)
 	allow $1 selinux_config_t:dir list_dir_perms;
 	read_files_pattern($1,selinux_config_t,selinux_config_t)
#1 lore raw
Quoted 4 lines · Daniel J Walsh

Some apps doing a getattr of all files in / generate avc messages on /selinux

This patch removes those avc's.

This looks more like something to do with the libselinux constructor. Perhaps we should have interfaces for selinux aware programs, for allowing and dontauditing the constructor, at least.

Quoted 78 lines

differences
between files
attachment
(selinux_getattr.patch), "selinux_getattr.patch"

policy/modules/kernel/selinux.if 2007-03-22 15:06:58.000000000 -0400 renamed from policy/modules/kernel/selinux.if 2007-02-27 14:37:10.000000000 -0500 +38 -0
@@ -51,6 +51,44 @@
 
 ########################################
 ## <summary>
+##     Do not audit attempts to get the
+##     attributes of the selinuxfs filesystem
+## </summary>
+## <param name="domain">
+##     <summary>
+##     Domain to not audit.
+##     </summary>
+## </param>
+#
+interface(`selinux_dontaudit_getattr_fs',`
+       gen_require(`
+               type security_t;
+       ')
+
+       dontaudit $1 security_t:filesystem getattr;
+')
+
+########################################
+## <summary>
+##     Allow domain to get the
+##     attributes of the selinuxfs filesystem
+## </summary>
+## <param name="domain">
+##     <summary>
+##     Domain to not audit.
+##     </summary>
+## </param>
+#
+interface(`selinux_getattr_fs',`
+       gen_require(`
+               type security_t;
+       ')
+
+       allow $1 security_t:filesystem getattr;
+')
+
+########################################
+## <summary>
 ##     Search selinuxfs.
 ## </summary>
 ## <param name="domain">
policy/modules/system/selinuxutil.if 2007-03-22 15:06:59.000000000 -0400 renamed from policy/modules/system/selinuxutil.if 2007-01-02 12:57:49.000000000 -0500 +3 -1
@@ -616,7 +616,7 @@
        gen_require(`
                type selinux_config_t;
        ')
-
+       selinux_dontaudit_getattr_fs($1)
        dontaudit $1 selinux_config_t:dir search;
        dontaudit $1 selinux_config_t:file { getattr read };
 ')
@@ -637,6 +637,8 @@
                type selinux_config_t;
        ')
 
+       selinux_getattr_fs($1)
+
        files_search_etc($1)
        allow $1 selinux_config_t:dir list_dir_perms;
        read_files_pattern($1,selinux_config_t,selinux_config_t)
Signature · 9 lines
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#2 lore raw
Quoted 5 lines · Christopher J. PeBenito
Quoted 3 lines · Daniel J Walsh

Some apps doing a getattr of all files in / generate avc messages on /selinux

Quoted 8 lines
Quoted 2 lines

This patch removes those avc's.

This looks more like something to do with the libselinux constructor. Perhaps we should have interfaces for selinux aware programs, for allowing and dontauditing the constructor, at least.

This works for me.

Quoted 70 lines
Quoted 70 lines

differences
between files
attachment
(selinux_getattr.patch), "selinux_getattr.patch"

policy/modules/kernel/selinux.if 2007-03-22 15:06:58.000000000 -0400 renamed from policy/modules/kernel/selinux.if 2007-02-27 14:37:10.000000000 -0500 +38 -0
@@ -51,6 +51,44 @@
 
 ########################################
 ## <summary>
+##     Do not audit attempts to get the
+##     attributes of the selinuxfs filesystem
+## </summary>
+## <param name="domain">
+##     <summary>
+##     Domain to not audit.
+##     </summary>
+## </param>
+#
+interface(`selinux_dontaudit_getattr_fs',`
+       gen_require(`
+               type security_t;
+       ')
+
+       dontaudit $1 security_t:filesystem getattr;
+')
+
+########################################
+## <summary>
+##     Allow domain to get the
+##     attributes of the selinuxfs filesystem
+## </summary>
+## <param name="domain">
+##     <summary>
+##     Domain to not audit.
+##     </summary>
+## </param>
+#
+interface(`selinux_getattr_fs',`
+       gen_require(`
+               type security_t;
+       ')
+
+       allow $1 security_t:filesystem getattr;
+')
+
+########################################
+## <summary>
 ##     Search selinuxfs.
 ## </summary>
 ## <param name="domain">
policy/modules/system/selinuxutil.if 2007-03-22 15:06:59.000000000 -0400 renamed from policy/modules/system/selinuxutil.if 2007-01-02 12:57:49.000000000 -0500 +1 -1
@@ -616,7 +616,7 @@
        gen_require(`
                type selinux_config_t;
        ')
-
+       selinux_dontaudit_getattr_fs($1)
        dontaudit $1 selinux_config_t:dir search;
        dontaudit $1 selinux_config_t:file { getattr read };
 ')
@@ -637,6 +637,8 @@
                type selinux_config_t;
        ')
 
Quoted 7 lines

policy/modules/system/selinuxutil.if 2007-03-22 15:06:59.000000000 -0400 line 644

Quoted 7 lines
policy/modules/system/selinuxutil.if 2007-03-22 15:06:59.000000000 -0400 renamed from policy/modules/system/selinuxutil.if 2007-01-02 12:57:49.000000000 -0500 +2 -0
+       selinux_getattr_fs($1)
+
        files_search_etc($1)
        allow $1 selinux_config_t:dir list_dir_perms;
        read_files_pattern($1,selinux_config_t,selinux_config_t)

--
This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.