Skip to contentSkip to conversation

tpm: fix build break in tpm-chip.c caused by AMD fTPM quirk

PATCH James Bottomley 2 participants 6 messages Mar 20, 2023 – Mar 29, 2023

Subsystems (2)
lore
Share & tools
lore

James Bottomley

author maintainer
#0 lore raw

The test for the AMD fTPM problem, which just went in, actually uses the wrong function template for request_locality(). It's missing an argument so the build breaks:

drivers/char/tpm/tpm-chip.c:568:8: error: too few arguments to function ‘tpm_request_locality’

  ret = tpm_request_locality(chip);
        ^~~~~~~~~~~~~~~~~~~~
drivers/char/tpm/tpm-chip.c:43:12: note: declared here
 static int tpm_request_locality(struct tpm_chip *chip, int locality)
            ^~~~~~~~~~~~~~~~~~~~

Fix this by requesting zero locality.

Fixes f1324bbc4011 ("tpm: disable hwrng for fTPM on some AMD designs")

---

drivers/char/tpm/tpm-chip.c +1 -1
index c04d101c7779..fee061780468 100644
@@ -565,7 +565,7 @@ static bool tpm_amd_is_rng_defective(struct tpm_chip *chip)
 	if (!(chip->flags & TPM_CHIP_FLAG_TPM2))
 		return false;
 
-	ret = tpm_request_locality(chip);
+	ret = tpm_request_locality(chip, 0);
 	if (ret)
 		return false;
 
author maintainer
#1 lore raw
Quoted 12 lines · James Bottomley

The test for the AMD fTPM problem, which just went in, actually uses the wrong function template for request_locality().  It's missing an argument so the build breaks:

drivers/char/tpm/tpm-chip.c:568:8: error: too few arguments to function ‘tpm_request_locality’
  ret = tpm_request_locality(chip);
        ^~~~~~~~~~~~~~~~~~~~ drivers/char/tpm/tpm-chip.c:43:12: note: declared here static int tpm_request_locality(struct tpm_chip *chip, int locality) ^~~~~~~~~~~~~~~~~~~~

Quoted 1 line

Fix this by requesting zero locality.

Actually, this is a bad interaction with the non-upstream patch to run the kernel in locality two to allow key policy to distinguish kernel release from user space release, which goes back to the debate over hibernation keys. I'll carry it separately until (or if ever) we get a resolution on how to do this.

James

maintainer
#2 lore raw
Quoted 13 lines · James Bottomley
Quoted 12 lines · James Bottomley

The test for the AMD fTPM problem, which just went in, actually uses the wrong function template for request_locality().  It's missing an argument so the build breaks:

drivers/char/tpm/tpm-chip.c:568:8: error: too few arguments to function ‘tpm_request_locality’
  ret = tpm_request_locality(chip);
        ^~~~~~~~~~~~~~~~~~~~ drivers/char/tpm/tpm-chip.c:43:12: note: declared here static int tpm_request_locality(struct tpm_chip *chip, int locality) ^~~~~~~~~~~~~~~~~~~~

Quoted 7 lines
Quoted 1 line

Fix this by requesting zero locality.

Actually, this is a bad interaction with the non-upstream patch to run the kernel in locality two to allow key policy to distinguish kernel release from user space release, which goes back to the debate over hibernation keys. I'll carry it separately until (or if ever) we get a resolution on how to do this.

BTW, do you have a newer version of

https://lore.kernel.org/linux-integrity/[email protected]/

I'm planning to flush testing queue as I have now more bandwidth for TPM and keyring (actually I'm looking RISC-V fTPM's at work).

BR, Jarkko

BR, Jarkko

author maintainer
#3 lore raw
Quoted 23 lines · Jarkko Sakkinen
Quoted 14 lines · James Bottomley
Quoted 13 lines · James Bottomley

The test for the AMD fTPM problem, which just went in, actually uses the wrong function template for request_locality().  It's missing an argument so the build breaks:

drivers/char/tpm/tpm-chip.c:568:8: error: too few arguments to function ‘tpm_request_locality’
  ret = tpm_request_locality(chip); ^~~~~~~~~~~~~~~~~~~~ drivers/char/tpm/tpm-chip.c:43:12: note: declared here static int tpm_request_locality(struct tpm_chip *chip, int locality)
            ^~~~~~~~~~~~~~~~~~~~

Quoted 7 lines
Quoted 1 line

Fix this by requesting zero locality.

Actually, this is a bad interaction with the non-upstream patch to run the kernel in locality two to allow key policy to distinguish kernel release from user space release, which goes back to the debate over hibernation keys.  I'll carry it separately until (or if ever) we get a resolution on how to do this.

Quoted 6 lines

BTW, do you have a newer version of

https://lore.kernel.org/linux-integrity/[email protected]/

I'm planning to flush testing queue as I have now more bandwidth for TPM and keyring (actually I'm looking RISC-V fTPM's at work).

Hopefully next week. I'm on a business trip and conference this week, so most of my cycles have been going into that and converting the TPM2 engine to a provider, but I'm back home next week and the provider conversion is pretty much done.

Regards,

James

maintainer
#4 lore raw
Quoted 28 lines · James Bottomley
Quoted 27 lines · Jarkko Sakkinen
Quoted 14 lines · James Bottomley
Quoted 13 lines · James Bottomley

The test for the AMD fTPM problem, which just went in, actually uses the wrong function template for request_locality().  It's missing an argument so the build breaks:

drivers/char/tpm/tpm-chip.c:568:8: error: too few arguments to function ‘tpm_request_locality’
  ret = tpm_request_locality(chip); ^~~~~~~~~~~~~~~~~~~~ drivers/char/tpm/tpm-chip.c:43:12: note: declared here static int tpm_request_locality(struct tpm_chip *chip, int locality)
            ^~~~~~~~~~~~~~~~~~~~

Quoted 7 lines
Quoted 1 line

Fix this by requesting zero locality.

Actually, this is a bad interaction with the non-upstream patch to run the kernel in locality two to allow key policy to distinguish kernel release from user space release, which goes back to the debate over hibernation keys.  I'll carry it separately until (or if ever) we get a resolution on how to do this.

BTW, do you have a newer version of

https://lore.kernel.org/linux-integrity/[email protected]/

Quoted 7 lines
Quoted 2 lines

I'm planning to flush testing queue as I have now more bandwidth for TPM and keyring (actually I'm looking RISC-V fTPM's at work).

Hopefully next week. I'm on a business trip and conference this week, so most of my cycles have been going into that and converting the TPM2 engine to a provider, but I'm back home next week and the provider conversion is pretty much done.

Yeah, as said in other reponse things have not moved because I got sick on Friday... Anyway, I'm planning to test the current version, unless new comes available before I get on it.

BR, Jarkko

maintainer
#5 lore raw
In reply to James Bottomley
Quoted 24 lines · James Bottomley

The test for the AMD fTPM problem, which just went in, actually uses the wrong function template for request_locality(). It's missing an argument so the build breaks:

drivers/char/tpm/tpm-chip.c:568:8: error: too few arguments to function ‘tpm_request_locality’

  ret = tpm_request_locality(chip);
        ^~~~~~~~~~~~~~~~~~~~
drivers/char/tpm/tpm-chip.c:43:12: note: declared here
 static int tpm_request_locality(struct tpm_chip *chip, int locality)
            ^~~~~~~~~~~~~~~~~~~~

Fix this by requesting zero locality.

Fixes f1324bbc4011 ("tpm: disable hwrng for fTPM on some AMD designs")

---

drivers/char/tpm/tpm-chip.c +0 -0
index c04d101c7779..fee061780468 100644

drivers/char/tpm/tpm-chip.c static bool tpm_amd_is_rng_defective(struct tpm_chip *chip) · line 571

Quoted 8 lines
drivers/char/tpm/tpm-chip.c +1 -1
@@ -565,7 +565,7 @@ static bool tpm_amd_is_rng_defective(struct tpm_chip *chip)
 	if (!(chip->flags & TPM_CHIP_FLAG_TPM2))
 		return false;
 
-	ret = tpm_request_locality(chip);
+	ret = tpm_request_locality(chip, 0);
 	if (ret)
 		return false;
 

Thank you, I sent a PR for rc4.

BR, Jarkko