Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp931262yba; Thu, 16 May 2019 11:11:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxG1w1L8gBbA5/+gakyfk6BrYrI2IC6MP79JcfWs2eO44nuvmdF422Qdvc817CVPVkUdAcw X-Received: by 2002:a63:6f8e:: with SMTP id k136mr52712596pgc.104.1558030272524; Thu, 16 May 2019 11:11:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558030272; cv=none; d=google.com; s=arc-20160816; b=dz2UUkyzr9kWp0zrl5V7rooG2JtMaM7FRTq1TddOr1/OwWDpYGGOXOjOqj4GUM2n/i YTkBlw24VGUazCa57OvQmCihrnZs3ZQWp1MGQ0Wj7nr620UmK1MlpwRmT2+8np+B5WUs wLsZ18jPsiXZx0RneyvHJMtgynQfpHp3EhJVGwA9rcm+XXkkZQ715tVsEhDQpoj/paD/ e4d4wbLVZgGHcugv3NFSxacb45jBDO1E9ZtTxlBKylZXN+/nMnOgan9ITixMLusw8aJN kG53oaHNPSgLX3kDtQ+ibkpHykY2rGaBBT5BDQIxF3M0R9r1ablgt5duUCXJYaC7Y2y2 TgaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=dfxx8cUI3vhSf884quVvPxObosYF9eWKmDmSkIIGStI=; b=Y9pdrv0BnBDgLeItY3Wo+49qdgtvxI2MrlJWqmtrBCIWMoCqa8cr94g3AM7xXkSeCl hsLilj/KtAA7uK3NksFNaWLV8Ekab6fR51NAqQj/aL1ugIyY2biAcpQiWpeuSSdb2cLT 8bwsu9IjxuoR84DVNLsR3APj8g+PW6sV31ubUy70vO1XQ9cA5mCIDQRlsDDcoU2ek1ON CudRuhB0gBc82sM+fFjng/Lc5EgsWqk+an1VAY9OB1ljZ34oMCE31dPcw2lhhq9pdZCO KOp4WSODTLtUF+IQFfUV3+TrxRbLCaCrf0Htol7ppBXr+184XsR5PCQCuifU8gpEjCQc GO9g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o1si5610771pld.142.2019.05.16.11.10.54; Thu, 16 May 2019 11:11:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726951AbfEPQRn (ORCPT + 99 others); Thu, 16 May 2019 12:17:43 -0400 Received: from lhrrgout.huawei.com ([185.176.76.210]:32946 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726464AbfEPQRn (ORCPT ); Thu, 16 May 2019 12:17:43 -0400 Received: from LHREML713-CAH.china.huawei.com (unknown [172.18.7.106]) by Forcepoint Email with ESMTP id 7994C410BB2BC85C4A0F; Thu, 16 May 2019 17:17:41 +0100 (IST) Received: from roberto-HP-EliteDesk-800-G2-DM-65W.huawei.com (10.204.65.154) by smtpsuk.huawei.com (10.201.108.36) with Microsoft SMTP Server (TLS) id 14.3.408.0; Thu, 16 May 2019 17:17:32 +0100 From: Roberto Sassu To: , , CC: , , , , , Roberto Sassu , Subject: [PATCH 2/4] evm: reset status in evm_inode_post_setattr() Date: Thu, 16 May 2019 18:12:55 +0200 Message-ID: <20190516161257.6640-2-roberto.sassu@huawei.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190516161257.6640-1-roberto.sassu@huawei.com> References: <20190516161257.6640-1-roberto.sassu@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.204.65.154] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch adds a call to evm_reset_status() in evm_inode_post_setattr(), before security.evm is updated. The same is done in the other evm_inode_post_* functions. Fixes: 523b74b16bcbb ("evm: reset EVM status when file attributes change") Signed-off-by: Roberto Sassu Cc: stable@vger.kernel.org --- security/integrity/evm/evm_main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c index b6d9f14bc234..b41c2d8a8834 100644 --- a/security/integrity/evm/evm_main.c +++ b/security/integrity/evm/evm_main.c @@ -512,8 +512,11 @@ void evm_inode_post_setattr(struct dentry *dentry, int ia_valid) if (!evm_key_loaded()) return; - if (ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID)) + if (ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID)) { + evm_reset_status(dentry->d_inode); + evm_update_evmxattr(dentry, NULL, NULL, 0); + } } /* -- 2.17.1