Skip to contentSkip to conversation

libsepol/cil: raise default attrs_expand_size to 2

RFC PATCH Superseded Ondrej Mosnacek 2 participants 2 messages Mar 4, 2020 – Mar 5, 2020 SELinux security module

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 libsepol/cil: raise default attrs_expand_size to 2

Tne value attrs_expand_size == 1 removes all empty attributes, but it also makes sense to expand all attributes that have only one type. This removes some redundant rules (there is sometimes the same rule for the type and the attribute) and reduces the number of attributes that the kernel has to go through when looking up rules.

---
 libsepol/cil/src/cil.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
libsepol/cil/src/cil.c +2 -1
index d222ad3a..31380e8b 100644
@@ -452,7 +452,8 @@ void cil_db_init(struct cil_db **db)
 	(*db)->disable_dontaudit = CIL_FALSE;
 	(*db)->disable_neverallow = CIL_FALSE;
 	(*db)->attrs_expand_generated = CIL_FALSE;
-	(*db)->attrs_expand_size = 1;
+	/* 2 == remove attributes that cointain none or just 1 type */
+	(*db)->attrs_expand_size = 2;
 	(*db)->preserve_tunables = CIL_FALSE;
 	(*db)->handle_unknown = -1;
 	(*db)->mls = -1;
Signature · 1 line
2.24.1
maintainer
#1 lore raw
Quoted 17 lines · Ondrej Mosnacek

Tne value attrs_expand_size == 1 removes all empty attributes, but it also makes sense to expand all attributes that have only one type. This removes some redundant rules (there is sometimes the same rule for the type and the attribute) and reduces the number of attributes that the kernel has to go through when looking up rules.

---
 libsepol/cil/src/cil.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
libsepol/cil/src/cil.c +0 -0
index d222ad3a..31380e8b 100644

libsepol/cil/src/cil.c void cil_db_init(struct cil_db **db) · line 455

Quoted 5 lines
libsepol/cil/src/cil.c +1 -1
@@ -452,7 +452,8 @@ void cil_db_init(struct cil_db **db)
        (*db)->disable_dontaudit = CIL_FALSE;
        (*db)->disable_neverallow = CIL_FALSE;
        (*db)->attrs_expand_generated = CIL_FALSE;
-       (*db)->attrs_expand_size = 1;
+       /* 2 == remove attributes that cointain none or just 1 type */

s/cointain/contain/