From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.6 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2389C43458 for ; Thu, 16 Jul 2020 18:21:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C1CCF2074B for ; Thu, 16 Jul 2020 18:21:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="AlLWGc9g" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729559AbgGPSVB (ORCPT ); Thu, 16 Jul 2020 14:21:01 -0400 Received: from linux.microsoft.com ([13.77.154.182]:59484 "EHLO linux.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729544AbgGPSVA (ORCPT ); Thu, 16 Jul 2020 14:21:00 -0400 Received: from sequoia (162-237-133-238.lightspeed.rcsntx.sbcglobal.net [162.237.133.238]) by linux.microsoft.com (Postfix) with ESMTPSA id E7AF320B4909; Thu, 16 Jul 2020 11:20:58 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com E7AF320B4909 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1594923659; bh=EQouyNC75DO1HsNnhD3+10RmroB00VBujwUdao5crR4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=AlLWGc9gUvnMB7UwGwCLpIAYfC/XPdwoLPOvLh6rcFv5LPR3FS5XoPECUgTkm7EDV GZFBRU2hU43W3bR8QI6OCDTpA9RJJjsTj3/x9YcZe2qcVfig3fvqBRZS1OyvjsY5n6 Ug7JdAKvuWBseNKYHxSWIy8kwFBFxbBs3qjJIVCs= Date: Thu, 16 Jul 2020 13:20:57 -0500 From: Tyler Hicks To: Mimi Zohar Cc: Dmitry Kasatkin , James Morris , "Serge E . Hallyn" , Lakshmi Ramasubramanian , Prakhar Srivastava , linux-kernel@vger.kernel.org, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, Nayna Jain Subject: Re: [PATCH v3 07/12] ima: Fail rule parsing when appraise_flag=blacklist is unsupportable Message-ID: <20200716182057.GE3673@sequoia> References: <20200709061911.954326-1-tyhicks@linux.microsoft.com> <20200709061911.954326-8-tyhicks@linux.microsoft.com> <1594923290.12900.376.camel@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1594923290.12900.376.camel@linux.ibm.com> Sender: linux-integrity-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-integrity@vger.kernel.org On 2020-07-16 14:14:50, Mimi Zohar wrote: > On Thu, 2020-07-09 at 01:19 -0500, Tyler Hicks wrote: > > The "appraise_flag" option is only appropriate for appraise actions > > and its "blacklist" value is only appropriate when > > CONFIG_IMA_APPRAISE_MODSIG is enabled and "appraise_flag=blacklist" is > > only appropriate when "appraise_type=imasig|modsig" is also present. > > Make this clear at policy load so that IMA policy authors don't assume > > that other uses of "appraise_flag=blacklist" are supported. > > The code looks correct, but this patch description could be written at > a higher level.  Perhaps it just needs to be prefixed with something > like this: > > Verifying that a file hash is not blacklisted is currently only > supported for files with appended signatures (modsig).  In the future, > this might change.  For now, ... That makes sense. I'm not up to speed on the intent behind the blacklist feature or where it may go in the future so I didn't think to add anything along those lines. If you are happy with the rest of the series, please feel free to append this to the commit message. Otherwise, I can add it if I need to submit a new revision of the series. Tyler > > Mimi > > > > > Fixes: 273df864cf74 ("ima: Check against blacklisted hashes for files with modsig") > > Signed-off-by: Tyler Hicks > > Cc: Nayna Jain > > > --- > > > > * v3 > > - New patch > > > > security/integrity/ima/ima_policy.c | 13 ++++++++++++- > > 1 file changed, 12 insertions(+), 1 deletion(-) > > > > diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c > > index 81da02071d41..9842e2e0bc6d 100644 > > --- a/security/integrity/ima/ima_policy.c > > +++ b/security/integrity/ima/ima_policy.c > > @@ -1035,6 +1035,11 @@ static bool ima_validate_rule(struct ima_rule_entry *entry) > > return false; > > } > > > > + /* Ensure that combinations of flags are compatible with each other */ > > + if (entry->flags & IMA_CHECK_BLACKLIST && > > + !(entry->flags & IMA_MODSIG_ALLOWED)) > > + return false; > > + > > return true; > > } > > > > @@ -1371,8 +1376,14 @@ static int ima_parse_rule(char *rule, struct ima_rule_entry *entry) > > result = -EINVAL; > > break; > > case Opt_appraise_flag: > > + if (entry->action != APPRAISE) { > > + result = -EINVAL; > > + break; > > + } > > + > > ima_log_string(ab, "appraise_flag", args[0].from); > > - if (strstr(args[0].from, "blacklist")) > > + if (IS_ENABLED(CONFIG_IMA_APPRAISE_MODSIG) && > > + strstr(args[0].from, "blacklist")) > > entry->flags |= IMA_CHECK_BLACKLIST; > > break; > > case Opt_permit_directio: