Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp367739rdb; Thu, 15 Feb 2024 02:40:43 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVBJUPs5G7LuIpvmb5fIGXflunlCbc2PK7ccUkmAQeuTNc7zUPJASMLeNujY2aMHa4/Dv10YYpImNiJ2XlgbWxZQdQnTJpmoXCTnQXc3A== X-Google-Smtp-Source: AGHT+IHqKjxpdbfnHb46re6aZtMkI7q0AktNd8jb6a8PUhBw088TrgmfCuoLZ6kBcVj55ySlKf9X X-Received: by 2002:a05:6402:7d0:b0:561:dd88:bdca with SMTP id u16-20020a05640207d000b00561dd88bdcamr1029148edy.2.1707993642957; Thu, 15 Feb 2024 02:40:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707993642; cv=pass; d=google.com; s=arc-20160816; b=0EaDc3BNeOtnYEEdfYPoIJjn943llZLGU6LcZeDE8/PuXsU5fpD5Pv/aSy6m5LFUN0 5LUW959e3zfH2502zqsFqWCkAbYOv6ajffkSdhGXbH0x73Dv67FaKfLQiHUBtxQnvxO8 ugXkib7gnu6M6a8RUOTQNsuLCnwitUVbeK2+xwYHi85/qcYQrhiy2LBq1wQLAjrqfJbj pizfrF+4shgff03slbTxKPi8cbqqFoWYeoxAFMnDUWQiut4G4z5xnZjZgkGlBmNa5olv J5kc1Lk/Oomg/zDniqMMOiOWVza5OO6iPHJbY+y7NaOeHdv67kMbq/6CRA/eIRxE0Rdt 62Rw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=HlHJJTgbRPRW2FQ9anIpmshIQcj3JKTYVaEz290nlPA=; fh=C7VaS7fJHJaXY9o4fxqaroT+WFK+RA+7oLyqXjEJXBc=; b=gufN7NNhDjFrXettOc9ci4gA8MTya/EftUmquJMLMwt/lBQCQjA0FJZqqENwR1PQZu ck41iqmG0Zp/RpAujvakYtXrjQB9rv3jRqT3m/ROO2ZBe/puiYIVYhLyXMc+nrkypYcg V51vsO+625qcgpWLNSXIYpL53XxQiEYjRwk7FSroowbyAL1DQIfATJGaPsGTDvJ4kJb/ ugqS9oJk97zRUd1r9qGUpG3GZ28WzJuDYscpCOOy3mzk+Gxbehgk5v9vbM8L8ikbEt6G xCDNKqLVUCXE9DSRG8BUcVWDuMlKfKpdjgXv4zrighep3D6Dx6XCQOF4D8/L44e23jAz fcfA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-66657-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66657-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id m1-20020a50d7c1000000b00560c1cc0c71si544491edj.678.2024.02.15.02.40.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Feb 2024 02:40:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-66657-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-66657-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-66657-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B0E891F22387 for ; Thu, 15 Feb 2024 10:40:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A604131E53; Thu, 15 Feb 2024 10:33:27 +0000 (UTC) Received: from frasgout13.his.huawei.com (frasgout13.his.huawei.com [14.137.139.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 989F712A14C; Thu, 15 Feb 2024 10:33:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=14.137.139.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707993206; cv=none; b=KDZR4wpor7toREWxxFZOrh6Tr2zL4NVuEQN7wuMcNbYbf9TrdYCs1JxQtdGdVpjMIFO9OrbAJHvq1MS8oKmc2GEQdFbhBiVqD0okFktti63JgnNVY64+7PmfM3c/5m9E6EQ+GtCorgqULiIGHDgO120pc2soyR2a1Q8I9g8NZ9A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707993206; c=relaxed/simple; bh=Gb8s5hzWOm5I00aSMDXJz+YZ4iuHCLS/ph57hZsjdSw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=OwB12jsdLnoeEsXqOa6xAw01Ocf3wNGkhs2jP2arv1zGrQyd/4CcSH5NBgjaRatdN8efa7DHhdVyosndCILVIHIJ6CGA31ZCb5P7+3lcV75mOjoQh93eX/FzfPk6gg419VWconZ+Zg0fNO6ReaPF+eoO1UZltW/Fm3Zb1UqYZXc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=14.137.139.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.18.186.29]) by frasgout13.his.huawei.com (SkyGuard) with ESMTP id 4Tb9xT0hzHz9yB76; Thu, 15 Feb 2024 18:18:05 +0800 (CST) Received: from mail02.huawei.com (unknown [7.182.16.27]) by mail.maildlp.com (Postfix) with ESMTP id F239D1406BF; Thu, 15 Feb 2024 18:33:11 +0800 (CST) Received: from huaweicloud.com (unknown [10.204.63.22]) by APP2 (Coremail) with SMTP id GxC2BwAXUCQD6M1lUHGHAg--.4426S8; Thu, 15 Feb 2024 11:33:11 +0100 (CET) From: Roberto Sassu To: viro@zeniv.linux.org.uk, brauner@kernel.org, jack@suse.cz, chuck.lever@oracle.com, jlayton@kernel.org, neilb@suse.de, kolga@netapp.com, Dai.Ngo@oracle.com, tom@talpey.com, paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com, zohar@linux.ibm.com, dmitry.kasatkin@gmail.com, eric.snowberg@oracle.com, dhowells@redhat.com, jarkko@kernel.org, stephen.smalley.work@gmail.com, omosnace@redhat.com, casey@schaufler-ca.com, shuah@kernel.org, mic@digikod.net Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-security-module@vger.kernel.org, linux-integrity@vger.kernel.org, keyrings@vger.kernel.org, selinux@vger.kernel.org, linux-kselftest@vger.kernel.org, Roberto Sassu , Stefan Berger Subject: [PATCH v10 06/25] evm: Align evm_inode_post_setattr() definition with LSM infrastructure Date: Thu, 15 Feb 2024 11:30:54 +0100 Message-Id: <20240215103113.2369171-7-roberto.sassu@huaweicloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240215103113.2369171-1-roberto.sassu@huaweicloud.com> References: <20240215103113.2369171-1-roberto.sassu@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transf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v26r1j6r4UMIIF0xvEx4 A2jsIEc7CjxVAFwI0_Gr1j6F4UJbIYCTnIWIevJa73UjIFyTuYvjxUFgAwUUUUU X-CM-SenderInfo: purev21wro2thvvxqx5xdzvxpfor3voofrz/1tbiAQAOBF1jj5pfXAAAsj From: Roberto Sassu Change evm_inode_post_setattr() definition, so that it can be registered as implementation of the inode_post_setattr hook (to be introduced). Signed-off-by: Roberto Sassu Reviewed-by: Stefan Berger Reviewed-by: Casey Schaufler Reviewed-by: Mimi Zohar Reviewed-by: Paul Moore Acked-by: Mimi Zohar --- fs/attr.c | 2 +- include/linux/evm.h | 6 ++++-- security/integrity/evm/evm_main.c | 4 +++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/fs/attr.c b/fs/attr.c index b53ae408ad4f..adeba0ec40f1 100644 --- a/fs/attr.c +++ b/fs/attr.c @@ -503,7 +503,7 @@ int notify_change(struct mnt_idmap *idmap, struct dentry *dentry, if (!error) { fsnotify_change(dentry, ia_valid); ima_inode_post_setattr(idmap, dentry, ia_valid); - evm_inode_post_setattr(dentry, ia_valid); + evm_inode_post_setattr(idmap, dentry, ia_valid); } return error; diff --git a/include/linux/evm.h b/include/linux/evm.h index 36ec884320d9..5cc386312b5a 100644 --- a/include/linux/evm.h +++ b/include/linux/evm.h @@ -23,7 +23,8 @@ extern enum integrity_status evm_verifyxattr(struct dentry *dentry, struct integrity_iint_cache *iint); extern int evm_inode_setattr(struct mnt_idmap *idmap, struct dentry *dentry, struct iattr *attr); -extern void evm_inode_post_setattr(struct dentry *dentry, int ia_valid); +extern void evm_inode_post_setattr(struct mnt_idmap *idmap, + struct dentry *dentry, int ia_valid); extern int evm_inode_setxattr(struct mnt_idmap *idmap, struct dentry *dentry, const char *name, const void *value, size_t size); @@ -98,7 +99,8 @@ static inline int evm_inode_setattr(struct mnt_idmap *idmap, return 0; } -static inline void evm_inode_post_setattr(struct dentry *dentry, int ia_valid) +static inline void evm_inode_post_setattr(struct mnt_idmap *idmap, + struct dentry *dentry, int ia_valid) { return; } diff --git a/security/integrity/evm/evm_main.c b/security/integrity/evm/evm_main.c index cc7956d7878b..ac34f21122cd 100644 --- a/security/integrity/evm/evm_main.c +++ b/security/integrity/evm/evm_main.c @@ -870,6 +870,7 @@ int evm_inode_setattr(struct mnt_idmap *idmap, struct dentry *dentry, /** * evm_inode_post_setattr - update 'security.evm' after modifying metadata + * @idmap: idmap of the idmapped mount * @dentry: pointer to the affected dentry * @ia_valid: for the UID and GID status * @@ -879,7 +880,8 @@ int evm_inode_setattr(struct mnt_idmap *idmap, struct dentry *dentry, * This function is called from notify_change(), which expects the caller * to lock the inode's i_mutex. */ -void evm_inode_post_setattr(struct dentry *dentry, int ia_valid) +void evm_inode_post_setattr(struct mnt_idmap *idmap, struct dentry *dentry, + int ia_valid) { if (!evm_revalidate_status(NULL)) return; -- 2.34.1