From: Paul Moore <paul.moore@hp.com>
To: selinux@tycho.nsa.gov
Cc: jkim@TrustedCS.com, chanson@TrustedCS.com,
Daniel J Walsh <dwalsh@redhat.com>
Subject: [PATCH] Fix the range_transition rule
Date: Fri, 05 Aug 2005 16:27:28 -0400 [thread overview]
Message-ID: <42F3CBB0.4060304@hp.com> (raw)
Below is a patch to libsepol/src/expand.c to fix a problem with MLS
range transitions. The problem is that the function expand_module()
reassigns numeric values for the types when copying them and the routine
used to copy the range transitions, range_trans_clone(), simply copied
the old type values leading to bad values in the resulting policy file.
This fix uses the old type value to look up the type name in the old
symbol table and then uses the type name to lookup the new type value.
--- libsepol-1.7.9/src/expand.c.orig 2005-08-05 15:33:26.000000000 -0400
+++ libsepol-1.7.9/src/expand.c 2005-08-05 16:14:18.000000000 -0400
@@ -1349,11 +1349,21 @@ static int range_trans_clone(expand_stat
while (range != NULL) {
range_trans_t *new_range;
+ type_datum_t *type;
+ char *type_name;
+
if ((new_range = malloc(sizeof(*new_range))) == NULL) {
goto out_of_mem;
}
- new_range->dom = range->dom;
- new_range->type = range->type;
+
+ /* convert the range_transition domain and type */
+ type_name = state->base->p_type_val_to_name[range->dom
- 1];
+ type = hashtab_search(state->out->p_types.table,
type_name);
+ new_range->dom = type->value;
+ type_name = state->base->p_type_val_to_name[range->type
- 1];
+ type = hashtab_search(state->out->p_types.table,
type_name);
+ new_range->type = type->value;
+
if (mls_level_clone(&new_range->range.level[0],
&range->range.level[0]) == -1 ||
mls_level_clone(&new_range->range.level[1],
&range->range.level[1])) {
goto out_of_mem;
--
. paul moore . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
. paul.moore@hp.com hewlett packard
. (603) 884-5056 linux security
--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
next reply other threads:[~2005-08-05 20:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-05 20:27 Paul Moore [this message]
2005-08-06 15:45 ` [PATCH] Fix the range_transition rule Joshua Brindle
2005-08-08 13:54 ` Stephen Smalley
2005-08-08 14:06 ` Joshua Brindle
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=42F3CBB0.4060304@hp.com \
--to=paul.moore@hp.com \
--cc=chanson@TrustedCS.com \
--cc=dwalsh@redhat.com \
--cc=jkim@TrustedCS.com \
--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.