[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9d482f25475a9d9bc0c93a8cbaf8bd4bb67d2cd6.camel@huaweicloud.com>
Date: Wed, 30 Aug 2023 11:31:35 +0200
From: Roberto Sassu <roberto.sassu@...weicloud.com>
To: brauner@...nel.org
Cc: Mimi Zohar <zohar@...ux.ibm.com>, viro@...iv.linux.org.uk,
chuck.lever@...cle.com, jlayton@...nel.org,
dmitry.kasatkin@...il.com, paul@...l-moore.com, jmorris@...ei.org,
serge@...lyn.com, dhowells@...hat.com, jarkko@...nel.org,
stephen.smalley.work@...il.com, eparis@...isplace.org,
casey@...aufler-ca.com, linux-fsdevel@...r.kernel.org,
linux-nfs@...r.kernel.org, linux-integrity@...r.kernel.org,
linux-security-module@...r.kernel.org, keyrings@...r.kernel.org,
selinux@...r.kernel.org, linux-kernel@...r.kernel.org,
stefanb@...ux.ibm.com, Roberto Sassu <roberto.sassu@...wei.com>
Subject: Re: [PATCH 15/28] security: Introduce inode_post_removexattr hook
On Wed, 2023-03-08 at 10:43 -0500, Mimi Zohar wrote:
> Hi Roberto,
>
> On Fri, 2023-03-03 at 19:18 +0100, Roberto Sassu wrote:
> > From: Roberto Sassu <roberto.sassu@...wei.com>
> >
> > In preparation for moving IMA and EVM to the LSM infrastructure, introduce
> > the inode_post_removexattr hook.
> >
> > Signed-off-by: Roberto Sassu <roberto.sassu@...wei.com>
> > ---
> > fs/xattr.c | 1 +
> > include/linux/lsm_hook_defs.h | 2 ++
> > include/linux/security.h | 5 +++++
> > security/security.c | 14 ++++++++++++++
> > 4 files changed, 22 insertions(+)
> >
> > diff --git a/fs/xattr.c b/fs/xattr.c
> > index 14a7eb3c8fa..10c959d9fc6 100644
> > --- a/fs/xattr.c
> > +++ b/fs/xattr.c
> > @@ -534,6 +534,7 @@ __vfs_removexattr_locked(struct mnt_idmap *idmap,
> >
> > if (!error) {
> > fsnotify_xattr(dentry);
> > + security_inode_post_removexattr(dentry, name);
> > evm_inode_post_removexattr(dentry, name);
> > }
>
> Nothing wrong with this, but other places in this function test "if
> (error) goto ...". Perhaps it is time to clean this up.
>
> >
> > diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h
> > index eedefbcdde3..2ae5224d967 100644
> > --- a/include/linux/lsm_hook_defs.h
> > +++ b/include/linux/lsm_hook_defs.h
> > @@ -147,6 +147,8 @@ LSM_HOOK(int, 0, inode_getxattr, struct dentry *dentry, const char *name)
> > LSM_HOOK(int, 0, inode_listxattr, struct dentry *dentry)
> > LSM_HOOK(int, 0, inode_removexattr, struct mnt_idmap *idmap,
> > struct dentry *dentry, const char *name)
> > +LSM_HOOK(void, LSM_RET_VOID, inode_post_removexattr, struct dentry *dentry,
> > + const char *name)
>
> @Christian should the security_inode_removexattr() and
> security_inode_post_removexattr() arguments be the same?
Probably this got lost.
Christian, should security_inode_post_removexattr() have the idmap
parameter as well?
Thanks
Roberto
> > LSM_HOOK(int, 0, inode_set_acl, struct mnt_idmap *idmap,
> > struct dentry *dentry, const char *acl_name, struct posix_acl *kacl)
> > LSM_HOOK(int, 0, inode_get_acl, struct mnt_idmap *idmap,
>
Powered by blists - more mailing lists