Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp812363pxk; Mon, 31 Aug 2020 01:26:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyktyYD515OYslGKWtRaVaIJ7rkmzztCuoTqxLkfw+spSMuajhC4etGLv2K2JLYRWU6GVYU X-Received: by 2002:a17:906:9512:: with SMTP id u18mr62572ejx.365.1598862415891; Mon, 31 Aug 2020 01:26:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598862415; cv=none; d=google.com; s=arc-20160816; b=uSy7j8nqGA6Ry2vRKLaVDJE7W0ugBPpXQWR9ovRf9hKUQrngeL5UZZ2nx9oTQDxYmv GAHn1tbYRsOlc6ec8b/o2gbFt/HQdNwneKdQSAaNcMe5elPEjRkU/WQPHF4e3T/qaQ3+ 47FqyHK9foZcPAYFHr672IlRq25AoezVfdiCPXxNsQLVccyksxgqgDuUsi81DJ/oaTFl BtMzH28TDplUFSudtkUkQklNR9KCaBgmNXr+zCsCqfYAXW0ixt0Pr0bI9aBP8pKIPZKs /v/LA0oebuwI5Rw+czBL16ykAH9S1FGIIlQbpbUr22zQqmwfY1bA8FvkqJ8IXixABT2t bvWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender: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=x7aAl4IF4GuH+ACqu6JTZ6eRjvFP1/8ssHK4/u7Jcdk=; b=vxeyEvLcCOoaYU9eyZZriZK0GWMQgfOgHgMSzNE1E94Lot9XoFo2bpaerSZrJcN7gu YiEgQQo+Ag90psB69iy+C9/5W2a+MkT0o3W7x26LDuZI6OO1x9QZQD9m2kqDBGtxYoyp ADUmvvvfFDwcUQvig9QHX6Ch/C0IcBFcS5mGvoyc/Bi22biuUUUPwdE8MhfY5PROosKc kSt2qQSD0e6fQYTX2F8yyfA8PpdaCuT86rpMcU9M7lCY/b96NcOYfd+b9/PBI6MUI/uw Caw8iir9PXak1hnTmWHe701zQTLnbmR+di8SBh1CATu6OWC3AyEhQCTKhwo4I1T5n7Qx xQIg== 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 n3si5333891eji.384.2020.08.31.01.26.33; Mon, 31 Aug 2020 01:26:55 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728272AbgHaIYe convert rfc822-to-8bit (ORCPT + 99 others); Mon, 31 Aug 2020 04:24:34 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:2709 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728240AbgHaIYO (ORCPT ); Mon, 31 Aug 2020 04:24:14 -0400 Received: from lhreml717-chm.china.huawei.com (unknown [172.18.7.107]) by Forcepoint Email with ESMTP id F1F1CF6FF3E8EA4DA731; Mon, 31 Aug 2020 09:24:09 +0100 (IST) Received: from fraeml704-chm.china.huawei.com (10.206.15.53) by lhreml717-chm.china.huawei.com (10.201.108.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1913.5; Mon, 31 Aug 2020 09:24:09 +0100 Received: from fraeml714-chm.china.huawei.com (10.206.15.33) by fraeml704-chm.china.huawei.com (10.206.15.53) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1913.5; Mon, 31 Aug 2020 10:24:08 +0200 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.1913.007; Mon, 31 Aug 2020 10:24:08 +0200 From: Roberto Sassu To: Mimi Zohar , "mjg59@google.com" CC: "linux-integrity@vger.kernel.org" , "linux-security-module@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" , Silviu Vlasceanu Subject: RE: [PATCH 03/11] evm: Refuse EVM_ALLOW_METADATA_WRITES only if the HMAC key is loaded Thread-Topic: [PATCH 03/11] evm: Refuse EVM_ALLOW_METADATA_WRITES only if the HMAC key is loaded Thread-Index: AQHWRYof9RvD1u4yLUW/etQ+7VmgjKlDQsYAgA8N9fA= Date: Mon, 31 Aug 2020 08:24:08 +0000 Message-ID: <0c1c8fb398c340d89531360be7e3418b@huawei.com> References: <20200618160133.937-1-roberto.sassu@huawei.com> <20200618160133.937-3-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.48.205.186] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Mimi Zohar [mailto:zohar@linux.ibm.com] > Sent: Friday, August 21, 2020 10:15 PM > Hi Roberto, > > On Thu, 2020-06-18 at 18:01 +0200, Roberto Sassu wrote: > > Granting metadata write is safe if the HMAC key is not loaded, as it won't > > let an attacker obtain a valid HMAC from corrupted xattrs. > evm_write_key() > > however does not allow it if any key is loaded, including a public key, > > which should not be a problem. > > > > Why is the existing hebavior a problem? What is the problem being > solved? Hi Mimi currently it is not possible to set EVM_ALLOW_METADATA_WRITES when only a public key is loaded and the HMAC key is not. The patch removes this limitation. > > This patch allows setting EVM_ALLOW_METADATA_WRITES if the > EVM_INIT_HMAC > > flag is not set. > > > > Cc: stable@vger.kernel.org # 4.16.x > > Fixes: ae1ba1676b88e ("EVM: Allow userland to permit modification of > EVM-protected metadata") > > Signed-off-by: Roberto Sassu > > --- > > security/integrity/evm/evm_secfs.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/security/integrity/evm/evm_secfs.c > b/security/integrity/evm/evm_secfs.c > > index cfc3075769bb..92fe26ace797 100644 > > --- a/security/integrity/evm/evm_secfs.c > > +++ b/security/integrity/evm/evm_secfs.c > > @@ -84,7 +84,7 @@ static ssize_t evm_write_key(struct file *file, const > char __user *buf, > > * keys are loaded. > > */ > > if ((i & EVM_ALLOW_METADATA_WRITES) && > > - ((evm_initialized & EVM_KEY_MASK) != 0) && > > + ((evm_initialized & EVM_INIT_HMAC) != 0) && > > !(evm_initialized & EVM_ALLOW_METADATA_WRITES)) > > return -EPERM; > > > > > Documentation/ABI/testing/evm needs to be updated as well. Ok. Thanks Roberto HUAWEI TECHNOLOGIES Duesseldorf GmbH, HRB 56063 Managing Director: Li Peng, Li Jian, Shi Yanli > thanks, > > Mimi > >