From: "Christian Göttsche" <cgzones@googlemail.com>
To: selinux@vger.kernel.org
Subject: [RFC PATCH 2/3] libsepol: validate initial SIDs
Date: Tue, 7 Jun 2022 19:41:44 +0200 [thread overview]
Message-ID: <20220607174145.51330-2-cgzones@googlemail.com> (raw)
In-Reply-To: <20220607174145.51330-1-cgzones@googlemail.com>
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
---
libsepol/src/policydb_validate.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/libsepol/src/policydb_validate.c b/libsepol/src/policydb_validate.c
index da18282b..fcd3154a 100644
--- a/libsepol/src/policydb_validate.c
+++ b/libsepol/src/policydb_validate.c
@@ -1,6 +1,7 @@
#include <sepol/policydb/conditional.h>
#include <sepol/policydb/ebitmap.h>
+#include <sepol/policydb/initialsids.h>
#include <sepol/policydb/policydb.h>
#include <sepol/policydb/services.h>
@@ -1041,6 +1042,10 @@ static int validate_ocontexts(sepol_handle_t *handle, policydb_t *p, validate_t
if (p->target_platform == SEPOL_TARGET_SELINUX) {
switch (i) {
+ case OCON_ISID:
+ if (octx->sid[0] < 1 || octx->sid[0] >= SELINUX_SID_SZ)
+ goto bad;
+ break;
case OCON_FS:
case OCON_NETIF:
if (validate_context(&octx->context[1], flavors, p->mls))
@@ -1057,6 +1062,14 @@ static int validate_ocontexts(sepol_handle_t *handle, policydb_t *p, validate_t
}
}
}
+ if (p->target_platform == SEPOL_TARGET_XEN) {
+ switch (i) {
+ case OCON_XEN_ISID:
+ if (octx->sid[0] < 1 || octx->sid[0] >= XEN_SID_SZ)
+ goto bad;
+ break;
+ }
+ }
}
}
--
2.36.1
next prev parent reply other threads:[~2022-06-07 18:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-07 17:41 [RFC PATCH 1/3] libsepol: export initial SIDs Christian Göttsche
2022-06-07 17:41 ` Christian Göttsche [this message]
2022-06-07 17:41 ` [RFC PATCH 3/3] checkpolicy: rework initial SID handling Christian Göttsche
2022-06-09 17:42 ` James Carter
2022-06-09 17:25 ` [RFC PATCH 1/3] libsepol: export initial SIDs James Carter
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=20220607174145.51330-2-cgzones@googlemail.com \
--to=cgzones@googlemail.com \
--cc=selinux@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox