All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] libsepol/cil: Allow lists in constraint expressions
@ 2021-03-16 20:46 James Carter
  2021-03-16 20:46 ` [PATCH 2/4] secilc/docs: Lists are now allowed " James Carter
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: James Carter @ 2021-03-16 20:46 UTC (permalink / raw)
  To: selinux; +Cc: James Carter

The expectation in CIL was to use user, role, or type attributes in
constraint expressions. The problem is that neither user nor role
attributes are part of the kernel binary policy, so when converting
from a kernel policy to CIL, that would require the creation of a
role or user attribute. The better solution is to just allow a list
to be used. In fact, the only thing preventing a list to be used
is a check in cil_verify_constraint_leaf_expr_syntax().

Remove the check and allow lists in constraint expressions.

The following is now allowed:
  (constrain (CLASS1 (PERM1)) (eq r1 (ROLE1 ROLE2 ROLE_ATTR3)))

Signed-off-by: James Carter <jwcart2@gmail.com>
---
 libsepol/cil/src/cil_verify.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/libsepol/cil/src/cil_verify.c b/libsepol/cil/src/cil_verify.c
index 6706e219..09e3daf9 100644
--- a/libsepol/cil/src/cil_verify.c
+++ b/libsepol/cil/src/cil_verify.c
@@ -225,9 +225,6 @@ int cil_verify_constraint_leaf_expr_syntax(enum cil_flavor l_flavor, enum cil_fl
 				cil_log(CIL_ERR, "u3, r3, and t3 can only be used with (mls)validatetrans rules\n");
 				goto exit;
 			}
-		} else if (r_flavor == CIL_LIST) {
-			cil_log(CIL_ERR, "t1, t2, r1, r2, u1, u2 cannot be used on the left side with a list on the right side\n");
-			goto exit;
 		}
 	} else {
 		if (r_flavor == CIL_CONS_U2) {
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-03-18 14:16 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16 20:46 [PATCH 1/4] libsepol/cil: Allow lists in constraint expressions James Carter
2021-03-16 20:46 ` [PATCH 2/4] secilc/docs: Lists are now allowed " James Carter
2021-03-16 20:46 ` [PATCH 3/4] libsepol: Enclose identifier lists in CIL " James Carter
2021-03-16 20:46 ` [PATCH 4/4] libsepol: Write "NO_IDENTIFIER" for empty CIL constraint expression James Carter
2021-03-16 21:45   ` Nicolas Iooss
2021-03-17 14:04     ` James Carter
2021-03-17  9:31 ` [PATCH 1/4] libsepol/cil: Allow lists in constraint expressions Nicolas Iooss
2021-03-18 14:15   ` James Carter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.