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
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230830-kultfigur-verrohen-a689c59911d6@brauner>
Date:   Wed, 30 Aug 2023 11:53:32 +0200
From:   Christian Brauner <brauner@...nel.org>
To:     Roberto Sassu <roberto.sassu@...weicloud.com>
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, Aug 30, 2023 at 11:31:35AM +0200, Roberto Sassu wrote:
> 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?

Only if you call anything from any implementers of the hook that needs
access to the idmap.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ