[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAFqZXNtEywSumid=FHLysV8jaSPXDO--3YJC6DfuGwRRZLQ58g@mail.gmail.com>
Date: Tue, 8 Sep 2020 15:03:02 +0200
From: Ondrej Mosnacek <omosnace@...hat.com>
To: Stephen Smalley <stephen.smalley.work@...il.com>
Cc: Lakshmi Ramasubramanian <nramas@...ux.microsoft.com>,
Mimi Zohar <zohar@...ux.ibm.com>,
Paul Moore <paul@...l-moore.com>,
Casey Schaufler <casey@...aufler-ca.com>,
Tyler Hicks <tyhicks@...ux.microsoft.com>,
tusharsu@...ux.microsoft.com, Sasha Levin <sashal@...nel.org>,
James Morris <jmorris@...ei.org>,
linux-integrity@...r.kernel.org,
SElinux list <selinux@...r.kernel.org>,
LSM List <linux-security-module@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] SELinux: Measure state and hash of policy using IMA
On Tue, Sep 8, 2020 at 2:37 PM Stephen Smalley
<stephen.smalley.work@...il.com> wrote:
> On Mon, Sep 7, 2020 at 5:39 PM Lakshmi Ramasubramanian
> <nramas@...ux.microsoft.com> wrote:
<snip>
> > diff --git a/security/selinux/measure.c b/security/selinux/measure.c
> > new file mode 100644
> > index 000000000000..caf9107937d9
> > --- /dev/null
> > +++ b/security/selinux/measure.c
> <snip>
> > +static int read_selinux_state(char **state_str, int *state_str_len,
> > + struct selinux_state *state)
> > +{
> > + char *buf, *str_fmt = "%s=%d;";
> > + int i, buf_len, curr;
> <snip>
> > + for (i = 0; i < __POLICYDB_CAPABILITY_MAX; i++) {
> > + buf_len += snprintf(NULL, 0, str_fmt,
> > + selinux_policycap_names[i],
> > + state->policycap[i]);
> > + }
>
> This will need to be converted to use
> security_policycap_supported(state, i) rather than state->policycap[i]
> since the latter is going to be removed by Ondrej's patches I think.
Based on my testing so far, even with just moving the array under
struct selinux_policy, the RCU accessing still brings a significant
overhead (relative to the whole syscalls it is probably negligible,
but relative to the rest of the simpler hooks it is about 30%), so I
don't think it is necessary to adapt other patches to it yet. It will
be my responsibility to adapt to the newly added code when/if I rebase
and respin my patch.
>
> > + for (i = 0; i < __POLICYDB_CAPABILITY_MAX; i++) {
> > + curr += snprintf((buf + curr), (buf_len - curr), str_fmt,
> > + selinux_policycap_names[i],
> > + state->policycap[i]);
>
> Ditto.
>
--
Ondrej Mosnacek
Software Engineer, Platform Security - SELinux kernel
Red Hat, Inc.
Powered by blists - more mailing lists