linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tpm: Limit TCG_TPM2_HMAC to known good drivers
@ 2024-07-03  0:30 Jarkko Sakkinen
  2024-07-03  1:02 ` Jarkko Sakkinen
  0 siblings, 1 reply; 3+ messages in thread
From: Jarkko Sakkinen @ 2024-07-03  0:30 UTC (permalink / raw)
  To: linux-integrity
  Cc: Jarkko Sakkinen, stable, Stefan Berger, Peter Huewe,
	Jason Gunthorpe, James Bottomley, Mimi Zohar, David Howells,
	Paul Moore, James Morris, Serge E. Hallyn, linux-kernel, keyrings,
	linux-security-module

IBM vTPM driver lacks a call to tpm2_sessions_init() and reports:

[    2.987131] tpm tpm0: tpm2_load_context: failed with a TPM error 0x01C4
[    2.987140] ima: Error Communicating to TPM chip, result: -14

HMAC encryption code also has a risk of null derefence, given that when
uninitialized, chip->auth is a null pointer.

Limit TCG_TPM2_HMAC to known good drivers until these issues have been
properly fixed.

Cc: stable@vger.kernel.org # v6.10+
Fixes: d2add27cf2b8 ("tpm: Add NULL primary creation")
Reported-by: Stefan Berger <stefanb@linux.ibm.com>
Closes: https://lore.kernel.org/linux-integrity/20240617193408.1234365-1-stefanb@linux.ibm.com/
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
---
 drivers/char/tpm/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/char/tpm/Kconfig b/drivers/char/tpm/Kconfig
index cf0be8a7939d..c310588a5958 100644
--- a/drivers/char/tpm/Kconfig
+++ b/drivers/char/tpm/Kconfig
@@ -30,6 +30,7 @@ if TCG_TPM
 config TCG_TPM2_HMAC
 	bool "Use HMAC and encrypted transactions on the TPM bus"
 	default X86_64
+	depends on TCG_CRB || TCG_TIS_CORE
 	select CRYPTO_ECDH
 	select CRYPTO_LIB_AESCFB
 	select CRYPTO_LIB_SHA256
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] tpm: Limit TCG_TPM2_HMAC to known good drivers
  2024-07-03  0:30 [PATCH] tpm: Limit TCG_TPM2_HMAC to known good drivers Jarkko Sakkinen
@ 2024-07-03  1:02 ` Jarkko Sakkinen
  2024-07-03 17:24   ` Jarkko Sakkinen
  0 siblings, 1 reply; 3+ messages in thread
From: Jarkko Sakkinen @ 2024-07-03  1:02 UTC (permalink / raw)
  To: Jarkko Sakkinen, linux-integrity
  Cc: stable, Stefan Berger, Peter Huewe, Jason Gunthorpe,
	James Bottomley, Mimi Zohar, David Howells, Paul Moore,
	James Morris, Serge E. Hallyn, linux-kernel, keyrings,
	linux-security-module

On Wed Jul 3, 2024 at 3:30 AM EEST, Jarkko Sakkinen wrote:
> +	depends on TCG_CRB || TCG_TIS_CORE

Needs to be "depends on !TCG_IBMVTPM":

https://lore.kernel.org/linux-integrity/D2FHWYEXITS4.1GNXEB8V6KJM7@kernel.org/

BR, Jarkko

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] tpm: Limit TCG_TPM2_HMAC to known good drivers
  2024-07-03  1:02 ` Jarkko Sakkinen
@ 2024-07-03 17:24   ` Jarkko Sakkinen
  0 siblings, 0 replies; 3+ messages in thread
From: Jarkko Sakkinen @ 2024-07-03 17:24 UTC (permalink / raw)
  To: Jarkko Sakkinen, linux-integrity
  Cc: stable, Stefan Berger, Peter Huewe, Jason Gunthorpe,
	James Bottomley, Mimi Zohar, David Howells, Paul Moore,
	James Morris, Serge E. Hallyn, linux-kernel, keyrings,
	linux-security-module

On Wed Jul 3, 2024 at 4:02 AM EEST, Jarkko Sakkinen wrote:
> On Wed Jul 3, 2024 at 3:30 AM EEST, Jarkko Sakkinen wrote:
> > +	depends on TCG_CRB || TCG_TIS_CORE
>
> Needs to be "depends on !TCG_IBMVTPM":
>
> https://lore.kernel.org/linux-integrity/D2FHWYEXITS4.1GNXEB8V6KJM7@kernel.org/

This ended up such a mess to fix with any fast path so I made a
proper fix for the core issue in the hmac authentication patch
set:

https://lore.kernel.org/linux-integrity/20240703170815.1494625-1-jarkko@kernel.org/

The problem is that tpm_crb and tpm_tis_core are the *only*
drivers, which call tpm_chip_bootstrap() so it is better not to
take any possible risks with this. I'm still aiming to get these
fixes into 6.10.

BR, Jarkko

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-03 17:24 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-03  0:30 [PATCH] tpm: Limit TCG_TPM2_HMAC to known good drivers Jarkko Sakkinen
2024-07-03  1:02 ` Jarkko Sakkinen
2024-07-03 17:24   ` Jarkko Sakkinen

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).