Skip to contentSkip to conversation

secilc: Fix policy optimization test

PATCH In review Petr Lautrbach 2 participants 3 messages May 13, 2020 – May 15, 2020 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 secilc: Fix policy optimization test

Commit 692716fc5fd5 ("libsepol/cil: raise default attrs_expand_size to 2") was reverted and attributes with one type are not expanded anymore.

Fixes:

    ./secilc test/policy.cil
    ./secilc -c 32 -O -M 1 -f /dev/null -o opt-actual.bin test/opt-input.cil
    checkpolicy -b -C -M -o opt-actual.cil opt-actual.bin >/dev/null
    diff test/opt-expected.cil opt-actual.cil
    11a12
    > (typeattribute at01)
    21a23
    > (typeattributeset at01 (tp01))
    25c27,28
    < (allow tp01 self (cl01 (p01a p01b p11a p11b)))
    ---
    > (allow tp01 at01 (cl01 (p11b)))
    > (allow tp01 self (cl01 (p01a p01b p11a)))
---
 secilc/test/opt-expected.cil | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
secilc/test/opt-expected.cil +4 -1
index 73ac9045f23e..14033f9be4dd 100644
@@ -9,6 +9,7 @@
 (category c01)
 (categoryorder (c01))
 (sensitivitycategory s01 (c01))
+(typeattribute at01)
 (typeattribute at02)
 (boolean b01 false)
 (type tp01)
@@ -19,10 +20,12 @@
 (type tpr3)
 (type tpr4)
 (type tpr5)
+(typeattributeset at01 (tp01))
 (typeattributeset at02 (tp01 tp02))
 (allow at02 tpr1 (cl01 (p01a p01b p11a)))
 (allow at02 tpr3 (cl01 (p01a p01b p11a)))
-(allow tp01 self (cl01 (p01a p01b p11a p11b)))
+(allow tp01 at01 (cl01 (p11b)))
+(allow tp01 self (cl01 (p01a p01b p11a)))
 (allow tp01 tpr1 (cl01 (p11b)))
 (dontaudit at02 tpr2 (cl01 (p01a p01b p11a)))
 (dontaudit at02 tpr4 (cl01 (p01a p01b p11a)))
Signature · 1 line
2.26.2
Acked-by on v1 1/1
#1 lore raw
Quoted 19 lines · Petr Lautrbach

Commit 692716fc5fd5 ("libsepol/cil: raise default attrs_expand_size to 2") was reverted and attributes with one type are not expanded anymore.

Fixes:

    ./secilc test/policy.cil
    ./secilc -c 32 -O -M 1 -f /dev/null -o opt-actual.bin test/opt-input.cil
    checkpolicy -b -C -M -o opt-actual.cil opt-actual.bin >/dev/null
    diff test/opt-expected.cil opt-actual.cil
    11a12
    > (typeattribute at01)
    21a23
    > (typeattributeset at01 (tp01))
    25c27,28
    < (allow tp01 self (cl01 (p01a p01b p11a p11b)))
    ---
    > (allow tp01 at01 (cl01 (p11b)))
    > (allow tp01 self (cl01 (p01a p01b p11a)))
Quoted 1 line
Quoted 33 lines
---
 secilc/test/opt-expected.cil | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
secilc/test/opt-expected.cil +4 -2
index 73ac9045f23e..14033f9be4dd 100644
@@ -9,6 +9,7 @@
 (category c01)
 (categoryorder (c01))
 (sensitivitycategory s01 (c01))
+(typeattribute at01)
 (typeattribute at02)
 (boolean b01 false)
 (type tp01)
@@ -19,10 +20,12 @@
 (type tpr3)
 (type tpr4)
 (type tpr5)
+(typeattributeset at01 (tp01))
 (typeattributeset at02 (tp01 tp02))
 (allow at02 tpr1 (cl01 (p01a p01b p11a)))
 (allow at02 tpr3 (cl01 (p01a p01b p11a)))
-(allow tp01 self (cl01 (p01a p01b p11a p11b)))
+(allow tp01 at01 (cl01 (p11b)))
+(allow tp01 self (cl01 (p01a p01b p11a)))
 (allow tp01 tpr1 (cl01 (p11b)))
 (dontaudit at02 tpr2 (cl01 (p01a p01b p11a)))
 (dontaudit at02 tpr4 (cl01 (p01a p01b p11a)))
--

2.26.2

author Applied
#2 lore raw
Quoted 20 lines · James Carter
Quoted 19 lines · Petr Lautrbach

Commit 692716fc5fd5 ("libsepol/cil: raise default attrs_expand_size to 2") was reverted and attributes with one type are not expanded anymore.

Fixes:

    ./secilc test/policy.cil
    ./secilc -c 32 -O -M 1 -f /dev/null -o opt-actual.bin test/opt-input.cil
    checkpolicy -b -C -M -o opt-actual.cil opt-actual.bin >/dev/null
    diff test/opt-expected.cil opt-actual.cil
    11a12
    > (typeattribute at01)
    21a23
    > (typeattributeset at01 (tp01))
    25c27,28
    < (allow tp01 self (cl01 (p01a p01b p11a p11b)))
    ---
    > (allow tp01 at01 (cl01 (p11b)))
    > (allow tp01 self (cl01 (p01a p01b p11a)))
Quoted 3 lines
Quoted 1 line

Applied.

Quoted 34 lines
Quoted 33 lines
---
 secilc/test/opt-expected.cil | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
secilc/test/opt-expected.cil +4 -2
index 73ac9045f23e..14033f9be4dd 100644
@@ -9,6 +9,7 @@
 (category c01)
 (categoryorder (c01))
 (sensitivitycategory s01 (c01))
+(typeattribute at01)
 (typeattribute at02)
 (boolean b01 false)
 (type tp01)
@@ -19,10 +20,12 @@
 (type tpr3)
 (type tpr4)
 (type tpr5)
+(typeattributeset at01 (tp01))
 (typeattributeset at02 (tp01 tp02))
 (allow at02 tpr1 (cl01 (p01a p01b p11a)))
 (allow at02 tpr3 (cl01 (p01a p01b p11a)))
-(allow tp01 self (cl01 (p01a p01b p11a p11b)))
+(allow tp01 at01 (cl01 (p11b)))
+(allow tp01 self (cl01 (p01a p01b p11a)))
 (allow tp01 tpr1 (cl01 (p11b)))
 (dontaudit at02 tpr2 (cl01 (p01a p01b p11a)))
 (dontaudit at02 tpr4 (cl01 (p01a p01b p11a)))
--

2.26.2

Signature · 2 lines
()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments