Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp112446ybt; Thu, 25 Jun 2020 16:46:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySQlSv67fUUwJ6fo4shYsnMwHQxKB1yrnNB15pyDuXNY7WEzboYEDYUwO56hU67acU6Vmb X-Received: by 2002:a17:906:e0c7:: with SMTP id gl7mr212275ejb.264.1593128774051; Thu, 25 Jun 2020 16:46:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593128774; cv=none; d=google.com; s=arc-20160816; b=Vn5U/FV+2Y1LWGJ7u0vf3Dhldc2Br8S9qM3uLrwlZY7qhPUEYaQozo1OTc28XVQMPM 3qSexlZaeqqGl8ZLgpp0/Zri3s5a5ZHuSKBbGzwP2x/MA5+CwvildF3PPWJnjlETuM3E 0STWMtu8weIZs53IUCtG4Zdl5TAj0y8GfqdHHitsYu8Fz4IfgQGe9yCSXys8n5ZcL5yb AJyRFCnFLE9YWF73jdEPbjtq9sT5mlct69DpVpc+vWtmxFeV56fzXfLapw64CrJsCoZf 0QhbW5erOy9ypLgW4Cy0xsT2ckSZB7llrgF5nL8Iyp0fc31DC4Q7j6l52/22gyvCOp2e 4oEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=+Z12l6cFbuUr+DMVY9iDcYy5EAJXmF9o0gRnvkegGw0=; b=NcwRHLvgkRucDLXnfMC5zi2s1j3qgbgUqaktNkn9zPehCQh8Z2V7iyV9o9pcy1C2lK ShjVbaT/NwywntqC3SD8UUEY3O0eWMinIq3LrdcGYbhHn190Rt7sJ2Nf6YAETO43wFHH oZct+NHgL00+KIP+MNAVKD6UBEKPfZJYQMhEjf2hjst6KFyr0tVOkXU0Vyywy+SO4jTY 4LbiWOqYLORz1HcXgoCE71RyVLBNisIvPVBE835jKAfALiQdGDmpoReTbjH3ehdtCQie ZJ4mWz2e0PL2YQ5MqNl3WEcGVw1+phaRBNMZxMChpmK8QhiAHWf1N73V4ss/f5hlbFGM fIuA== 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 op7si9466220ejb.16.2020.06.25.16.45.50; Thu, 25 Jun 2020 16:46:14 -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 S2404279AbgFYVyL (ORCPT + 99 others); Thu, 25 Jun 2020 17:54:11 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:63262 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728381AbgFYVyK (ORCPT ); Thu, 25 Jun 2020 17:54:10 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 05PLVbDG150977; Thu, 25 Jun 2020 17:54:06 -0400 Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 31vtt3kwmj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Jun 2020 17:54:05 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 05PLjgrA194423; Thu, 25 Jun 2020 17:54:05 -0400 Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0b-001b2d01.pphosted.com with ESMTP id 31vtt3kwm2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Jun 2020 17:54:05 -0400 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 05PLjbBt029478; Thu, 25 Jun 2020 21:54:03 GMT Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by ppma05fra.de.ibm.com with ESMTP id 31uusg13c1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 25 Jun 2020 21:54:03 +0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 05PLs13n3342610 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 25 Jun 2020 21:54:01 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 17ECEA405D; Thu, 25 Jun 2020 21:54:01 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8C50EA4051; Thu, 25 Jun 2020 21:53:59 +0000 (GMT) Received: from localhost.localdomain (unknown [9.85.142.225]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 25 Jun 2020 21:53:59 +0000 (GMT) Message-ID: <1593122039.27152.412.camel@linux.ibm.com> Subject: Re: [PATCH 06/12] ima: Fail rule parsing when the KEXEC_CMDLINE hook is combined with an invalid cond From: Mimi Zohar To: Tyler Hicks , Dmitry Kasatkin Cc: 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 Date: Thu, 25 Jun 2020 17:53:59 -0400 In-Reply-To: <20200623003236.830149-7-tyhicks@linux.microsoft.com> References: <20200623003236.830149-1-tyhicks@linux.microsoft.com> <20200623003236.830149-7-tyhicks@linux.microsoft.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.20.5 (3.20.5-1.fc24) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.216,18.0.687 definitions=2020-06-25_16:2020-06-25,2020-06-25 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 bulkscore=0 adultscore=0 phishscore=0 suspectscore=0 mlxscore=0 mlxlogscore=999 lowpriorityscore=0 impostorscore=0 spamscore=0 cotscore=-2147483648 clxscore=1015 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2004280000 definitions=main-2006250124 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2020-06-22 at 19:32 -0500, Tyler Hicks wrote: > The KEXEC_CMDLINE hook function only supports the pcr conditional. Make > this clear at policy load so that IMA policy authors don't assume that > other conditionals are supported. > > Since KEXEC_CMDLINE's inception, ima_match_rules() has always returned > true on any loaded KEXEC_CMDLINE rule without any consideration for > other conditionals present in the rule. Make it clear that pcr is the > only supported KEXEC_CMDLINE conditional by returning an error during > policy load. > > An example of why this is a problem can be explained with the following > rule: > > dont_measure func=KEXEC_CMDLINE obj_type=foo_t > > An IMA policy author would have assumed that rule is valid because the > parser accepted it but the result was that measurements for all > KEXEC_CMDLINE operations would be disabled. > > Fixes: b0935123a183 ("IMA: Define a new hook to measure the kexec boot command line arguments") > Signed-off-by: Tyler Hicks Reviewed-by: Mimi Zohar