Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp2932993pxy; Mon, 3 May 2021 11:10:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxspQsBVqo9+yO9tpA/yvsB9yAgefT0qq9W0oGvCQKjpWRIXMsJ+z+IGKsBQ6RXHelbLuH0 X-Received: by 2002:aa7:8001:0:b029:272:7347:9b58 with SMTP id j1-20020aa780010000b029027273479b58mr20242238pfi.1.1620065437337; Mon, 03 May 2021 11:10:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620065437; cv=none; d=google.com; s=arc-20160816; b=yaaFsOVN8IqhMAGsc8NRT03oWwA+opWlatrj5A+jTnpjYqwWHLodt5gTJ05hEJLUWA cDTTVvvhNdB+2qriTM+qtvZH42NsbbRU+mwuKq0E46DBVnQHUIbJrXDRCvKq+VD8Kdp1 9l6avFG8Ugr3/NZUYZiORIN0JSrSz4U9PE7AdKwSN7+36XTKRI+O2EmPdaTYYbGhF6r8 JpkjoGe5SLQYbzgWArZ1danpGNiP7RLeN0K+bjHtI5KrQksA2PQulEgPyZeqnvZQgceM FQx8/xdoZ242kKmvYDo0Hi2iih43Wl9Lvt1ks/r37F6RNDys3M0e3f4ep9oEu8BAghlY H9Ig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=QY8Fwva9jUAcObQQsHazOSmDv+lc05cpJZ4JdnaU6Pg=; b=c3Bp2/N4BKDwtrl5p5jK0fFu01e9f8hoIjWWpAtSNFKIhhOoV3okM5itjydTvjSlSw bpkeRrY9LsISzLlGf5Yvh7TWkttQ3Qv3aV6iEIzz358BlGV1aiZ3laYYQHzOrCm1+3lc ou1ItUX7KfV6CeDvvKoaYAiz5f/6GlR6lPsPAswr2xUVahVTZNf6QxhiUuxQRcBzQ22f psiTyEW8052BlhjilmBX6hQ23YWylM1fac0muasnFQhsd5zLWNgP1Vt0AmKRcHU48Zod Mu+18iCbsSdyxqKum4rqFMXiIisp2PD8X73Al6aWI6xvQo7WiLM/JwuI4KqceFI+A69l rsaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=q+nusEJG; 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=pass (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 y5si14303774pfy.195.2021.05.03.11.10.24; Mon, 03 May 2021 11:10:37 -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; dkim=pass header.i=@ibm.com header.s=pp1 header.b=q+nusEJG; 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=pass (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230486AbhECPtP (ORCPT + 99 others); Mon, 3 May 2021 11:49:15 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:32540 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S230236AbhECPtO (ORCPT ); Mon, 3 May 2021 11:49:14 -0400 Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 143FXFOj083905; Mon, 3 May 2021 11:48:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : subject : from : to : cc : date : in-reply-to : references : content-type : content-transfer-encoding : mime-version; s=pp1; bh=QY8Fwva9jUAcObQQsHazOSmDv+lc05cpJZ4JdnaU6Pg=; b=q+nusEJGIyennrSNy+sGRwLw5a8qtR7A1j1sQLfkjk87VK7v1sFs4HuJRnFxcmfcfGAP hATpUZljHbXTUp3s9tHFZcZxXdPSq8zhiRyNjBwjB0C1rXQqCt8udPTO1f+JPhJBXDB9 RmVFJlGWZAvH6sE+vMVCyIY/xqT9Yb+K267vMT2aRP8vTb7f/NqLMo0GVAHUwVN0wI/V KPRYfzLo72X1gMyNKAYLVwjlQp7JWpWD1POddMkr/brakcyostxctnd2aFqNXL2CHXEl KbKiyHY4XTrDg1k3Olmh5eQM7DreLvlKLEJHPc0eWydlKBWjMhqRUZG9Blts2MSoZEtH ZA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 38akutgfh9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 May 2021 11:48:15 -0400 Received: from m0098420.ppops.net (m0098420.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 143FXGfi084082; Mon, 3 May 2021 11:48:13 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 38akutgfgb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 May 2021 11:48:12 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 143Fb20N028891; Mon, 3 May 2021 15:48:10 GMT Received: from b06avi18878370.portsmouth.uk.ibm.com (b06avi18878370.portsmouth.uk.ibm.com [9.149.26.194]) by ppma04ams.nl.ibm.com with ESMTP id 388xm8rsma-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 03 May 2021 15:48:10 +0000 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06avi18878370.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 143FlhJK33358216 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 3 May 2021 15:47:43 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 3A14F11C04A; Mon, 3 May 2021 15:48:08 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 14C3C11C04C; Mon, 3 May 2021 15:48:06 +0000 (GMT) Received: from li-f45666cc-3089-11b2-a85c-c57d1a57929f.ibm.com (unknown [9.211.45.89]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 3 May 2021 15:48:05 +0000 (GMT) Message-ID: Subject: Re: [PATCH v5 09/12] evm: Allow setxattr() and setattr() for unmodified metadata From: Mimi Zohar To: Roberto Sassu , "mjg59@google.com" Cc: "linux-integrity@vger.kernel.org" , "linux-security-module@vger.kernel.org" , "linux-fsdevel@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Christian Brauner , Andreas Gruenbacher Date: Mon, 03 May 2021 11:48:04 -0400 In-Reply-To: References: <20210407105252.30721-1-roberto.sassu@huawei.com> <20210407105252.30721-10-roberto.sassu@huawei.com> <8493d7e2b0fefa4cd3861bd6b7ee6f2340aa7434.camel@linux.ibm.com> Content-Type: text/plain; charset="ISO-8859-15" X-Mailer: Evolution 3.28.5 (3.28.5-14.el8) X-TM-AS-GCONF: 00 X-Proofpoint-GUID: v-k7iafBdxqr1f3U7Ucp7k5fB8Guv1JS X-Proofpoint-ORIG-GUID: DruteI17ux7fFn6dLtJ1yRwr2BsQX5dX Content-Transfer-Encoding: 7bit X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-05-03_10:2021-05-03,2021-05-03 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 malwarescore=0 mlxscore=0 phishscore=0 spamscore=0 impostorscore=0 bulkscore=0 adultscore=0 priorityscore=1501 clxscore=1015 suspectscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2105030105 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 2021-05-03 at 15:32 +0000, Roberto Sassu wrote: > > From: Mimi Zohar [mailto:zohar@linux.ibm.com] > > Sent: Monday, May 3, 2021 5:26 PM > > On Mon, 2021-05-03 at 15:11 +0000, Roberto Sassu wrote: > > > > From: Mimi Zohar [mailto:zohar@linux.ibm.com] > > > > Sent: Monday, May 3, 2021 3:00 PM > > > > On Wed, 2021-04-07 at 12:52 +0200, Roberto Sassu wrote: > > > > > > > > > diff --git a/security/integrity/evm/evm_main.c > > > > b/security/integrity/evm/evm_main.c > > > > > @@ -389,6 +473,11 @@ static int evm_protect_xattr(struct > > > > user_namespace *mnt_userns, > > > > > if (evm_status == INTEGRITY_FAIL_IMMUTABLE) > > > > > return 0; > > > > > > > > > > + if (evm_status == INTEGRITY_PASS_IMMUTABLE && > > > > > + !evm_xattr_change(mnt_userns, dentry, xattr_name, xattr_value, > > > > > + xattr_value_len)) > > > > > + return 0; > > > > > + > > > > > > > > If the purpose of evm_protect_xattr() is to prevent allowing an invalid > > > > security.evm xattr from being re-calculated and updated, making it > > > > valid, INTEGRITY_PASS_IMMUTABLE shouldn't need to be conditional. > > Any > > > > time there is an attr or xattr change, including setting it to the > > > > existing value, the status flag should be reset. > > > > > > > > I'm wondering if making INTEGRITY_PASS_IMMUTABLE conditional would > > > > prevent the file from being resigned. > > > > > > > > > if (evm_status != INTEGRITY_PASS) > > > > > integrity_audit_msg(AUDIT_INTEGRITY_METADATA, > > > > d_backing_inode(dentry), > > > > > dentry->d_name.name, > > > > "appraise_metadata", > > > > > > > > This would then be updated to if not INTEGRITY_PASS or > > > > INTEGRITY_PASS_IMMUTABLE. The subsequent "return" would need to > > be > > > > updated as well. > > > > > > I agree on the first suggestion, to reduce the number of log messages. > > > For the second, if you meant that we should return 0 if the status is > > > INTEGRITY_PASS_IMMUTABLE, I thought we wanted to deny xattr > > > changes when there is an EVM portable signature. > > > > Why? I must be missing something. As long as we're not relying on the > > cached status, allowing the file metadata to be updated shouldn't be an > > issue. > > We may want to prevent accidental changes, for example. Let's keep it simple, getting the basics working properly first. Then we can decide if this is something that we really want/need to defend against. thanks, Mimi