Linux Integrity Measurement development
 help / color / mirror / Atom feed
From: Mikhail Kurinnoi <viewizard@viewizard.com>
To: Mimi Zohar <zohar@linux.vnet.ibm.com>
Cc: linux-integrity@vger.kernel.org
Subject: Re: [PATCH] evm: allow metadata changes for inode without xattr support
Date: Fri, 3 Nov 2017 20:06:20 +0300	[thread overview]
Message-ID: <20171103200620.76c1add0@totoro> (raw)
In-Reply-To: <1509728048.3416.80.camel@linux.vnet.ibm.com>

? Fri, 03 Nov 2017 12:54:08 -0400
Mimi Zohar <zohar@linux.vnet.ibm.com> ?????:

> On Fri, 2017-11-03 at 10:26 +0300, Mikhail Kurinnoi wrote:
> > This patch provide changes in order to allow metadata changes for
> > inode without xattr support.
> > 
> > 
> > Signed-off-by: Mikhail Kurinnoi <viewizard@viewizard.com>
> > 
> >  security/integrity/evm/evm_main.c | 21 ++++++++++++---------
> >  1 file changed, 12 insertions(+), 9 deletions(-)
> > 
> > diff --git a/security/integrity/evm/evm_main.c
> > b/security/integrity/evm/evm_main.c index
> > 9826c02e2db8..51151c43433d 100644 ---
> > a/security/integrity/evm/evm_main.c +++
> > b/security/integrity/evm/evm_main.c @@ -294,8 +294,7 @@ static int
> > evm_protect_xattr(struct dentry *dentry, const char *xattr_name, if
> > (!posix_xattr_acl(xattr_name)) return 0;
> >  		evm_status = evm_verify_current_integrity(dentry);
> > -		if ((evm_status == INTEGRITY_PASS) ||
> > -		    (evm_status == INTEGRITY_NOXATTRS))
> > +		if (evm_status == INTEGRITY_NOXATTRS)
> >  			return 0;
> >  		goto out;
> >  	}
> > @@ -319,12 +318,15 @@ static int evm_protect_xattr(struct dentry
> > *dentry, const char *xattr_name, -EPERM, 0);
> >  	}
> >  out:
> > -	if (evm_status != INTEGRITY_PASS)
> > -		integrity_audit_msg(AUDIT_INTEGRITY_METADATA,
> > d_backing_inode(dentry),
> > -				    dentry->d_name.name,
> > "appraise_metadata",
> > -
> > integrity_status_msg[evm_status],
> > -				    -EPERM, 0);
> > -	return evm_status == INTEGRITY_PASS ? 0 : -EPERM;
> > +	if ((evm_status == INTEGRITY_PASS) ||
> > +	    (evm_status == INTEGRITY_UNKNOWN))
> > +		return 0;
> > +
> > +	integrity_audit_msg(AUDIT_INTEGRITY_METADATA,
> > d_backing_inode(dentry),
> > +			    dentry->d_name.name,
> > "appraise_metadata",
> > +			    integrity_status_msg[evm_status],
> > +			    -EPERM, 0);
> > +	return -EPERM;
> >  }
> > 
> >  /**
> > @@ -435,7 +437,8 @@ int evm_inode_setattr(struct dentry *dentry,
> > struct iattr *attr) return 0;
> >  	evm_status = evm_verify_current_integrity(dentry);
> >  	if ((evm_status == INTEGRITY_PASS) ||
> > -	    (evm_status == INTEGRITY_NOXATTRS))
> > +	    (evm_status == INTEGRITY_NOXATTRS) ||
> > +	    (evm_status == INTEGRITY_UNKNOWN))
> >  		return 0;
> >  	integrity_audit_msg(AUDIT_INTEGRITY_METADATA,
> > d_backing_inode(dentry), dentry->d_name.name, "appraise_metadata",
> >   
> 
> Since this change is limited to setattr, perhaps it would be simpler
> to test the i_opflags directly, without modifying evm_protect_xattr().

In case of set/remove xattr (evm_inode_setxattr(),
evm_inode_removexattr()), evm should not interact fs module work, that
will provide proper error code.
As I see in __vfs_setxattr_noperm(), error code could be -EOPNOTSUPP
or -EIO, but evm will override it by error code -EPERM. I think, this is
wrong. If we don't have xattr support, let fs module handle the error
code.


-- 
Best regards,
Mikhail Kurinnoi

  reply	other threads:[~2017-11-03 17:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-03  7:26 [PATCH] evm: allow metadata changes for inode without xattr support Mikhail Kurinnoi
2017-11-03 16:54 ` Mimi Zohar
2017-11-03 17:06   ` Mikhail Kurinnoi [this message]
2017-11-03 17:15     ` Mimi Zohar
2017-11-03 18:11       ` Mikhail Kurinnoi
2017-11-03 18:26         ` Mimi Zohar
2017-11-03 19:00           ` Mikhail Kurinnoi

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=20171103200620.76c1add0@totoro \
    --to=viewizard@viewizard.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=zohar@linux.vnet.ibm.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