KEYS: trusted: Fix trusted key backends when building as module
Subsystems (3)
PATCH v3 1/1 KEYS: trusted: Fix trusted key backends when building as module
Before this commit the kernel could end up with no trusted key sources even though both of the currently supported backends (TPM and TEE) were compiled as modules. This manifested in the trusted key type not being registered at all.
When checking if a CONFIG_… preprocessor variable is defined we only test for the builtin (=y) case and not the module (=m) case. By using the IS_REACHABLE() macro we do test for both cases.
---
v3:
* Fixed patch formatting
v2:
* Fixed commit message
* Switched from IS_DEFINED() to IS_REACHABLE()
security/keys/trusted-keys/trusted_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
security/keys/trusted-keys/trusted_core.c +2 -2
@@ -27,10 +27,10 @@ module_param_named(source, trusted_key_source, charp, 0);MODULE_PARM_DESC (source,"Select trusted keys source (tpm or tee)" );static const struct trusted_key_source trusted_key_sources[] = { -#if defined(CONFIG_TCG_TPM) +#if IS_REACHABLE(CONFIG_TCG_TPM) {"tpm" , &trusted_key_tpm_ops }, #endif -#if defined(CONFIG_TEE) +#if IS_REACHABLE(CONFIG_TEE) {"tee" , &trusted_key_tee_ops }, #endif };
Signature · 1 line
2.32.0
Quoted 19 lines · Andreas Rammhold
Before this commit the kernel could end up with no trusted key sources even though both of the currently supported backends (TPM and TEE) were compiled as modules. This manifested in the trusted key type not being registered at all.
When checking if a CONFIG_… preprocessor variable is defined we only test for the builtin (=y) case and not the module (=m) case. By using the
IS_REACHABLE()macro we do test for both cases.Fixes 5d0682be3189 ("KEYS: trusted: Add generic trusted keys framework")Signed-off-by Andreas Rammhold <[email protected]>Reviewed-by Jarkko Sakkinen <[email protected]>---
v3:
* Fixed patch formatting
Quoted 7 lines
v2:
* Fixed commit message
* Switched fromIS_DEFINED()toIS_REACHABLE()security/keys/trusted-keys/trusted_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
LGTM.
-Sumit
Quoted 20 lines
security/keys/trusted-keys/trusted_core.c +2
-3@@ -27,10 +27,10 @@ module_param_named(source, trusted_key_source, charp, 0);MODULE_PARM_DESC (source,"Select trusted keys source (tpm or tee)" );static const struct trusted_key_source trusted_key_sources[] = { -#if defined(CONFIG_TCG_TPM) +#if IS_REACHABLE(CONFIG_TCG_TPM) {"tpm" , &trusted_key_tpm_ops }, #endif -#if defined(CONFIG_TEE) +#if IS_REACHABLE(CONFIG_TEE) {"tee" , &trusted_key_tee_ops }, #endif }; --2.32.0
Quoted 5 lines · Andreas Rammhold
Before this commit the kernel could end up with no trusted key sources even though both of the currently supported backends (TPM and TEE) were compiled as modules. This manifested in the trusted key type not being registered at all.
Quoted 7 lines
When checking if a CONFIG_… preprocessor variable is defined we only test for the builtin (=y) case and not the module (=m) case. By using the
IS_REACHABLE()macro we do test for both cases.Fixes 5d0682be3189 ("KEYS: trusted: Add generic trusted keys framework")Signed-off-by Andreas Rammhold <[email protected]>Reviewed-by Jarkko Sakkinen <[email protected]>
Quoted 31 lines
---
v3:
* Fixed patch formattingv2:
* Fixed commit message
* Switched fromIS_DEFINED()toIS_REACHABLE()security/keys/trusted-keys/trusted_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)security/keys/trusted-keys/trusted_core.c +2
-2@@ -27,10 +27,10 @@ module_param_named(source, trusted_key_source, charp, 0);MODULE_PARM_DESC (source,"Select trusted keys source (tpm or tee)" );static const struct trusted_key_source trusted_key_sources[] = { -#if defined(CONFIG_TCG_TPM) +#if IS_REACHABLE(CONFIG_TCG_TPM) {"tpm" , &trusted_key_tpm_ops }, #endif -#if defined(CONFIG_TEE) +#if IS_REACHABLE(CONFIG_TEE) {"tee" , &trusted_key_tee_ops }, #endif };
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Dear trusted key maintainers,
Quoted 5 lines · Andreas Rammhold
Before this commit the kernel could end up with no trusted key sources even though both of the currently supported backends (TPM and TEE) were compiled as modules. This manifested in the trusted key type not being registered at all.
Quoted 7 lines
When checking if a CONFIG_… preprocessor variable is defined we only test for the builtin (=y) case and not the module (=m) case. By using the
IS_REACHABLE()macro we do test for both cases.Fixes 5d0682be3189 ("KEYS: trusted: Add generic trusted keys framework")Signed-off-by Andreas Rammhold <[email protected]>Reviewed-by Jarkko Sakkinen <[email protected]>
Does anyone intend to pick this up?
Cheers,
Ahmad
Quoted 31 lines
---
v3:
* Fixed patch formattingv2:
* Fixed commit message
* Switched fromIS_DEFINED()toIS_REACHABLE()security/keys/trusted-keys/trusted_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)security/keys/trusted-keys/trusted_core.c +2
-2@@ -27,10 +27,10 @@ module_param_named(source, trusted_key_source, charp, 0);MODULE_PARM_DESC (source,"Select trusted keys source (tpm or tee)" );static const struct trusted_key_source trusted_key_sources[] = { -#if defined(CONFIG_TCG_TPM) +#if IS_REACHABLE(CONFIG_TCG_TPM) {"tpm" , &trusted_key_tpm_ops }, #endif -#if defined(CONFIG_TEE) +#if IS_REACHABLE(CONFIG_TEE) {"tee" , &trusted_key_tee_ops }, #endif };
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
Quoted 8 lines · Ahmad Fatoum
Dear trusted key maintainers,
Quoted 5 lines · Andreas Rammhold
Before this commit the kernel could end up with no trusted key sources even though both of the currently supported backends (TPM and TEE) were compiled as modules. This manifested in the trusted key type not being registered at all.
Quoted 8 lines
Quoted 7 lines
When checking if a CONFIG_… preprocessor variable is defined we only test for the builtin (=y) case and not the module (=m) case. By using the
IS_REACHABLE()macro we do test for both cases.Fixes 5d0682be3189 ("KEYS: trusted: Add generic trusted keys framework")Signed-off-by Andreas Rammhold <[email protected]>Reviewed-by Jarkko Sakkinen <[email protected]>Does anyone intend to pick this up?
Did this end up in any tree by now? I am wondering if I should resend the patch instead. Perhaps it was just overlooked?
Andi
Mimi Zohar
maintainerQuoted 13 lines · Andreas Rammhold
Quoted 12 lines · Ahmad Fatoum
Dear trusted key maintainers,
Quoted 9 lines · Andreas Rammhold
Before this commit the kernel could end up with no trusted key sources even though both of the currently supported backends (TPM and TEE) were compiled as modules. This manifested in the trusted key type not being registered at all.
When checking if a CONFIG_… preprocessor variable is defined we only test for the builtin (=y) case and not the module (=m) case. By using the
IS_REACHABLE()macro we do test for both cases.
Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Fixes 5d0682be3189 ("KEYS: trusted: Add generic trusted keys framework")Signed-off-by Andreas Rammhold <[email protected]>Reviewed-by Jarkko Sakkinen <[email protected]>Does anyone intend to pick this up?
Did this end up in any tree by now? I am wondering if I should resend the patch instead. Perhaps it was just overlooked?
For EVM environments only using trusted and encrypted keys, not file signatures, the trusted key is needed to decrypt the "master" key in order to verify kernel modules.
Mimi
Quoted 17 lines · Mimi Zohar
Quoted 16 lines · Andreas Rammhold
Quoted 15 lines · Ahmad Fatoum
Dear trusted key maintainers,
Quoted 12 lines · Andreas Rammhold
Before this commit the kernel could end up with no trusted key sources even though both of the currently supported backends (TPM and TEE) were compiled as modules. This manifested in the trusted key type not being registered at all.
When checking if a CONFIG_… preprocessor variable is defined we only test for the builtin (=y) case and not the module (=m) case. By using the
IS_REACHABLE()macro we do test for both cases.Fixes 5d0682be3189 ("KEYS: trusted: Add generic trusted keys framework")Signed-off-by Andreas Rammhold <[email protected]>Reviewed-by Jarkko Sakkinen <[email protected]>
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Does anyone intend to pick this up?
Did this end up in any tree by now? I am wondering if I should resend the patch instead. Perhaps it was just overlooked?
For EVM environments only using trusted and encrypted keys, not file signatures, the trusted key is needed to decrypt the "master" key in order to verify kernel modules.
So what you are saying is that right now (before this patch & after this patch) you could compile a kernel that wouldn't be able to load any modules when the trusted keychain part is built as module?
Andi
Mimi Zohar
maintainerQuoted 23 lines · Andreas Rammhold
Quoted 22 lines · Mimi Zohar
Quoted 20 lines · Andreas Rammhold
Quoted 8 lines · Ahmad Fatoum
Dear trusted key maintainers,
Quoted 5 lines · Andreas Rammhold
Before this commit the kernel could end up with no trusted key sources even though both of the currently supported backends (TPM and TEE) were compiled as modules. This manifested in the trusted key type not being registered at all.
Quoted 8 lines
Quoted 7 lines
When checking if a CONFIG_… preprocessor variable is defined we only test for the builtin (=y) case and not the module (=m) case. By using the
IS_REACHABLE()macro we do test for both cases.Fixes 5d0682be3189 ("KEYS: trusted: Add generic trusted keys framework")Signed-off-by Andreas Rammhold <[email protected]>Reviewed-by Jarkko Sakkinen <[email protected]>Does anyone intend to pick this up?
Did this end up in any tree by now? I am wondering if I should resend the patch instead. Perhaps it was just overlooked?
Quoted 7 lines
Quoted 3 lines
For EVM environments only using trusted and encrypted keys, not file signatures, the trusted key is needed to decrypt the "master" key in order to verify kernel modules.
So what you are saying is that right now (before this patch & after this patch) you could compile a kernel that wouldn't be able to load any modules when the trusted keychain part is built as module?
Before this patch, trusted and encrypted keys are builtin, so verifying kernel modules with security.evm containing an EVM hmac would succeed. Afterwards it would fail, as there's a dependency on the trusted key to verify the integrity of the trusted key module.
Mimi
Quoted 28 lines · Mimi Zohar
Quoted 27 lines · Andreas Rammhold
Quoted 25 lines · Mimi Zohar
Quoted 13 lines · Andreas Rammhold
Quoted 12 lines · Ahmad Fatoum
Dear trusted key maintainers,
Quoted 9 lines · Andreas Rammhold
Before this commit the kernel could end up with no trusted key sources even though both of the currently supported backends (TPM and TEE) were compiled as modules. This manifested in the trusted key type not being registered at all.
When checking if a CONFIG_… preprocessor variable is defined we only test for the builtin (=y) case and not the module (=m) case. By using the
IS_REACHABLE()macro we do test for both cases.Quoted 7 lines
Quoted 4 lines
Quoted 3 lines
Fixes 5d0682be3189 ("KEYS: trusted: Add generic trusted keys framework")Signed-off-by Andreas Rammhold <[email protected]>Reviewed-by Jarkko Sakkinen <[email protected]>Does anyone intend to pick this up?
Did this end up in any tree by now? I am wondering if I should resend the patch instead. Perhaps it was just overlooked?
For EVM environments only using trusted and encrypted keys, not file signatures, the trusted key is needed to decrypt the "master" key in order to verify kernel modules.
Quoted 8 lines
Quoted 3 lines
So what you are saying is that right now (before this patch & after this patch) you could compile a kernel that wouldn't be able to load any modules when the trusted keychain part is built as module?
Before this patch, trusted and encrypted keys are builtin, so verifying kernel modules with security.evm containing an EVM hmac would succeed. Afterwards it would fail, as there's a dependency on the trusted key to verify the integrity of the trusted key module.
But building with =m was a valid configuration which is the original reason for me submitting the patch. So perhaps this should not be allowed to be a module then?
Mimi Zohar
maintainerQuoted 33 lines · Andreas Rammhold
Quoted 32 lines · Mimi Zohar
Quoted 30 lines · Andreas Rammhold
Quoted 17 lines · Mimi Zohar
Quoted 16 lines · Andreas Rammhold
Quoted 15 lines · Ahmad Fatoum
Dear trusted key maintainers,
Quoted 12 lines · Andreas Rammhold
Before this commit the kernel could end up with no trusted key sources even though both of the currently supported backends (TPM and TEE) were compiled as modules. This manifested in the trusted key type not being registered at all.
When checking if a CONFIG_… preprocessor variable is defined we only test for the builtin (=y) case and not the module (=m) case. By using the
IS_REACHABLE()macro we do test for both cases.Fixes 5d0682be3189 ("KEYS: trusted: Add generic trusted keys framework")Signed-off-by Andreas Rammhold <[email protected]>Reviewed-by Jarkko Sakkinen <[email protected]>Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Does anyone intend to pick this up?
Did this end up in any tree by now? I am wondering if I should resend the patch instead. Perhaps it was just overlooked?
For EVM environments only using trusted and encrypted keys, not file signatures, the trusted key is needed to decrypt the "master" key in order to verify kernel modules.
So what you are saying is that right now (before this patch & after this patch) you could compile a kernel that wouldn't be able to load any modules when the trusted keychain part is built as module?
Quoted 8 lines
Quoted 4 lines
Before this patch, trusted and encrypted keys are builtin, so verifying kernel modules with security.evm containing an EVM hmac would succeed. Afterwards it would fail, as there's a dependency on the trusted key to verify the integrity of the trusted key module.
But building with =m was a valid configuration which is the original reason for me submitting the patch. So perhaps this should not be allowed to be a module then?
My mistake. Trusted and encrypted key types have always been defined as tristate. Only when EVM selects encrypted keys, and by extension trusted keys, are they builtin.
Mimi
Quoted 39 lines · Mimi Zohar
Quoted 38 lines · Andreas Rammhold
Quoted 36 lines · Mimi Zohar
Quoted 23 lines · Andreas Rammhold
Quoted 22 lines · Mimi Zohar
Quoted 20 lines · Andreas Rammhold
Quoted 8 lines · Ahmad Fatoum
Dear trusted key maintainers,
Quoted 5 lines · Andreas Rammhold
Before this commit the kernel could end up with no trusted key sources even though both of the currently supported backends (TPM and TEE) were compiled as modules. This manifested in the trusted key type not being registered at all.
Quoted 8 lines
Quoted 7 lines
When checking if a CONFIG_… preprocessor variable is defined we only test for the builtin (=y) case and not the module (=m) case. By using the
IS_REACHABLE()macro we do test for both cases.Fixes 5d0682be3189 ("KEYS: trusted: Add generic trusted keys framework")Signed-off-by Andreas Rammhold <[email protected]>Reviewed-by Jarkko Sakkinen <[email protected]>Does anyone intend to pick this up?
Did this end up in any tree by now? I am wondering if I should resend the patch instead. Perhaps it was just overlooked?
Quoted 7 lines
Quoted 3 lines
For EVM environments only using trusted and encrypted keys, not file signatures, the trusted key is needed to decrypt the "master" key in order to verify kernel modules.
So what you are saying is that right now (before this patch & after this patch) you could compile a kernel that wouldn't be able to load any modules when the trusted keychain part is built as module?
Before this patch, trusted and encrypted keys are builtin, so verifying kernel modules with security.evm containing an EVM hmac would succeed. Afterwards it would fail, as there's a dependency on the trusted key to verify the integrity of the trusted key module.
Quoted 7 lines
Quoted 3 lines
But building with =m was a valid configuration which is the original reason for me submitting the patch. So perhaps this should not be allowed to be a module then?
My mistake. Trusted and encrypted key types have always been defined as tristate. Only when EVM selects encrypted keys, and by extension trusted keys, are they builtin.
So how do we go about this patch? Building the TPM support as module has broken actually using the trusted backend. This patch fixes that while still allowing it to be a builtin. If there is some configuration there a module isn't acceptable I am sure that is handled within Kconfig?
Andi
Hello Mimi, David, Jarkko and James,
Quoted 8 lines · Andreas Rammhold
Quoted 3 lines
My mistake. Trusted and encrypted key types have always been defined as tristate. Only when EVM selects encrypted keys, and by extension trusted keys, are they builtin.
So how do we go about this patch? Building the TPM support as module has broken actually using the trusted backend. This patch fixes that while still allowing it to be a builtin. If there is some configuration there a module isn't acceptable I am sure that is handled within
Kconfig?
Can anyone of you four pick this up? Andreas' regression fix has had Jarkko's Reviewed-by for close to two months and a half now.
Thanks,
Ahmad
Signature · 4 lines
Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |