linux-integrity.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mimi Zohar <zohar@linux.vnet.ibm.com>
To: Matthew Garrett <mjg59@google.com>
Cc: linux-integrity <linux-integrity@vger.kernel.org>
Subject: Re: [PATCH V5 3/3] EVM: Allow runtime modification of the set of verified xattrs
Date: Mon, 14 May 2018 13:35:42 -0400	[thread overview]
Message-ID: <1526319342.3368.2.camel@linux.vnet.ibm.com> (raw)
In-Reply-To: <1526318354.3898.159.camel@linux.vnet.ibm.com>

On Mon, 2018-05-14 at 13:19 -0400, Mimi Zohar wrote:
> On Mon, 2018-05-14 at 10:01 -0700, Matthew Garrett wrote:
> > On Sun, May 13, 2018 at 9:41 AM Mimi Zohar <zohar@linux.vnet.ibm.com> wrote:
> > 
> > > On Fri, 2018-05-11 at 16:12 -0700, Matthew Garrett wrote:
> >   > +
> > > > +     if (strcmp(xattr->name, ".") == 0) {
> > > > +             evm_xattrs_locked = 1;
> > > > +             inode = evm_xattrs->d_inode;
> > > > +             inode_lock(inode);
> > > > +             newattrs.ia_mode = S_IFREG | 0440;
> > > > +             newattrs.ia_valid = ATTR_MODE;
> > > > +             err = notify_change(evm_xattrs, &newattrs, NULL);
> > > > +             inode_unlock(inode);
> > > > +             audit_log_format(ab, "locked");
> > > > +             if (!err)
> > > > +                     err = count;
> > > > +             goto out;
> > > > +     }
> > > > +
> > > > +     audit_log_format(ab, "xattr=");
> > > > +     audit_log_untrustedstring(ab, xattr->name);
> > > > +
> > > > +     if (strncmp(xattr->name, XATTR_SECURITY_PREFIX,
> > > > +                 XATTR_SECURITY_PREFIX_LEN) != 0) {
> > > > +             err = -EINVAL;
> > > > +             goto out;
> > > > +     }
> > 
> > > This test now prevents locking the xattr names list.  Making this an
> > > else clause will fix it.
> > 
> > Are you sure? The check for "." happens before this, and jumps over the
> > rest of the function.
> 
> Oh! It did work, but the messages are confusing.
> 
> # cat /sys/kernel/security/integrity/evm/evm_xattrs 
> security.selinux
> security.ima
> security.capability
> security.foo
> # echo foo > /sys/kernel/security/integrity/evm/evm_xattrs
> bash: echo: write error: Operation not permitted
> 
> # echo security.foo > /sys/kernel/security/integrity/evm/evm_xattrs
> bash: echo: write error: Operation not permitted

This makes sense, as it was already added.

> 
> # cat /sys/kernel/security/integrity/evm/evm_xattrs 
> security.selinux
> security.ima
> security.capability
> security.foo
> 
> # echo . > /sys/kernel/security/integrity/evm/evm_xattrs
> bash: echo: write error: Operation not permitted

I'm still seeing this message.

Mimi

  reply	other threads:[~2018-05-14 17:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-11 23:12 [PATCH V5 1/3] integrity: Add an integrity directory in securityfs Matthew Garrett
2018-05-11 23:12 ` [PATCH V5 2/3] EVM: turn evm_config_xattrnames into a list Matthew Garrett
2018-05-11 23:12 ` [PATCH V5 3/3] EVM: Allow runtime modification of the set of verified xattrs Matthew Garrett
2018-05-13 16:41   ` Mimi Zohar
2018-05-14 17:01     ` Matthew Garrett
2018-05-14 17:19       ` Mimi Zohar
2018-05-14 17:35         ` Mimi Zohar [this message]
2018-05-14 17:36           ` Matthew Garrett
2018-05-14 18:50             ` Matthew Garrett
2018-05-14 21:02               ` Mimi Zohar
2018-05-14 23:12                 ` Matthew Garrett

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=1526319342.3368.2.camel@linux.vnet.ibm.com \
    --to=zohar@linux.vnet.ibm.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=mjg59@google.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).