[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <70e3be2a7f9672a9b193ac2b240540b8@paul-moore.com>
Date: Wed, 07 Feb 2024 22:18:51 -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 20/25] ima: Move to LSM infrastructure
On Jan 15, 2024 Roberto Sassu <roberto.sassu@...weicloud.com> wrote:
>
> Move hardcoded IMA function calls (not appraisal-specific functions) from
> various places in the kernel to the LSM infrastructure, by introducing a
> new LSM named 'ima' (at the end of the LSM list and always enabled like
> 'integrity').
>
> Having IMA before EVM in the Makefile is sufficient to preserve the
> relative order of the new 'ima' LSM in respect to the upcoming 'evm' LSM,
> and thus the order of IMA and EVM function calls as when they were
> hardcoded.
>
> Make moved functions as static (except ima_post_key_create_or_update(),
> which is not in ima_main.c), and register them as implementation of the
> respective hooks in the new function init_ima_lsm().
>
> Select CONFIG_SECURITY_PATH, to ensure that the path-based LSM hook
> path_post_mknod is always available and ima_post_path_mknod() is always
> executed to mark files as new, as before the move.
>
> A slight difference is that IMA and EVM functions registered for the
> inode_post_setattr, inode_post_removexattr, path_post_mknod,
> inode_post_create_tmpfile, inode_post_set_acl and inode_post_remove_acl
> won't be executed for private inodes. Since those inodes are supposed to be
> fs-internal, they should not be of interest of IMA or EVM. The S_PRIVATE
> flag is used for anonymous inodes, hugetlbfs, reiserfs xattrs, XFS scrub
> and kernel-internal tmpfs files.
>
> Conditionally register ima_post_key_create_or_update() if
> CONFIG_IMA_MEASURE_ASYMMETRIC_KEYS is enabled. Also, conditionally register
> ima_kernel_module_request() if CONFIG_INTEGRITY_ASYMMETRIC_KEYS is enabled.
>
> Finally, add the LSM_ID_IMA case in lsm_list_modules_test.c.
>
> Signed-off-by: Roberto Sassu <roberto.sassu@...wei.com>
> Acked-by: Chuck Lever <chuck.lever@...cle.com>
> Acked-by: Casey Schaufler <casey@...aufler-ca.com>
> ---
> fs/file_table.c | 2 -
> fs/namei.c | 6 -
> fs/nfsd/vfs.c | 7 --
> fs/open.c | 1 -
> include/linux/ima.h | 104 ------------------
> include/uapi/linux/lsm.h | 1 +
> security/integrity/Makefile | 1 +
> security/integrity/ima/Kconfig | 1 +
> security/integrity/ima/ima.h | 6 +
> security/integrity/ima/ima_main.c | 78 +++++++++----
> security/integrity/integrity.h | 1 +
> security/keys/key.c | 9 +-
> security/security.c | 63 ++---------
> .../selftests/lsm/lsm_list_modules_test.c | 3 +
> 14 files changed, 83 insertions(+), 200 deletions(-)
Acked-by: Paul Moore <paul@...l-moore.com>
--
paul-moore.com
Powered by blists - more mailing lists