Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp2210552ybh; Fri, 17 Jul 2020 11:57:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzTI3VBn+Vcm8cG/GEZvSNDQoOsST8nojqsOSeAmV7I4eAfXJadtcMKT6MGKbiaGduZv1Ny X-Received: by 2002:a17:906:38da:: with SMTP id r26mr9630475ejd.120.1595012275572; Fri, 17 Jul 2020 11:57:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595012275; cv=none; d=google.com; s=arc-20160816; b=dCKwtNYcvgaSl4mTM9e80QLppXak48sa5rUqZLoxEn0SULO4kelurf5nBHYkgkVbT3 LQsFNU7vqB9TJwUnaHgExPxescqDn/miVcTOftzcXkKTbPXJGPNkLQddU02KGK7tOdah AczLifx88ptY0dGd4gZEhaKNZkz4v9GIf+DU1kmY0ktK910GKYFsr/c2+nCNLeZR1wYQ gROnIzw0k5pBpCxjZ4/T0Il3PRYbG07NbWsIvru9u7+cc8aRq7FHoQbtveXeWGSt3JDp WFvxIkFQNrsJGQPZwcbITiR8bMNcwHKs4uLIklNQOsQHflWtHbgAZ5oIXSuyIXZjhPcX 74zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=vDeL3ubcYLy3YXeZq85rJ1Zdl3Rn1i6CHJT23Zm0feQ=; b=ZQH0Oz1GJ2fmVKr3wHCMSc9tW7Z6pQSnuMpxM2pdiOuX14g8xMgUFfMnd6yoK9ka1g nf/l+7whajT6GaIWeHaEAmZtSJcKVBq/CcxsRHaKlJfVr9ib8/opwM3iyur4oCNs63vP C7cM6JVGpW5UpYierE+t76GJ5YXDmr5EkaEXfwqRsnvZsNzu2dlbXM7VQIP0zWOA8uPl B/00CQQtZbcI4Z7ih48Q6SBnhUF1RXirzjTDQTxh19BrU95yR/xUOjEFQllt8GR7x3/R u1AJMBX2M0N7RXDQnsq/C1RwS6CqWCmBaER4CAHSbRSANQfSbDO/0+ET9/lfS/ndGBy4 W8UA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cm10si5778474edb.208.2020.07.17.11.57.33; Fri, 17 Jul 2020 11:57:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728436AbgGQS5D (ORCPT + 99 others); Fri, 17 Jul 2020 14:57:03 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:57062 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727821AbgGQS47 (ORCPT ); Fri, 17 Jul 2020 14:56:59 -0400 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 06HIWhQw033275; Fri, 17 Jul 2020 14:56:50 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 32be11xkgx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Jul 2020 14:56:50 -0400 Received: from m0098394.ppops.net (m0098394.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 06HIneYf130321; Fri, 17 Jul 2020 14:56:49 -0400 Received: from ppma04wdc.us.ibm.com (1a.90.2fa9.ip4.static.sl-reverse.com [169.47.144.26]) by mx0a-001b2d01.pphosted.com with ESMTP id 32be11xkgd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Jul 2020 14:56:49 -0400 Received: from pps.filterd (ppma04wdc.us.ibm.com [127.0.0.1]) by ppma04wdc.us.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 06HIdMA6016127; Fri, 17 Jul 2020 18:56:48 GMT Received: from b01cxnp23033.gho.pok.ibm.com (b01cxnp23033.gho.pok.ibm.com [9.57.198.28]) by ppma04wdc.us.ibm.com with ESMTP id 327529k46e-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 17 Jul 2020 18:56:48 +0000 Received: from b01ledav001.gho.pok.ibm.com (b01ledav001.gho.pok.ibm.com [9.57.199.106]) by b01cxnp23033.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 06HIulD116318894 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 17 Jul 2020 18:56:47 GMT Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A45AF28064; Fri, 17 Jul 2020 18:56:47 +0000 (GMT) Received: from b01ledav001.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C2D7128058; Fri, 17 Jul 2020 18:56:46 +0000 (GMT) Received: from swastik.ibm.com (unknown [9.160.101.126]) by b01ledav001.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 17 Jul 2020 18:56:46 +0000 (GMT) Subject: Re: [PATCH v3 06/12] ima: Fail rule parsing when the KEY_CHECK hook is combined with an invalid cond To: Tyler Hicks Cc: Mimi Zohar , 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 References: <20200709061911.954326-1-tyhicks@linux.microsoft.com> <20200709061911.954326-7-tyhicks@linux.microsoft.com> From: Nayna Message-ID: <336cc947-1f70-0286-6506-6df3d1d23a1d@linux.vnet.ibm.com> Date: Fri, 17 Jul 2020 14:56:46 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <20200709061911.954326-7-tyhicks@linux.microsoft.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-07-17_09:2020-07-17,2020-07-17 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 bulkscore=0 phishscore=0 clxscore=1015 mlxlogscore=999 impostorscore=0 priorityscore=1501 lowpriorityscore=0 spamscore=0 suspectscore=0 adultscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2006250000 definitions=main-2007170129 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/9/20 2:19 AM, Tyler Hicks wrote: > The KEY_CHECK function only supports the uid, pcr, and keyrings > conditionals. Make this clear at policy load so that IMA policy authors > don't assume that other conditionals are supported. > > Fixes: 5808611cccb2 ("IMA: Add KEY_CHECK func to measure keys") > Signed-off-by: Tyler Hicks > Reviewed-by: Lakshmi Ramasubramanian > --- > > * v3 > - Added Lakshmi's Reviewed-by > - Adjust for the indentation change introduced in patch #4 > * v2 > - No change > > security/integrity/ima/ima_policy.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/security/integrity/ima/ima_policy.c b/security/integrity/ima/ima_policy.c > index 1c64bd6f1728..81da02071d41 100644 > --- a/security/integrity/ima/ima_policy.c > +++ b/security/integrity/ima/ima_policy.c > @@ -1023,6 +1023,13 @@ static bool ima_validate_rule(struct ima_rule_entry *entry) > if (entry->action & ~(MEASURE | DONT_MEASURE)) > return false; > > + if (entry->flags & ~(IMA_FUNC | IMA_UID | IMA_PCR | > + IMA_KEYRINGS)) > + return false; > + > + if (ima_rule_contains_lsm_cond(entry)) > + return false; > + > break; > default: > return false; Should there be a check for IMA_MEASURE_ASYMMETRIC_KEYS in Opt_keyrings in ima_parse_rule() to return immediately if not enabled ? Thanks & Regards,      - Nayna