All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] checkpolicy: Check for mls constraint expression in non-mls policy
@ 2026-08-31 15:43 James Carter
  2026-08-31 17:02 ` Stephen Smalley
  0 siblings, 1 reply; 3+ messages in thread
From: James Carter @ 2026-08-31 15:43 UTC (permalink / raw)
  To: selinux; +Cc: stephen.smalley.work, James Carter

In a constraint expression l1, l2, h1, and h2 all refer to levels
and should only appear in mls policies.

Return an error if a mls constraint expression is found in a non-
mls policy.

Signed-off-by: James Carter <jwcart2@gmail.com>
---
v2: Fix typo in commit message.

 checkpolicy/policy_define.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/checkpolicy/policy_define.c b/checkpolicy/policy_define.c
index 30157826..1984c52f 100644
--- a/checkpolicy/policy_define.c
+++ b/checkpolicy/policy_define.c
@@ -4055,6 +4055,12 @@ uintptr_t define_cexpr(uint32_t expr_type, uintptr_t arg1, uintptr_t arg2)
 		e1->next = expr;
 		return arg1;
 	case CEXPR_ATTR:
+		if (!mlspol && (arg1 >= CEXPR_L1L2)) {
+			yyerror("MLS constraint expression "
+				"in non-MLS configuration");
+			constraint_expr_destroy(expr);
+			return 0;
+		}
 		expr->attr = arg1;
 		expr->op = arg2;
 		return (uintptr_t)expr;
-- 
2.55.0


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

end of thread, other threads:[~2026-08-31 20:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31 15:43 [PATCH v2] checkpolicy: Check for mls constraint expression in non-mls policy James Carter
2026-08-31 17:02 ` Stephen Smalley
2026-08-31 20:15   ` Stephen Smalley

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.