IMA: fix measuring asymmetric keys Kconfig
Subsystems (6)
PATCH 1/1 IMA: fix measuring asymmetric keys Kconfig
CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE is a tristate. If this config is set to "=m", ima_asymmetric_keys.c is built as a kernel module.
Defined an intermediate boolean config namely CONFIG_IMA_MEASURE_ASYMMETRIC_KEYS that is
defined when CONFIG_IMA and CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE are defined.
Asymmetric key structure is defined only when CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE is defined. Since the IMA hook measures asymmetric keys, the IMA hook is defined in ima_asymmetric_keys.c which is built only if CONFIG_IMA_MEASURE_ASYMMETRIC_KEYS is defined.
is built as a kernel module.
--- include/linux/ima.h | 4 ++-- security/integrity/ima/Kconfig | 6 ++++++ security/integrity/ima/Makefile | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-)
include/linux/ima.h +2 -2
@@ -101,7 +101,7 @@ static inline void ima_add_kexec_buffer(struct kimage *image) {}#endif -#if defined(CONFIG_IMA ) && defined(CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE ) +#ifdef CONFIG_IMA_MEASURE_ASYMMETRIC_KEYS extern void ima_post_key_create_or_update(struct key *keyring, struct key *key, const void *payload, size_t plen,
@@ -113,7 +113,7 @@ static inline void ima_post_key_create_or_update(struct key *keyring, size_t plen, unsigned long flags, bool create) {} -#endif /* CONFIG_IMA && CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE */ +#endif /* CONFIG_IMA_MEASURE_ASYMMETRIC_KEYS */ #ifdef CONFIG_IMA_APPRAISE extern bool is_ima_appraise_enabled (void );
security/integrity/ima/Kconfig +6 -0
@@ -310,3 +310,9 @@ config IMA_APPRAISE_SIGNED_INIT default n help This option requires user-space init to be signed. + +config IMA_MEASURE_ASYMMETRIC_KEYS + bool + depends on IMA + depends on ASYMMETRIC_PUBLIC_KEY_SUBTYPE=y + default y
security/integrity/ima/Makefile +1 -1
@@ -12,4 +12,4 @@ ima-$(CONFIG_IMA_APPRAISE) += ima_appraise.o ima-$(CONFIG_IMA_APPRAISE_MODSIG) += ima_modsig.o ima-$(CONFIG_HAVE_IMA_KEXEC) += ima_kexec.o obj-$(CONFIG_IMA_BLACKLIST_KEYRING) += ima_mok.o -obj-$(CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPE) += ima_asymmetric_keys.o +obj-$(CONFIG_IMA_MEASURE_ASYMMETRIC_KEYS) += ima_asymmetric_keys.o
Signature · 1 line
2.17.1
Mimi Zohar
maintainerQuoted 8 lines · Lakshmi Ramasubramanian
CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPEis a tristate. If this config is set to "=m",ima_asymmetric_keys.cis built as a kernel module.Defined an intermediate boolean config namely
CONFIG_IMA_MEASURE_ASYMMETRIC_KEYSthat is
defined whenCONFIG_IMAandCONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPEare defined.
Quoted 7 lines
Asymmetric key structure is defined only when
CONFIG_ASYMMETRIC_PUBLIC_KEY_SUBTYPEis defined. Since the IMA hook measures asymmetric keys, the IMA hook is defined inima_asymmetric_keys.cwhich is built only ifCONFIG_IMA_MEASURE_ASYMMETRIC_KEYSis defined.Signed-off-by Lakshmi Ramasubramanian <[email protected]>
For the time being, I've pushed out this patch with the existing patch description to next-integrity-testing, but the patch description should be rewritten clearer. For example,
As a result of the asymmetric public keys subtype being defined as a tristate, with the existing IMA Makefile, ima_asymmetric_keys.c could be built as a kernel module. To prevent this from happening, this patch defines and uses an intermediate Kconfig boolean option named IMA_MEASURE_ASYMMETRIC_KEYS.
Please let me know if you're ok with this wording.
thanks,
Mimi
Quoted 11 lines · Mimi Zohar
For the time being, I've pushed out this patch with the existing patch description to next-integrity-testing, but the patch description should be rewritten clearer. For example,
As a result of the asymmetric public keys subtype being defined as a tristate, with the existing IMA
Makefile,ima_asymmetric_keys.ccould be built as a kernel module. To prevent this from happening, this patch defines and uses an intermediateKconfigboolean option namedIMA_MEASURE_ASYMMETRIC_KEYS.
Quoted 6 lines
Please let me know if you're ok with this wording.
thanks,
Mimi
That sounds perfect. Thanks for your help Mimi.
-lakshmi