From: James Carter <jwcart2@gmail.com>
To: selinux@vger.kernel.org
Cc: stephen.smalley.work@gmail.com, James Carter <jwcart2@gmail.com>
Subject: [PATCH v2] checkpolicy: Check for mls constraint expression in non-mls policy
Date: Mon, 31 Aug 2026 11:43:52 -0400 [thread overview]
Message-ID: <20260831154352.49412-1-jwcart2@gmail.com> (raw)
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
next reply other threads:[~2026-08-31 15:44 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 15:43 James Carter [this message]
2026-08-31 17:02 ` [PATCH v2] checkpolicy: Check for mls constraint expression in non-mls policy Stephen Smalley
2026-08-31 20:15 ` Stephen Smalley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260831154352.49412-1-jwcart2@gmail.com \
--to=jwcart2@gmail.com \
--cc=selinux@vger.kernel.org \
--cc=stephen.smalley.work@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.