Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp182958pxu; Fri, 4 Dec 2020 00:07:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJz9bTTvisMNB8VC7PXol9HflDQMxPpTSlXcLRFud8J6gePjC7fp8EBv52ELUhBV+Rkzr3U6 X-Received: by 2002:a17:906:304c:: with SMTP id d12mr6207138ejd.84.1607069270167; Fri, 04 Dec 2020 00:07:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607069270; cv=none; d=google.com; s=arc-20160816; b=wD1sZSTD/2meaaW7tyPYgGm7jQETNT18Z7uf12WtBvxtOXsm1vrhF+vqhAMhO5MwPs K+kg5eObvGdec/6DcHtblYY6LNvaaaC5BuqqfkKsTtDwdBLYuHWsIG6+UE9eRRJVhERf qIBchlbbz8/vbWo+IhxiYpVnD/fdXLW/uJ+8mlCyuFN/JNUfX9K0zRS3rJrHSIrANQov x+xjiWW6ENcH3FWvUILzkA5uoMzaFEMWYGQAi/V/u04MAh0xK+oas8I1i272ePfHhGqI u7y/P2d5R1HqQkLUHXXJPKnRnPC+S9eZ+EacITU3E+eIThzJUHOambm6KlvE4HHPHcvq R0+g== 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 :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from; bh=yozIHtAQWZfJeVjTMwfwovWJUwL9O6AnnkrdWM6CRFg=; b=idTgSqx/sYQyXnTZ14PlkEfqgxZdzzYHc5yRtst/b6Jmj1bXyJ1aqhD+qDQHb8ZKjD ljszx1MTqPs+ixH8//udSM5fomADa3To5oClYhF8z9iAMYs1fUuednLuAuoGZlpuA4Nd J39tzg4OfgT/usopPRSlAO2TjBFrgcp3edOvuwZkK9Qo8M9J4pG6WeM0g6H5TpTaERJd ESzOE0xNN7bvBrg4492RcNTwfnInUbrRVd4p870dkR4rFXvZaTsHUVP25tVn+fP+/M3r Iq7Gxf2LSazMQU7U84aJQGg0wzuYKVU43XQxuSV17onvjHMTsQKmlEfT0DfbG3ll0zEX 25ZA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 2si910821ejb.712.2020.12.04.00.07.27; Fri, 04 Dec 2020 00:07:50 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728780AbgLDIFt convert rfc822-to-8bit (ORCPT + 99 others); Fri, 4 Dec 2020 03:05:49 -0500 Received: from frasgout.his.huawei.com ([185.176.79.56]:2201 "EHLO frasgout.his.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726669AbgLDIFt (ORCPT ); Fri, 4 Dec 2020 03:05:49 -0500 Received: from fraeml702-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4CnQDJ6dNHz67LgZ; Fri, 4 Dec 2020 16:02:40 +0800 (CST) Received: from fraeml714-chm.china.huawei.com (10.206.15.33) by fraeml702-chm.china.huawei.com (10.206.15.51) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2106.2; Fri, 4 Dec 2020 09:05:06 +0100 Received: from fraeml714-chm.china.huawei.com ([10.206.15.33]) by fraeml714-chm.china.huawei.com ([10.206.15.33]) with mapi id 15.01.2106.002; Fri, 4 Dec 2020 09:05:05 +0100 From: Roberto Sassu To: Mimi Zohar , "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 Subject: RE: [PATCH v3 06/11] evm: Ignore INTEGRITY_NOLABEL if no HMAC key is loaded Thread-Topic: [PATCH v3 06/11] evm: Ignore INTEGRITY_NOLABEL if no HMAC key is loaded Thread-Index: AQHWuAyPc3OXOTvUVE6QYcHvma97kKnl6NcAgADOOtA= Date: Fri, 4 Dec 2020 08:05:05 +0000 Message-ID: <3c628dc54804469597a72d03c33e8315@huawei.com> References: <20201111092302.1589-1-roberto.sassu@huawei.com> <20201111092302.1589-7-roberto.sassu@huawei.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.220.96.108] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Mimi Zohar [mailto:zohar@linux.ibm.com] > Sent: Thursday, December 3, 2020 9:43 PM > 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. The idea is to also support EVM verification when only a public key is loaded. An advantage to do that is that for example we can prevent accidental metadata changes when the signature is portable. Roberto HUAWEI TECHNOLOGIES Duesseldorf GmbH, HRB 56063 Managing Director: Li Peng, Li Jian, Shi Yanli