All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpolicy: Check for mls constraint expression in non-mls policy
@ 2026-08-31 15:12 James Carter
  0 siblings, 0 replies; only message in thread
From: James Carter @ 2026-08-31 15:12 UTC (permalink / raw)
  To: selinux; +Cc: stephen.smalley.work, James Carter

In a constraint expresison 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>
---
 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] only message in thread

only message in thread, other threads:[~2026-08-31 15:12 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31 15:12 [PATCH] checkpolicy: Check for mls constraint expression in non-mls policy 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.