[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1c6b3d9d21242d63937668e8cbfb3c75@paul-moore.com>
Date: Wed, 07 Feb 2024 22:18:54 -0500
From: Paul Moore <paul@...l-moore.com>
To: Roberto Sassu <roberto.sassu@...weicloud.com>, viro@...iv.linux.org.uk, brauner@...nel.org, chuck.lever@...cle.com, jlayton@...nel.org, neilb@...e.de, kolga@...app.com, Dai.Ngo@...cle.com, tom@...pey.com, jmorris@...ei.org, serge@...lyn.com, zohar@...ux.ibm.com, dmitry.kasatkin@...il.com, eric.snowberg@...cle.com, dhowells@...hat.com, jarkko@...nel.org, stephen.smalley.work@...il.com, eparis@...isplace.org, casey@...aufler-ca.com, shuah@...nel.org, mic@...ikod.net
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org, linux-nfs@...r.kernel.org, linux-security-module@...r.kernel.org, linux-integrity@...r.kernel.org, keyrings@...r.kernel.org, selinux@...r.kernel.org, linux-kselftest@...r.kernel.org, Roberto Sassu <roberto.sassu@...wei.com>
Subject: Re: [PATCH v9 23/25] evm: Make it independent from 'integrity' LSM
On Jan 15, 2024 Roberto Sassu <roberto.sassu@...weicloud.com> wrote:
>
> Define a new structure for EVM-specific metadata, called evm_iint_cache,
> and embed it in the inode security blob. Introduce evm_iint_inode() to
> retrieve metadata, and register evm_inode_alloc_security() for the
> inode_alloc_security LSM hook, to initialize the structure (before
> splitting metadata, this task was done by iint_init_always()).
>
> Keep the non-NULL checks after calling evm_iint_inode() except in
> evm_inode_alloc_security(), to take into account inodes for which
> security_inode_alloc() was not called. When using shared metadata,
> obtaining a NULL pointer from integrity_iint_find() meant that the file
> wasn't in the IMA policy. Now, because IMA and EVM use disjoint metadata,
> the EVM status has to be stored for every inode regardless of the IMA
> policy.
>
> Given that from now on EVM relies on its own metadata, remove the iint
> parameter from evm_verifyxattr(). Also, directly retrieve the iint in
> evm_verify_hmac(), called by both evm_verifyxattr() and
> evm_verify_current_integrity(), since now there is no performance penalty
> in retrieving EVM metadata (constant time).
>
> Replicate the management of the IMA_NEW_FILE flag, by introducing
> evm_post_path_mknod() and evm_file_release() to respectively set and clear
> the newly introduced flag EVM_NEW_FILE, at the same time IMA does. Like for
> IMA, select CONFIG_SECURITY_PATH when EVM is enabled, to ensure that files
> are marked as new.
>
> Unlike ima_post_path_mknod(), evm_post_path_mknod() cannot check if a file
> must be appraised. Thus, it marks all affected files. Also, it does not
> clear EVM_NEW_FILE depending on i_version, but that is not a problem
> because IMA_NEW_FILE is always cleared when set in ima_check_last_writer().
>
> Move the EVM-specific flag EVM_IMMUTABLE_DIGSIG to
> security/integrity/evm/evm.h, since that definition is now unnecessary in
> the common integrity layer.
>
> Finally, switch to the LSM reservation mechanism for the EVM xattr, and
> consequently decrement by one the number of xattrs to allocate in
> security_inode_init_security().
>
> Signed-off-by: Roberto Sassu <roberto.sassu@...wei.com>
> Reviewed-by: Casey Schaufler <casey@...aufler-ca.com>
> ---
> include/linux/evm.h | 8 +--
> security/integrity/evm/Kconfig | 1 +
> security/integrity/evm/evm.h | 19 +++++++
> security/integrity/evm/evm_crypto.c | 4 +-
> security/integrity/evm/evm_main.c | 76 ++++++++++++++++++++-------
> security/integrity/ima/ima_appraise.c | 2 +-
> security/integrity/integrity.h | 1 -
> security/security.c | 4 +-
> 8 files changed, 83 insertions(+), 32 deletions(-)
Acked-by: Paul Moore <paul@...l-moore.com>
--
paul-moore.com
Powered by blists - more mailing lists