From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mimi Zohar Date: Tue, 14 May 2019 12:09:25 +0000 Subject: Re: [PATCH v10 09/12] ima: Implement support for module-style appended signatures Message-Id: <1557835765.4139.9.camel@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit List-Id: References: <20190418035120.2354-1-bauerman@linux.ibm.com> <20190418035120.2354-10-bauerman@linux.ibm.com> In-Reply-To: <20190418035120.2354-10-bauerman@linux.ibm.com> To: Thiago Jung Bauermann , linux-integrity@vger.kernel.org Cc: linux-security-module@vger.kernel.org, keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, Dmitry Kasatkin , James Morris , "Serge E. Hallyn" , David Howells , David Woodhouse , Jessica Yu , Herbert Xu , "David S. Miller" , Jonathan Corbet , "AKASHI, Takahiro" Hi Thiago, On Thu, 2019-04-18 at 00:51 -0300, Thiago Jung Bauermann wrote: > > @@ -326,6 +356,10 @@ int ima_appraise_measurement(enum ima_hooks func, >         case INTEGRITY_UNKNOWN: >                 break; >         case INTEGRITY_NOXATTRS:        /* No EVM protected xattrs. */ > +               /* It's fine not to have xattrs when using a modsig. */ > +               if (try_modsig) > +                       break; > +               /* fall through */ >         case INTEGRITY_NOLABEL:         /* No security.evm xattr. */ >                 cause = "missing-HMAC"; >                 goto out; > @@ -340,6 +374,14 @@ int ima_appraise_measurement(enum ima_hooks func, >                 rc = xattr_verify(func, iint, xattr_value, xattr_len, &status, >                                   &cause); >   > +       /* > +        * If we have a modsig and either no imasig or the imasig's key isn't > +        * known, then try verifying the modsig. > +        */ > +       if (status != INTEGRITY_PASS && try_modsig && > +           (!xattr_value || rc = -ENOKEY)) > +               rc = modsig_verify(func, modsig, &status, &cause); EVM protects other security xattrs, not just security.ima, if they exist.  As a result, evm_verifyxattr() could pass based on the other security xattrs. Mimi > + >  out: >         /* >          * File signatures on some filesystems can not be properly verified.