Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp792422pxu; Thu, 3 Dec 2020 12:46:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJxrILzVXBH2huNIqFgjInOrHr7mZ5mcip0W2NJmI1128gFJC+Rg2n41Sb7k76nqKXkNSWTT X-Received: by 2002:a05:6402:1389:: with SMTP id b9mr4578158edv.178.1607028360314; Thu, 03 Dec 2020 12:46:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607028360; cv=none; d=google.com; s=arc-20160816; b=PFIrDnQVVs7nW+lX2qnIyQxQrBXHzZQ1dqnelbMvgRFqG7ySuNJItLNWG4Kw9rWoIv jJoN3EQ9r+2yUDNGNgPv07lTEynk1YyAf8+9A3y2xV5rxFkd/n0dh63T9ijm5NdHliT+ aJkmqBMglGTxH4eP+UyRV7k6juoESgybC1utxUm+EfpOqcepGI0pLiFNe4PkEir/zMgk L5RvtMw2Z72BTVtzWMonl53DbXqJrJgF61XwbEhrzVJarvHzJtMU9HX/mWyRGyGekTjn 9YnKkZuCKFk4Lopn13WzaICdn/JEZ7LXfCkRy2aH+El7u0yZP0WU445iqt+4lVNKAW6m 3K3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=ybXvsEXpDXIPmjWji69f2jqfzYDCBrTeuqxrThnEBt4=; b=zlb498X4yeEr/fcKFsZdlCVG4pOFuNtObl/vnfDcvNZseJ+bsfWx/rap8H9A51ESwM xqYGUajjXU7ALYRrV/BEB4Ius8y0ICf4WJ5RH9ypCWeBWhAGumSR9gXDqhw0H4bQwLtW EvmBcqgoORQiosKFVC7FuD88BLdXOYyHicnuA7ok/eFgwzipF85MGSCp7EYCmnrINCZH WVAxLAfLhTPYzddh1wnmU4HP/B3b+5GSQ3sEmVEK7qIKb3bpF5ypVM+4toyxUDmNyj38 uRo1vN9i7otNR6cL2FvZ1vECZkJOMFmG9Z+7mmPQn6zD9wP2sin/Z+8U5nXizc8OhBUC 4ZYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=P+Fg+VX3; 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 u12si1597783edp.98.2020.12.03.12.45.37; Thu, 03 Dec 2020 12:46:00 -0800 (PST) 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=P+Fg+VX3; 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 S1727348AbgLCUni (ORCPT + 99 others); Thu, 3 Dec 2020 15:43:38 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:23574 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725885AbgLCUni (ORCPT ); Thu, 3 Dec 2020 15:43:38 -0500 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0B3KbOXh018207; Thu, 3 Dec 2020 15:42:52 -0500 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 : mime-version : content-transfer-encoding; s=pp1; bh=ybXvsEXpDXIPmjWji69f2jqfzYDCBrTeuqxrThnEBt4=; b=P+Fg+VX3FgHOMu96IW5NObPqdQ509iNLq8wC0VNI4bGj9l3pD2yohVCA+lxPLYH3M/o/ 36Fqs3O23tjBCwUoCzkSV0nkD+adF43uSAkYCVCFSzikr4iWQ6KC//PDLSpqgiKet5IJ 9ASHVP1QZI58zqYIuBtKHSEFa/bJzU4dWsYYfmO15ncUzjEisLM0I8VTjXCW/HO0gYOO M8hVVYPw/vKzDfXyeBavfeOVWmoy0s08OdV8N8sulcZhSm9Zyb02gPqFY4QrK8zho9NL KpKlixtE9aFML68IcfJg6zm+fdcRe9FDaZXB+WfYYR1W89zPVrPckx+O7Q5SSZ4pd83+ qg== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 35777c054u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Dec 2020 15:42:52 -0500 Received: from m0098410.ppops.net (m0098410.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 0B3Ke7A3029221; Thu, 3 Dec 2020 15:42:51 -0500 Received: from ppma03fra.de.ibm.com (6b.4a.5195.ip4.static.sl-reverse.com [149.81.74.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 35777c053w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Dec 2020 15:42:51 -0500 Received: from pps.filterd (ppma03fra.de.ibm.com [127.0.0.1]) by ppma03fra.de.ibm.com (8.16.0.42/8.16.0.42) with SMTP id 0B3KXiti008063; Thu, 3 Dec 2020 20:42:49 GMT Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by ppma03fra.de.ibm.com with ESMTP id 353e6889cc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 03 Dec 2020 20:42:49 +0000 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 0B3Kgls910093158 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 3 Dec 2020 20:42:47 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 16F8F4203F; Thu, 3 Dec 2020 20:42:47 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6E6A342047; Thu, 3 Dec 2020 20:42:45 +0000 (GMT) Received: from li-f45666cc-3089-11b2-a85c-c57d1a57929f.ibm.com (unknown [9.160.43.205]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 3 Dec 2020 20:42:45 +0000 (GMT) Message-ID: Subject: Re: [PATCH v3 06/11] evm: Ignore INTEGRITY_NOLABEL if no HMAC key is loaded 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, silviu.vlasceanu@huawei.com Date: Thu, 03 Dec 2020 15:42:44 -0500 In-Reply-To: <20201111092302.1589-7-roberto.sassu@huawei.com> References: <20201111092302.1589-1-roberto.sassu@huawei.com> <20201111092302.1589-7-roberto.sassu@huawei.com> Content-Type: text/plain; charset="ISO-8859-15" X-Mailer: Evolution 3.28.5 (3.28.5-12.el8) 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.312,18.0.737 definitions=2020-12-03_12:2020-12-03,2020-12-03 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 lowpriorityscore=0 phishscore=0 priorityscore=1501 impostorscore=0 spamscore=0 bulkscore=0 mlxlogscore=999 malwarescore=0 adultscore=0 clxscore=1015 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2012030120 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Roberto, On Wed, 2020-11-11 at 10:22 +0100, Roberto Sassu wrote: > When a file is being created, LSMs can set the initial label with the > inode_init_security hook. If no HMAC key is loaded, the new file will have > LSM xattrs but not the HMAC. > > Unfortunately, EVM will deny any further metadata operation on new files, > as evm_protect_xattr() will always return the INTEGRITY_NOLABEL error. This > would limit the usability of EVM when only a public key is loaded, as > commands such as cp or tar with the option to preserve xattrs won't work. > > Ignoring this error won't be an issue if no HMAC key is loaded, as the > inode is locked until the post hook, and EVM won't calculate the HMAC on > metadata that wasn't previously verified. Thus this patch checks if an > HMAC key is loaded and if not, ignores INTEGRITY_NOLABEL. I'm not sure what problem this patch is trying to solve. evm_protect_xattr() is only called by evm_inode_setxattr() and evm_inode_removexattr(), which first checks whether EVM_ALLOW_METADATA_WRITES is enabled. Mimi