[PATCH v2 11/25] security: Align inode_setattr hook definition with EVM

Jarkko Sakkinen jarkko at kernel.org
Mon Sep 11 10:50:18 UTC 2023


On Tue Sep 5, 2023 at 6:56 PM EEST, Casey Schaufler wrote:
> On 9/4/2023 2:08 PM, Jarkko Sakkinen wrote:
> > On Thu Aug 31, 2023 at 1:41 PM EEST, Roberto Sassu wrote:
> >> From: Roberto Sassu <roberto.sassu at huawei.com>
> >>
> >> Add the idmap parameter to the definition, so that evm_inode_setattr() can
> >> be registered as this hook implementation.
> >>
> >> Signed-off-by: Roberto Sassu <roberto.sassu at huawei.com>
> >> Reviewed-by: Stefan Berger <stefanb at linux.ibm.com>
> >> Acked-by: Casey Schaufler <casey at schaufler-ca.com>
> >> ---
> >>  include/linux/lsm_hook_defs.h | 3 ++-
> >>  security/security.c           | 2 +-
> >>  security/selinux/hooks.c      | 3 ++-
> >>  security/smack/smack_lsm.c    | 4 +++-
> >>  4 files changed, 8 insertions(+), 4 deletions(-)
> >>
> >> diff --git a/include/linux/lsm_hook_defs.h b/include/linux/lsm_hook_defs.h
> >> index 4bdddb52a8fe..fdf075a6b1bb 100644
> >> --- a/include/linux/lsm_hook_defs.h
> >> +++ b/include/linux/lsm_hook_defs.h
> >> @@ -134,7 +134,8 @@ LSM_HOOK(int, 0, inode_readlink, struct dentry *dentry)
> >>  LSM_HOOK(int, 0, inode_follow_link, struct dentry *dentry, struct inode *inode,
> >>  	 bool rcu)
> >>  LSM_HOOK(int, 0, inode_permission, struct inode *inode, int mask)
> >> -LSM_HOOK(int, 0, inode_setattr, struct dentry *dentry, struct iattr *attr)
> >> +LSM_HOOK(int, 0, inode_setattr, struct mnt_idmap *idmap, struct dentry *dentry,
> >> +	 struct iattr *attr)
> > LSM_HOOK(int, 0, inode_setattr, struct mnt_idmap *idmap, struct dentry *dentry, struct iattr *attr)
> >
> > Only 99 characters, i.e. breaking into two lines is not necessary.
>
> We're keeping the LSM code in the ancient 80 character format.
> Until we get some fresh, young maintainers involved who can convince
> us that line wrapped 80 character terminals are kewl we're sticking
> with what we know.
>
> 	https://lwn.net/Articles/822168/

Pretty artificial counter-example tbh :-) Even with Rust people tend to
stick one character variable names for trivial integer indices.

BR, Jarkko



More information about the Linux-security-module-archive mailing list