From: "Christopher J. PeBenito" <cpebenito@tresys.com>
To: SELinux Mail List <selinux@tycho.nsa.gov>
Subject: [PATCH]: add boolmap argument to expand_module_avrules()
Date: Thu, 12 Apr 2007 19:03:17 +0000 [thread overview]
Message-ID: <1176404597.9840.65.camel@sgc> (raw)
A recent change to libsepol's expander introduced the boolmap structure
so that boolean values may be remapped properly. In the special
function expand_module_avrules(), which at the moment only SETools uses,
this boolmap structure is never initialized. As a result, the expander
will segfault when remapping conditional expressions. The following
patch adds a paramater to expand_module_avrules() that allows users to
specify that boolmap. This function is never exported out of the
library, so doesn't result in an ABI change to the library.
include/sepol/policydb/expand.h | 20 +++++++++++---------
src/expand.c | 4 +++-
2 files changed, 14 insertions(+), 10 deletions(-)
Index: libsepol/include/sepol/policydb/expand.h
===================================================================
--- libsepol/include/sepol/policydb/expand.h (revision 224)
+++ libsepol/include/sepol/policydb/expand.h (working copy)
@@ -30,17 +30,19 @@
#include <sepol/policydb/conditional.h>
/*
- * Expand only the avrules for a module. It is valid for this function to
- * expand base into itself (i.e. base == out); the typemap for this special
- * case should map type[i] to i+1. This function optionally expands neverallow
- * rules. If neverallow rules are expanded, there is no need to copy them and
- * doing so could cause duplicate entries when base == out. If the neverallow
- * rules are not expanded, they are just copied to the destination policy so
- * that assertion checking can be performed after expand. No assertion or
- * hierarchy checking is performed by this function.
+ * Expand only the avrules for a module. It is valid for this function
+ * to expand base into itself (i.e. base == out); the typemap for
+ * this special case should map type[i] to i+1. Likewise the boolmap
+ * should map bool[i] to i + 1. This function optionally expands
+ * neverallow rules. If neverallow rules are expanded, there is no
+ * need to copy them and doing so could cause duplicate entries when
+ * base == out. If the neverallow rules are not expanded, they are
+ * just copied to the destination policy so that assertion checking
+ * can be performed after expand. No assertion or hierarchy checking
+ * is performed by this function.
*/
extern int expand_module_avrules(sepol_handle_t * handle, policydb_t * base,
- policydb_t * out, uint32_t * typemap,
+ policydb_t * out, uint32_t * typemap, uint32_t * boolmap,
int verbose, int expand_neverallow);
/*
* Expand all parts of a module. Neverallow rules are not expanded (only
Index: libsepol/src/expand.c
===================================================================
--- libsepol/src/expand.c (revision 224)
+++ libsepol/src/expand.c (working copy)
@@ -2198,7 +2198,8 @@
* or expand into the same policy for analysis purposes.
*/
int expand_module_avrules(sepol_handle_t * handle, policydb_t * base,
- policydb_t * out, uint32_t * typemap, int verbose,
+ policydb_t * out, uint32_t * typemap,
+ uint32_t * boolmap, int verbose,
int expand_neverallow)
{
expand_state_t state;
@@ -2208,6 +2209,7 @@
state.base = base;
state.out = out;
state.typemap = typemap;
+ state.boolmap = boolmap;
state.handle = handle;
state.verbose = verbose;
state.expand_neverallow = expand_neverallow;
--
Chris PeBenito
Tresys Technology, LLC
(410) 290-1411 x150
--
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:[~2007-04-12 19:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-12 19:03 Christopher J. PeBenito [this message]
2007-04-13 14:11 ` [PATCH]: add boolmap argument to expand_module_avrules() Stephen Smalley
2007-04-13 16:19 ` 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=1176404597.9840.65.camel@sgc \
--to=cpebenito@tresys.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.