Re: [PATCH v3 08/12] ima: add inode_post_setattr call

From: Kasatkin, Dmitry
Date: Thu Mar 22 2012 - 10:21:41 EST


On Wed, Mar 21, 2012 at 8:54 PM, Mimi Zohar <zohar@xxxxxxxxxxxxxxxxxx> wrote:
> Changing an inode's metadata may result in our not needing to appraise
> the file. ÂIn such cases, we must remove 'security.ima'.
>
> Changelog v1:
> - use ima_inode_post_setattr() stub function, if IMA_APPRAISE not configured
>
> Signed-off-by: Mimi Zohar <zohar@xxxxxxxxxx>
> Acked-by: Serge Hallyn <serge.hallyn@xxxxxxxxxx>

Acked-by: Dmitry Kasatkin <dmitry.kasatkin@xxxxxxxxx>

> ---
> Âfs/attr.c      |  Â2 ++
> Âinclude/linux/ima.h | Â 10 ++++++++++
> Â2 files changed, 12 insertions(+), 0 deletions(-)
>
> diff --git a/fs/attr.c b/fs/attr.c
> index d9bd7fc..f496bac 100644
> --- a/fs/attr.c
> +++ b/fs/attr.c
> @@ -14,6 +14,7 @@
> Â#include <linux/fcntl.h>
> Â#include <linux/security.h>
> Â#include <linux/evm.h>
> +#include <linux/ima.h>
>
> Â/**
> Â* inode_change_ok - check if attribute changes to an inode are allowed
> @@ -245,6 +246,7 @@ int notify_change(struct dentry * dentry, struct iattr * attr)
>
> Â Â Â Âif (!error) {
> Â Â Â Â Â Â Â Âfsnotify_change(dentry, ia_valid);
> + Â Â Â Â Â Â Â ima_inode_post_setattr(dentry);
> Â Â Â Â Â Â Â Âevm_inode_post_setattr(dentry, ia_valid);
> Â Â Â Â}
>
> diff --git a/include/linux/ima.h b/include/linux/ima.h
> index 6ac8e50..e2bfbb1 100644
> --- a/include/linux/ima.h
> +++ b/include/linux/ima.h
> @@ -39,5 +39,15 @@ static inline int ima_file_mmap(struct file *file, unsigned long prot)
> Â{
> Â Â Â Âreturn 0;
> Â}
> +
> Â#endif /* CONFIG_IMA_H */
> +
> +#ifdef CONFIG_IMA_APPRAISE
> +extern void ima_inode_post_setattr(struct dentry *dentry);
> +#else
> +static inline void ima_inode_post_setattr(struct dentry *dentry)
> +{
> + Â Â Â return;
> +}
> +#endif /* CONFIG_IMA_APPRAISE_H */
> Â#endif /* _LINUX_IMA_H */
> --
> 1.7.6.5
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/