lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Mon, 26 Apr 2021 15:49:39 -0400
From:   Mimi Zohar <zohar@...ux.ibm.com>
To:     Casey Schaufler <casey@...aufler-ca.com>,
        Roberto Sassu <roberto.sassu@...wei.com>, mjg59@...gle.com
Cc:     linux-integrity@...r.kernel.org,
        linux-security-module@...r.kernel.org,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 04/12] ima: Move ima_reset_appraise_flags() call to
 post hooks

On Wed, 2021-04-07 at 09:17 -0700, Casey Schaufler wrote:
> > diff --git a/security/integrity/ima/ima_appraise.c b/security/integrity/ima/ima_appraise.c
> > index 565e33ff19d0..1f029e4c8d7f 100644
> > --- a/security/integrity/ima/ima_appraise.c
> > +++ b/security/integrity/ima/ima_appraise.c
> > @@ -577,21 +577,40 @@ int ima_inode_setxattr(struct dentry *dentry, const char *xattr_name,
> >       if (result == 1) {
> >               if (!xattr_value_len || (xvalue->type >= IMA_XATTR_LAST))
> >                       return -EINVAL;
> > -             ima_reset_appraise_flags(d_backing_inode(dentry),
> > -                     xvalue->type == EVM_IMA_XATTR_DIGSIG);
> >               result = 0;
> >       }
> >       return result;
> >  }
> >  
> > +void ima_inode_post_setxattr(struct dentry *dentry, const char *xattr_name,
> > +                          const void *xattr_value, size_t xattr_value_len)
> > +{
> > +     const struct evm_ima_xattr_data *xvalue = xattr_value;
> > +     int result;
> > +
> > +     result = ima_protect_xattr(dentry, xattr_name, xattr_value,
> > +                                xattr_value_len);
> > +     if (result == 1)
> > +             ima_reset_appraise_flags(d_backing_inode(dentry),
> > +                     xvalue->type == EVM_IMA_XATTR_DIGSIG);
> > +}
> > +
> 
> Now you're calling ima_protect_xattr() twice for each setxattr.
> Is that safe? Is it performant? Does it matter?

The first time the call to ima_protect_xattr() prevents the
security.ima from being inappropriately modified.  The second time it
resets the cached status flags.  From a performance perspective,
unnecessarily re-calcuating the file hash is worse than rechecking the
security xattr string.
 
Mimi

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ