Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp4410861ybz; Tue, 28 Apr 2020 10:49:12 -0700 (PDT) X-Google-Smtp-Source: APiQypKGke55yz8ku1YTnZyvJVI4hnJnwSZdEB+TBaVmx6qU6m1wlr6dyrUQ6QXneF4xjj0ZBRV0 X-Received: by 2002:aa7:df8d:: with SMTP id b13mr18883589edy.145.1588096151900; Tue, 28 Apr 2020 10:49:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588096151; cv=none; d=google.com; s=arc-20160816; b=jKr1nEJn3/DrwIEVYjVqcOK3IMa3yqjBVHPcj6+G5zpSjTOgn7UKg6dsiaBv3nD1/t NqQfoNPxHmFWHdh9OivVUrQG3Wk349+1x78fGAY+PY4/x7301LWC1khn/8YqhuRB4tYO zFR00EUcKy0snCXImUrP+ptFAXXJ1mk1NiYk2iLkqY1jTcd6RcXgdtxminq+O1j0ZCEy hDtc7XzPxaADR8PjhSV53pWIqz9F2FOE/0YQQ10outV+U3Ni4tDZcwAkc4jxO0LRHmfO 06o7+wG4wPQxOjfbYQMPdNvfHnoI5pz7xCHv/qfzqYVkZh/8/RLzUPBuL+xGQxBIjxyh dp7g== 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=ISse53FNuogXv5JV73NfwYcjNnJ8oWxX2KPnF4LuU0I=; b=g6YEBlnLr8oc8t3n4TOVz85tsvL5vHcBs7wXvwMuGEYZN6rl3d+giHk5kepmY5i6MP Y+0YGFVcD2fsqN635WJFBrMChmT5+WNDOBCCUTOtgvD9QY3YONhksu+HDwPTcRkFXDZ/ bt0YX1v4x2zHWe3RGVxClNXHT1kSGN/J3w0WPtm9Rx3PQ24+6E9QTFuUrzqrD2udpNWp 9JaaQ2XncnaabneV+EAJrPxjy8/DjlCaPKR3mBnqdSwcIkzOQ7xHXxzWdz/d+ud5IS0F 5pbPCh1QzGH8U1iwJhQYnBAfecb9uS+E953m4nVYpLPba/rNzslfppF1F88AaD5rjR12 +ZTw== 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 w16si2299947ejb.521.2020.04.28.10.48.48; Tue, 28 Apr 2020 10:49:11 -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 S1728517AbgD1Rqv (ORCPT + 99 others); Tue, 28 Apr 2020 13:46:51 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:35190 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727074AbgD1Rqv (ORCPT ); Tue, 28 Apr 2020 13:46:51 -0400 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03SHZ0T7018100; Tue, 28 Apr 2020 13:46:44 -0400 Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 30pjmjf4tq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Apr 2020 13:46:44 -0400 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 03SHepiB028904; Tue, 28 Apr 2020 17:46:42 GMT Received: from b06cxnps4074.portsmouth.uk.ibm.com (d06relay11.portsmouth.uk.ibm.com [9.149.109.196]) by ppma04fra.de.ibm.com with ESMTP id 30mcu592aa-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 28 Apr 2020 17:46:42 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 03SHkeYk26280154 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 28 Apr 2020 17:46:40 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2B02811C06E; Tue, 28 Apr 2020 17:46:40 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E9DBE11C05E; Tue, 28 Apr 2020 17:46:38 +0000 (GMT) Received: from localhost.localdomain (unknown [9.80.198.90]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 28 Apr 2020 17:46:38 +0000 (GMT) Message-ID: <1588095998.5195.49.camel@linux.ibm.com> Subject: Re: [PATCH v2 6/6] ima: Fix return value of ima_write_policy() From: Mimi Zohar To: Roberto Sassu , Krzysztof Struczynski Cc: linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, silviu.vlasceanu@huawei.com, krzysztof.struczynski@huawei.com, stable@vger.kernel.org Date: Tue, 28 Apr 2020 13:46:38 -0400 In-Reply-To: <20200427103128.19229-1-roberto.sassu@huawei.com> References: <20200427102900.18887-1-roberto.sassu@huawei.com> <20200427103128.19229-1-roberto.sassu@huawei.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: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.676 definitions=2020-04-28_12:2020-04-28,2020-04-28 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 phishscore=0 adultscore=0 spamscore=0 impostorscore=0 lowpriorityscore=0 malwarescore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 clxscore=1015 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004280130 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Roberto, On Mon, 2020-04-27 at 12:31 +0200, Roberto Sassu wrote: > This patch fixes the return value of ima_write_policy() when a new policy > is directly passed to IMA and the current policy requires appraisal of the > file containing the policy. Currently, if appraisal is not in ENFORCE mode, > ima_write_policy() returns 0 and leads user space applications to an > endless loop. Fix this issue by denying the operation regardless of the > appraisal mode. > > Changelog > > v1: > - deny the operation in all cases (suggested by Mimi, Krzysztof) Relatively recently, people have moved away from including the "Changelog" in the upstream commit. (I'm removing them now.)   > > Cc: stable@vger.kernel.org # 4.10.x > Fixes: 19f8a84713edc ("ima: measure and appraise the IMA policy itself") > Signed-off-by: Roberto Sassu Without the Changelog, the only way of acknowledging people's contributions is by including their tags.  Krzysztof, did you want to add your "Reviewed-by" tag? > --- People have started putting the Changelog or any comments immediately below the separator "---" here. thanks, Mimi > security/integrity/ima/ima_fs.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/security/integrity/ima/ima_fs.c b/security/integrity/ima/ima_fs.c > index 8b030a1c5e0d..e3fcad871861 100644 > --- a/security/integrity/ima/ima_fs.c > +++ b/security/integrity/ima/ima_fs.c > @@ -338,8 +338,7 @@ static ssize_t ima_write_policy(struct file *file, const char __user *buf, > integrity_audit_msg(AUDIT_INTEGRITY_STATUS, NULL, NULL, > "policy_update", "signed policy required", > 1, 0); > - if (ima_appraise & IMA_APPRAISE_ENFORCE) > - result = -EACCES; > + result = -EACCES; > } else { > result = ima_parse_add_rule(data); > }