* [PATCH v1] IMA: fix measuring asymmetric keys Kconfig
@ 2020-01-08 16:05 Lakshmi Ramasubramanian
2020-01-09 4:52 ` Mimi Zohar
0 siblings, 1 reply; 3+ messages in thread
From: Lakshmi Ramasubramanian @ 2020-01-08 16:05 UTC (permalink / raw)
To: zohar, James.Bottomley, arnd, linux-integrity
Cc: dhowells, sashal, linux-kernel, keyrings, linux-crypto
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.
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")
---
include/linux/ima.h | 4 ++--
security/integrity/ima/Kconfig | 6 ++++++
security/integrity/ima/Makefile | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/include/linux/ima.h b/include/linux/ima.h
index 3b89136bc218..f4644c54f648 100644
--- a/include/linux/ima.h
+++ b/include/linux/ima.h
@@ -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);
diff --git a/security/integrity/ima/Kconfig b/security/integrity/ima/Kconfig
index 838476d780e5..355754a6b6ca 100644
--- a/security/integrity/ima/Kconfig
+++ b/security/integrity/ima/Kconfig
@@ -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
diff --git a/security/integrity/ima/Makefile b/security/integrity/ima/Makefile
index 207a0a9eb72c..3e9d0ad68c7b 100644
--- a/security/integrity/ima/Makefile
+++ b/security/integrity/ima/Makefile
@@ -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
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v1] IMA: fix measuring asymmetric keys Kconfig
2020-01-08 16:05 [PATCH v1] IMA: fix measuring asymmetric keys Kconfig Lakshmi Ramasubramanian
@ 2020-01-09 4:52 ` Mimi Zohar
2020-01-09 16:38 ` Lakshmi Ramasubramanian
0 siblings, 1 reply; 3+ messages in thread
From: Mimi Zohar @ 2020-01-09 4:52 UTC (permalink / raw)
To: Lakshmi Ramasubramanian, James.Bottomley, arnd, linux-integrity
Cc: dhowells, sashal, linux-kernel, keyrings, linux-crypto
On Wed, 2020-01-08 at 08:05 -0800, Lakshmi Ramasubramanian wrote:
> 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.
>
> Signed-off-by: Lakshmi Ramasubramanian <nramas@linux.microsoft.com>
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v1] IMA: fix measuring asymmetric keys Kconfig
2020-01-09 4:52 ` Mimi Zohar
@ 2020-01-09 16:38 ` Lakshmi Ramasubramanian
0 siblings, 0 replies; 3+ messages in thread
From: Lakshmi Ramasubramanian @ 2020-01-09 16:38 UTC (permalink / raw)
To: Mimi Zohar, James.Bottomley, arnd, linux-integrity
Cc: dhowells, sashal, linux-kernel, keyrings, linux-crypto
On 1/8/20 8:52 PM, Mimi Zohar wrote:
>
> 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
>
That sounds perfect. Thanks for your help Mimi.
-lakshmi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-09 16:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-08 16:05 [PATCH v1] IMA: fix measuring asymmetric keys Kconfig Lakshmi Ramasubramanian
2020-01-09 4:52 ` Mimi Zohar
2020-01-09 16:38 ` Lakshmi Ramasubramanian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).