Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp813787rdb; Fri, 9 Feb 2024 01:45:52 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUrJ5Hs3jI2VEzu44xqT16shI04t/g9Bz8D763pz9drsSXbxuG1QFu/OVvwzxi68oPZENOOmt9fCiBTLy3Fmci/HB9d8rVDmeQVfDD61A== X-Google-Smtp-Source: AGHT+IHB31iaOwiSVwy2WBFCWWyWQYN/UvW7HiAHOz5WL5frcUV72KkfLAocVx6z3XtrWk3MC/BC X-Received: by 2002:a05:620a:4d6:b0:783:def5:dae4 with SMTP id 22-20020a05620a04d600b00783def5dae4mr1154233qks.25.1707471951836; Fri, 09 Feb 2024 01:45:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707471951; cv=pass; d=google.com; s=arc-20160816; b=FqTebLhqnlzvFlwT9yuvf9q3vFC6p9NtVU5sUNqtYwdTYKmkZbnBTQ7HO8P4sXxSLd kOCxDCNTc8Xl7pXWKNgIhQwuSCVQUfJxnmjyp+NV+JQrUU5g9Z+SAz+YBKilA1okHEbw cZPKx+s/hVDPMyEjGvQRLlR6XqbZcwE/hnEzMidXnWyemOd4JcUHvpIi6h2acDJW/n4O P8t/xffvhFrq+ItZgiDQLu6jYbz0lmDBgokwKwntOEyVcTBxyWU5hCLWql5ufaBfygWw VXwDBbLiIRlR5s9Z6Ll+ta3wIAXAdFD7orurq6XqR8GMx1NLfSILoq/VciSdTnOtYA2S sfgg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=mKp4TMKyJHftiLtVHIUC206mGZ/sF+vPqQihs+f8Hds=; fh=dZsoxok3qmd++jdRNv6qyBtTWL2GjmFB2I0FHJBgpKg=; b=vwzwVvJM09PAFzdTZSKwT0Lmzpx8v3NrsIXgRB2bgo9QiX//aeJkD82LNWaQJOLdpv LdDBMPoqZXyqu+0SuLrHC3wiBNKPBijX9CklRHwUA9tr6HWm4bTypB2wW5tbBtXS77Fw 8YS06hQnMuVrXC5cRnaFuCdicPcmqi5k9h2ohiBX0Tjoc7YQeEx5ULYG2MN+Tr1o1o3K etgRcwn6DM7gOIpEd2wIVgpNnGoJ+imubdlaTNIPVVOLZN0egjiAx7+6EVc5a2wlpom+ 6XTF8SPwqb7Zpb/CmkDqEkecOD0xRjXSQUz0xNmQu1YIThcIHdaUEnumep6z2XFN36Ws vGIw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gV5hsKuy; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1872-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1872-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCUypTDl1nFZNCRFZY9xsUc7UMYkLI9JiZqNiOPQcDUYh+9Q1M+cYE1mQr6dlos3zFVwtkCc8Hnw68de4Wn9R4nIIy+eAhMyBI4rFXXLFQ== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id bj18-20020a05620a191200b00783da608917si1755456qkb.246.2024.02.09.01.45.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Feb 2024 01:45:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-1872-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=gV5hsKuy; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-nfs+bounces-1872-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-1872-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 969B21C22FFA for ; Fri, 9 Feb 2024 09:45:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 98A8067A18; Fri, 9 Feb 2024 09:45:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="gV5hsKuy" X-Original-To: linux-nfs@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5661D664A3; Fri, 9 Feb 2024 09:45:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707471945; cv=none; b=pS5Mvjvmw42xxt76g31zwX9gFTw1lscqNe0sXV0+06U7an3rvG1rrRW7ABxeBQ9Mn39s6SKtf3rVZ3E4TRdQRjO+V0A/XdsI9eMGm3mAvm/1uiFoYV9GnYdIrngPSnH0aBo2063+4GU5D7lgFay1vhPWS4kZmP6VmmChF2q/48E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707471945; c=relaxed/simple; bh=XTXqRfUyPr9yWhoo/YdxJVLsEINDyd7wbqRVK/40Huo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=M2t1mSVwSmdoKyzvwIT3dqgLAJ9TNILgFCzEIwYtib8i/z/hpjAVK/nY1TaEUdt327CMlTJfnwodVct1K974ICNcQLm+nZXSlBftt32GVDc5AOL6uuBrTrHYEaFzoJWxLP0FPR93Xi7kB3n1jacTcxrvRvRIgp/TY3TjDOSTR/w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gV5hsKuy; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2B33C433F1; Fri, 9 Feb 2024 09:45:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707471944; bh=XTXqRfUyPr9yWhoo/YdxJVLsEINDyd7wbqRVK/40Huo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=gV5hsKuy6kT4l1bW8GZQNbBAOcQ5vrq9TCkNC4UkHaVG8K5YdmTb7Rljqylfgd5b+ 2s9p+kfOyecmgRJzJG7s/swPntcVrYHyLfgg9BacyhQ5j85Tbc/Srp5jtabGK3h/jv di2qzjjAy1T5Yy5qimr+TqM+cee7u3/ZVQz46v9ijl/vslb531JM+z/Q6PE1iNRF2D a13Rt/M+jVUdTAdXGsZTaFn8piYBphLPWfDe53a+UOTDl2CJlzrvKDBinuwO9V9MTc JG22L/hmv3iJll4DQE3t+L9z9dt0K0IQnQB9gqAFiprn4ZZxO3fVQcPH+FiWTW/IvQ pFSSNKDpbPo0g== Date: Fri, 9 Feb 2024 10:45:35 +0100 From: Christian Brauner To: Roberto Sassu Cc: viro@zeniv.linux.org.uk, 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, eparis@parisplace.org, casey@schaufler-ca.com, shuah@kernel.org, mic@digikod.net, 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: Re: [PATCH v9 21/25] ima: Move IMA-Appraisal to LSM infrastructure Message-ID: <20240209-chancenreich-albatros-4dad750ab5f8@brauner> References: <20240115181809.885385-1-roberto.sassu@huaweicloud.com> <20240115181809.885385-22-roberto.sassu@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240115181809.885385-22-roberto.sassu@huaweicloud.com> On Mon, Jan 15, 2024 at 07:18:05PM +0100, Roberto Sassu wrote: > From: Roberto Sassu > > A few additional IMA hooks are needed to reset the cached appraisal > status, causing the file's integrity to be re-evaluated on next access. > Register these IMA-appraisal only functions separately from the rest of IMA > functions, as appraisal is a separate feature not necessarily enabled in > the kernel configuration. > > Reuse the same approach as for other IMA functions, move hardcoded calls > from various places in the kernel to the LSM infrastructure. Declare the > functions as static and register them as hook implementations in > init_ima_appraise_lsm(), called by init_ima_lsm(). > > Also move the inline function ima_inode_remove_acl() from the public ima.h > header to ima_appraise.c. > > Signed-off-by: Roberto Sassu > Reviewed-by: Stefan Berger > Reviewed-by: Mimi Zohar > --- > fs/attr.c | 2 - > include/linux/ima.h | 55 --------------------------- > security/integrity/ima/ima.h | 5 +++ > security/integrity/ima/ima_appraise.c | 38 +++++++++++++----- > security/integrity/ima/ima_main.c | 1 + > security/security.c | 13 ------- > 6 files changed, 35 insertions(+), 79 deletions(-) > > diff --git a/fs/attr.c b/fs/attr.c > index 221d2bb0a906..38841f3ebbcb 100644 > --- a/fs/attr.c > +++ b/fs/attr.c > @@ -17,7 +17,6 @@ > #include > #include > #include > -#include > > #include "internal.h" > > @@ -503,7 +502,6 @@ int notify_change(struct mnt_idmap *idmap, struct dentry *dentry, > if (!error) { > fsnotify_change(dentry, ia_valid); > security_inode_post_setattr(idmap, dentry, ia_valid); > - ima_inode_post_setattr(idmap, dentry, ia_valid); > evm_inode_post_setattr(idmap, dentry, ia_valid); > } Acked-by: Christian Brauner