From: Darrel Goeddel <dgoeddel@TrustedCS.com>
To: Stephen Smalley <sds@tycho.nsa.gov>,
Joshua Brindle <jbrindle@tresys.com>
Cc: "selinux@tycho.nsa.gov" <selinux@tycho.nsa.gov>
Subject: [PATCH] fix checkpolicy segfaults when using role dominance statements
Date: Thu, 15 Sep 2005 16:52:56 -0500 [thread overview]
Message-ID: <4329ED38.1030400@trustedcs.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 166 bytes --]
This patch fixes two segfaults in the code path handling a
role dominance statement such as:
dominance { role big_r { role little_r; } }
Look correct?
--
Darrel
[-- Attachment #2: role_dominance.patch --]
[-- Type: text/x-patch, Size: 2267 bytes --]
Index: policy_parse.y
===================================================================
RCS file: /cvsroot/selinux/nsa/selinux-usr/checkpolicy/policy_parse.y,v
retrieving revision 1.37
diff -u -p -r1.37 policy_parse.y
--- policy_parse.y 22 Aug 2005 18:06:49 -0000 1.37
+++ policy_parse.y 15 Sep 2005 20:23:51 -0000
@@ -2478,7 +2478,6 @@ static int dominate_role_recheck(hashtab
{
role_datum_t *rdp = (role_datum_t *) arg;
role_datum_t *rdatum = (role_datum_t *) datum;
- ebitmap_t *types = NULL;
ebitmap_node_t *node;
int i;
@@ -2489,17 +2488,22 @@ static int dominate_role_recheck(hashtab
/* If a dominating role found */
if (ebitmap_get_bit(&(rdatum->dominates), rdp->value - 1))
{
- if (type_set_expand(&rdp->types, types, policydbp, 1))
+ ebitmap_t types;
+ ebitmap_init(&types);
+ if (type_set_expand(&rdp->types, &types, policydbp, 1)) {
+ ebitmap_destroy(&types);
return -1;
+ }
/* raise types and dominates from dominated role */
ebitmap_for_each_bit(&rdp->dominates, node, i) {
if (ebitmap_node_get_bit(node, i))
ebitmap_set_bit(&rdatum->dominates, i, TRUE);
}
- ebitmap_for_each_bit(types, node, i) {
+ ebitmap_for_each_bit(&types, node, i) {
if (ebitmap_node_get_bit(node, i))
ebitmap_set_bit(&rdatum->types.types, i, TRUE);
}
+ ebitmap_destroy(&types);
}
/* go through all the roles */
@@ -2511,7 +2515,6 @@ static role_datum_t *
{
role_datum_t *role;
char *role_id;
- ebitmap_t *types = NULL;
ebitmap_node_t *node;
unsigned int i;
int ret;
@@ -2563,16 +2566,21 @@ static role_datum_t *
}
}
if (r) {
+ ebitmap_t types;
+ ebitmap_init(&types);
ebitmap_for_each_bit(&r->dominates, node, i) {
if (ebitmap_node_get_bit(node, i))
ebitmap_set_bit(&role->dominates, i, TRUE);
}
- if (type_set_expand(&r->types, types, policydbp, 1))
+ if (type_set_expand(&r->types, &types, policydbp, 1)) {
+ ebitmap_destroy(&types);
return NULL;
- ebitmap_for_each_bit(types, node, i) {
+ }
+ ebitmap_for_each_bit(&types, node, i) {
if (ebitmap_node_get_bit(node, i))
ebitmap_set_bit(&role->types.types, i, TRUE);
}
+ ebitmap_destroy(&types);
if (!r->value) {
/* free intermediate result */
type_set_destroy(&r->types);
next reply other threads:[~2005-09-15 21:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-09-15 21:52 Darrel Goeddel [this message]
2005-09-16 17:36 ` [PATCH] fix checkpolicy segfaults when using role dominance statements Stephen Smalley
2005-09-16 18:19 ` [PATCH] fix checkpolicy segfaults when using role dominancestatements Karl MacMillan
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=4329ED38.1030400@trustedcs.com \
--to=dgoeddel@trustedcs.com \
--cc=jbrindle@tresys.com \
--cc=sds@tycho.nsa.gov \
--cc=selinux@tycho.nsa.gov \
/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.