[RFC PATCH 2/2] integrity: double check iint_cache was initialized

Tetsuo Handa penguin-kernel at i-love.sakura.ne.jp
Tue Mar 23 13:37:39 UTC 2021


On 2021/03/23 21:09, Mimi Zohar wrote:
> Please take a look at the newer version of this patch.   Do you want to
> add any tags?

Oh, I didn't know that you already posted the newer version.

> diff --git a/security/integrity/iint.c b/security/integrity/iint.c
> index 1d20003243c3..0ba01847e836 100644
> --- a/security/integrity/iint.c
> +++ b/security/integrity/iint.c
> @@ -98,6 +98,14 @@ struct integrity_iint_cache *integrity_inode_get(struct inode *inode)
>  	struct rb_node *node, *parent = NULL;
>  	struct integrity_iint_cache *iint, *test_iint;
>  
> +	/*
> +	 * The integrity's "iint_cache" is initialized at security_init(),
> +	 * unless it is not included in the ordered list of LSMs enabled
> +	 * on the boot command line.
> +	 */
> +	if (!iint_cache)
> +		panic("%s: lsm=integrity required.\n", __func__);
> +

This looks strange. If "lsm=" parameter must include "integrity",
it implies that nobody is allowed to disable "integrity" at boot.
Then, why not unconditionally call integrity_iintcache_init() by
not counting on DEFINE_LSM(integrity) declaration?

>  	iint = integrity_iint_find(inode);
>  	if (iint)
>  		return iint;
> 



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