All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Carter <jwcart2@gmail.com>
To: Ondrej Mosnacek <omosnace@redhat.com>
Cc: selinux@vger.kernel.org, Stephen Smalley <sds@tycho.nsa.gov>,
	James Carter <jwcart2@tycho.nsa.gov>
Subject: Re: [PATCH 2/3] libsepol: optimize inner loop in build_type_map()
Date: Mon, 2 Mar 2020 11:31:47 -0500	[thread overview]
Message-ID: <CAP+JOzS8WWfMTcxtB2n6JZVkjaN0+azw4g+ea7iZS8R_b0gAxw@mail.gmail.com> (raw)
In-Reply-To: <CAP+JOzSRMFHF0FXOtkfjAsignPhX0UyEzyWAQiM-8LPQii-ULw@mail.gmail.com>

On Mon, Mar 2, 2020 at 10:24 AM James Carter <jwcart2@gmail.com> wrote:
>
> On Thu, Feb 27, 2020 at 11:03 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> >
> > Only attributes can be a superset of another attribute, so we can skip
> > non-attributes right away.
> >
> > Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
> > ---
> >  libsepol/src/optimize.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/libsepol/src/optimize.c b/libsepol/src/optimize.c
> > index 4d835d47..2b5102af 100644
> > --- a/libsepol/src/optimize.c
> > +++ b/libsepol/src/optimize.c
> > @@ -50,6 +50,9 @@ static ebitmap_t *build_type_map(const policydb_t *p)
> >                         for (k = 0; k < p->p_types.nprim; k++) {
> >                                 ebitmap_t *types_k = &p->attr_type_map[k];
> >
> > +                               if (p->type_val_to_struct[k]->flavor != TYPE_ATTRIB)
> > +                                       continue;
> > +
>
> I haven't tested this yet, but I suspect that this is what is causing
> the difference noted by Stephen. A type is a superset of itself.
>

This is definitely what is causing the change. Your explanation is
correct. This prevents a type from being considered as a super set of
an attribute that only contains that type.

Jim

> Jim
>
>
> >                                 if (ebitmap_contains(types_k, types_i)) {
> >                                         if (ebitmap_set_bit(&map[i], k, 1))
> >                                                 goto err;
> > --
> > 2.24.1
> >

  reply	other threads:[~2020-03-02 16:30 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-27 16:02 [PATCH 0/3] libsepol: Speed up policy optimization Ondrej Mosnacek
2020-02-27 16:02 ` [PATCH 1/3] libsepol: skip unnecessary check in build_type_map() Ondrej Mosnacek
2020-03-17 18:19   ` Stephen Smalley
2020-03-19 19:39     ` James Carter
2020-02-27 16:02 ` [PATCH 2/3] libsepol: optimize inner loop " Ondrej Mosnacek
2020-03-02 15:24   ` James Carter
2020-03-02 16:31     ` James Carter [this message]
2020-03-17 18:22   ` Stephen Smalley
2020-03-19 19:39     ` James Carter
2020-02-27 16:02 ` [PATCH 3/3] libsepol: speed up policy optimization Ondrej Mosnacek
2020-03-17 18:24   ` Stephen Smalley
2020-03-19 19:39     ` James Carter
2020-02-28 18:08 ` [PATCH 0/3] libsepol: Speed " Stephen Smalley
2020-03-02 14:50   ` Stephen Smalley
2020-03-02 14:58     ` Stephen Smalley
2020-03-02 15:46       ` Ondrej Mosnacek
2020-03-02 18:45         ` Stephen Smalley
2020-03-02 20:24           ` Stephen Smalley
2020-03-02 21:08             ` Ondrej Mosnacek
2020-03-04  9:07               ` Ondrej Mosnacek
2020-03-04 14:26                 ` Stephen Smalley
2020-03-04 15:33                   ` James Carter
2020-03-05 13:45                     ` Ondrej Mosnacek
2020-03-02 20:12         ` Stephen Smalley
2020-03-13 11:53 ` Ondrej Mosnacek
2020-03-13 19:07   ` Stephen Smalley
2020-03-13 19:57     ` Stephen Smalley

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=CAP+JOzS8WWfMTcxtB2n6JZVkjaN0+azw4g+ea7iZS8R_b0gAxw@mail.gmail.com \
    --to=jwcart2@gmail.com \
    --cc=jwcart2@tycho.nsa.gov \
    --cc=omosnace@redhat.com \
    --cc=sds@tycho.nsa.gov \
    --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 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.