]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
IMA: fix measuring asymmetric keys Kconfig
authorLakshmi Ramasubramanian <nramas@linux.microsoft.com>
Wed, 8 Jan 2020 16:05:08 +0000 (08:05 -0800)
committerMimi Zohar <zohar@linux.ibm.com>
Thu, 9 Jan 2020 19:06:06 +0000 (14:06 -0500)
As a result of the asymmetric public keys subtype Kconfig option being
defined as 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.

Signed-off-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
Suggested-by: James.Bottomley <James.Bottomley@HansenPartnership.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
Reported-by: kbuild test robot <lkp@intel.com> # ima_asymmetric_keys.c
is built as a kernel module.
Fixes: 88e70da170e8 ("IMA: Define an IMA hook to measure keys")
Fixes: cb1aa3823c92 ("KEYS: Call the IMA hook to measure keys")
[zohar@linux.ibm.com: updated patch description]
Signed-off-by: Mimi Zohar <zohar@linux.ibm.com>
include/linux/ima.h
security/integrity/ima/Kconfig
security/integrity/ima/Makefile

index 3b89136bc218b0d7b44ecfbad820ee0aef14e027..f4644c54f64880d76698916befef9dae74f9bf33 100644 (file)
@@ -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);
index 838476d780e55c855c601a58d30752d9caf04ea3..355754a6b6ca35435aa49f15808905eac33b54d9 100644 (file)
@@ -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
index 207a0a9eb72caf51a5a2791344a3e81b046bb844..3e9d0ad68c7b11d1cd3f3332b30fe4f3c6525c2e 100644 (file)
@@ -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