lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Message-ID: <92c36707c8f9398f7f626c3da01bb98586880836.camel@huaweicloud.com> Date: Thu, 09 Mar 2023 14:07:26 +0100 From: Roberto Sassu <roberto.sassu@...weicloud.com> To: 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, brauner@...nel.org Cc: 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. Theoretically, all 'goto out' can be replaced with 'return error'. I would be more in favor of minimizing the changes as much as possible to reach the main goal. But it is ok also to change the last part. Thanks Roberto > > > > 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? > > > 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