All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/5] selinux: bounds-check filename transition source types at load
@ 2026-09-03 11:35 Christian Göttsche
  2026-09-03 11:35 ` [PATCH 3/5] selinux: bounds-check role and user membership bitmaps " Christian Göttsche
                   ` (5 more replies)
  0 siblings, 6 replies; 17+ messages in thread
From: Christian Göttsche @ 2026-09-03 11:35 UTC (permalink / raw)
  To: selinux
  Cc: Paul Moore, Stephen Smalley, Ondrej Mosnacek,
	Christian Göttsche

From: Christian Göttsche <cgzones@googlemail.com>

filename_trans_read_helper() validates the target type, target class and
each datum's otype, but the per-datum stypes ebitmap is read without any
bound on its set bits.
Reject a stypes bitmap whose highest set bit is not a defined type.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
 security/selinux/ss/policydb.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/security/selinux/ss/policydb.c b/security/selinux/ss/policydb.c
index 3451a0295cc2..1a60d0f4be55 100644
--- a/security/selinux/ss/policydb.c
+++ b/security/selinux/ss/policydb.c
@@ -2367,6 +2367,10 @@ static int filename_trans_read_helper(struct policydb *p, struct policy_file *fp
 		if (rc)
 			goto out;
 
+		rc = -EINVAL;
+		if (ebitmap_get_highest_set_bit(&datum->stypes) >= p->p_types.nprim)
+			goto out;
+
 		rc = next_entry(buf, fp, sizeof(u32));
 		if (rc)
 			goto out;
-- 
2.55.0


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

end of thread, other threads:[~2026-09-04 12:10 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-03 11:35 [PATCH 2/5] selinux: bounds-check filename transition source types at load Christian Göttsche
2026-09-03 11:35 ` [PATCH 3/5] selinux: bounds-check role and user membership bitmaps " Christian Göttsche
2026-09-03 11:55   ` sashiko-bot
2026-09-03 13:50   ` Stephen Smalley
2026-09-03 11:35 ` [PATCH 4/5] selinux: validate user MLS range and default level " Christian Göttsche
2026-09-03 11:52   ` sashiko-bot
2026-09-03 13:52   ` Stephen Smalley
2026-09-03 11:35 ` [PATCH 5/5] selinux: validate permissive and neveraudit map types " Christian Göttsche
2026-09-03 11:50   ` sashiko-bot
2026-09-03 13:53   ` Stephen Smalley
2026-09-03 11:35 ` [PATCH 1/5] selinux: reject duplicate symbol values during policy load Christian Göttsche
2026-09-03 11:57   ` sashiko-bot
2026-09-03 13:44   ` Stephen Smalley
2026-09-03 11:52 ` [PATCH 2/5] selinux: bounds-check filename transition source types at load sashiko-bot
2026-09-03 13:47 ` Stephen Smalley
2026-09-03 15:18   ` Christian Göttsche
2026-09-04 12:10     ` 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.