From: Stephen Smalley <sds@tycho.nsa.gov>
To: Richard Haines <richard_c_haines@btinternet.com>,
selinux@tycho.nsa.gov, Eric Paris <eparis@redhat.com>,
Daniel J Walsh <dwalsh@redhat.com>
Subject: Re: [PATCH] libsepol: Skip duplicate filename_trans rules in state->out policy.
Date: Tue, 15 Apr 2014 12:40:55 -0400 [thread overview]
Message-ID: <534D6117.4020506@tycho.nsa.gov> (raw)
In-Reply-To: <1397579252-1378-1-git-send-email-richard_c_haines@btinternet.com>
On 04/15/2014 12:27 PM, Richard Haines wrote:
> The current detection of duplicate rules does not cover the state->out
> policy and therefore will duplicate filename transition rules if already
> present.
>
> Signed-off-by: Richard Haines <richard_c_haines@btinternet.com>
> ---
> libsepol/src/expand.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/libsepol/src/expand.c b/libsepol/src/expand.c
> index acb6906..e908fdb 100644
> --- a/libsepol/src/expand.c
> +++ b/libsepol/src/expand.c
> @@ -1534,6 +1534,20 @@ static int expand_filename_trans(expand_state_t *state, filename_trans_rule_t *r
> if (cur_trans)
> continue;
>
> + /* Now check if duplicate rule in state->out policy */
> + cur_trans = state->out->filename_trans;
> +
> + while (cur_trans) {
> + if (cur_trans->stype == (i + 1) &&
> + cur_trans->ttype == (j + 1) &&
> + cur_trans->tclass == cur_rule->tclass &&
> + !strcmp(cur_trans->name, cur_rule->name))
> + break;
> + cur_trans = cur_trans->next;
> + }
> + if (cur_trans)
> + continue;
> +
> new_trans = malloc(sizeof(*new_trans));
> if (!new_trans) {
> ERR(state->handle, "Out of memory!");
Isn't this effectively a revert of:
commit a29f6820c52b60b9028298cde9962dd140bbf9ea
Author: Adam Tkac <atkac@redhat.com>
Date: Fri May 25 17:55:08 2012 +0200
libsepol: filename_trans: use some better sorting to compare and merge
The kernel switched to using a hashtab for filename_trans rules in
commit 2463c26d50adc282d19317013ba0ff473823ca47
Author: Eric Paris <eparis@redhat.com>
Date: Thu Apr 28 15:11:21 2011 -0400
SELinux: put name based create rules in a hashtable
Is there a reason we don't do this in libsepol too?
next prev parent reply other threads:[~2014-04-15 16:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-15 16:27 [PATCH] libsepol: Skip duplicate filename_trans rules in state->out policy Richard Haines
2014-04-15 16:40 ` Stephen Smalley [this message]
2014-04-15 18:21 ` Stephen Smalley
2014-04-15 18:27 ` Eric Paris
2014-04-15 18:34 ` Stephen Smalley
2014-04-15 18:43 ` Eric Paris
2014-04-15 18:46 ` Stephen Smalley
2014-04-15 19:07 ` Stephen Smalley
2014-04-15 19:18 ` Eric Paris
2014-04-15 19:19 ` Stephen Smalley
2014-04-15 19:37 ` Eric Paris
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=534D6117.4020506@tycho.nsa.gov \
--to=sds@tycho.nsa.gov \
--cc=dwalsh@redhat.com \
--cc=eparis@redhat.com \
--cc=richard_c_haines@btinternet.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.