lkml.org 
[lkml]   [2022]   [Oct]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/9] LSM: Introduce inode_post_setattr hook
On Thu, Oct 13, 2022 at 03:36:50PM -0700, Kees Cook wrote:
> IMA and EVM need to hook after setattr finishes. Introduce this hook and
> move IMA and EVM's open-coded stacking to use it.
>
> Cc: Mimi Zohar <zohar@linux.ibm.com>
> Cc: Dmitry Kasatkin <dmitry.kasatkin@gmail.com>
> Cc: Paul Moore <paul@paul-moore.com>
> Cc: James Morris <jmorris@namei.org>
> Cc: "Serge E. Hallyn" <serge@hallyn.com>
> Cc: Takashi Iwai <tiwai@suse.de>
> Cc: Jonathan McDowell <noodles@fb.com>
> Cc: Casey Schaufler <casey@schaufler-ca.com>
> Cc: linux-integrity@vger.kernel.org
> Cc: linux-security-module@vger.kernel.org
> Signed-off-by: Kees Cook <keescook@chromium.org>
> ---
> fs/attr.c | 3 +--
> include/linux/evm.h | 6 ------
> include/linux/ima.h | 9 ---------
> include/linux/lsm_hook_defs.h | 3 +++
> security/integrity/evm/evm_main.c | 10 +++++++++-
> security/integrity/ima/ima.h | 2 ++
> security/integrity/ima/ima_appraise.c | 2 +-
> security/integrity/ima/ima_main.c | 1 +
> security/security.c | 8 ++++++++
> 9 files changed, 25 insertions(+), 19 deletions(-)
>
> diff --git a/fs/attr.c b/fs/attr.c
> index 1552a5f23d6b..e5731057426b 100644
> --- a/fs/attr.c
> +++ b/fs/attr.c
> @@ -423,8 +423,7 @@ int notify_change(struct user_namespace *mnt_userns, struct dentry *dentry,
>
> if (!error) {
> fsnotify_change(dentry, ia_valid);
> - ima_inode_post_setattr(mnt_userns, dentry);
> - evm_inode_post_setattr(dentry, ia_valid);
> + security_inode_post_setattr(mnt_userns, dentry, ia_valid);

I like that change. In general, no more separate evm_* and ima_*
invocations in the vfs would be much appreciated.

\
 
 \ /
  Last update: 2022-10-18 16:50    [W:0.226 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site