* [PATCH] tpm: Fix the value of TPM2_SE_TRIAL
@ 2026-11-08 18:05 Alban Munari via B4 Relay
2026-11-08 18:28 ` Jarkko Sakkinen
0 siblings, 1 reply; 2+ messages in thread
From: Alban Munari via B4 Relay @ 2026-11-08 18:05 UTC (permalink / raw)
To: Peter Huewe, Jarkko Sakkinen, Jason Gunthorpe, James Bottomley,
Ard Biesheuvel
Cc: linux-integrity, linux-kernel, Alban Munari
From: Alban Munari <alban.kernel@gmail.com>
The TPM 2.0 Library specification, Part 2: Structures, defines the
session types (TPM_SE) as TPM_SE_HMAC = 0x00, TPM_SE_POLICY = 0x01 and
TPM_SE_TRIAL = 0x03. TPM2_SE_TRIAL is defined as 0x02, which is not a
session type: TPM2_StartAuthSession with it fails with TPM_RC_VALUE on
the sessionType parameter, as swtpm 0.11.0 shows.
No code in the kernel uses TPM2_SE_TRIAL, so nothing changes at run
time. The TPM 2.0 selftests already define it as 0x03 in
tools/testing/selftests/tpm2/tpm2.py.
This change was found and written with an AI coding assistant (Claude
Opus 5.5, Anthropic), while building trial sessions on an AMD fTPM with
the value 0x03.
Fixes: 699e3efd6c64 ("tpm: Add HMAC session start and end functions")
Signed-off-by: Alban Munari <alban.kernel@gmail.com>
---
include/linux/tpm_command.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/tpm_command.h b/include/linux/tpm_command.h
index fc446a1282e2..076ee8ce816c 100644
--- a/include/linux/tpm_command.h
+++ b/include/linux/tpm_command.h
@@ -171,7 +171,7 @@ struct tpm1_get_random_out {
enum tpm2_session_types {
TPM2_SE_HMAC = 0x00,
TPM2_SE_POLICY = 0x01,
- TPM2_SE_TRIAL = 0x02,
+ TPM2_SE_TRIAL = 0x03,
};
enum tpm2_timeouts {
---
base-commit: 05441d697f7f9a927264f4058cbbc6a03dfcac9d
change-id: 20261108-tpm-se-trial-580bef9b4f17
Best regards,
--
Alban Munari <alban.kernel@gmail.com>
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH] tpm: Fix the value of TPM2_SE_TRIAL
2026-11-08 18:05 [PATCH] tpm: Fix the value of TPM2_SE_TRIAL Alban Munari via B4 Relay
@ 2026-11-08 18:28 ` Jarkko Sakkinen
0 siblings, 0 replies; 2+ messages in thread
From: Jarkko Sakkinen @ 2026-11-08 18:28 UTC (permalink / raw)
To: alban.kernel
Cc: Peter Huewe, Jason Gunthorpe, James Bottomley, Ard Biesheuvel,
linux-integrity, linux-kernel
On Sun, Nov 08, 2026 at 06:05:39PM +0000, Alban Munari via B4 Relay wrote:
> From: Alban Munari <alban.kernel@gmail.com>
>
> The TPM 2.0 Library specification, Part 2: Structures, defines the
> session types (TPM_SE) as TPM_SE_HMAC = 0x00, TPM_SE_POLICY = 0x01 and
> TPM_SE_TRIAL = 0x03. TPM2_SE_TRIAL is defined as 0x02, which is not a
> session type: TPM2_StartAuthSession with it fails with TPM_RC_VALUE on
> the sessionType parameter, as swtpm 0.11.0 shows.
>
> No code in the kernel uses TPM2_SE_TRIAL, so nothing changes at run
> time. The TPM 2.0 selftests already define it as 0x03 in
> tools/testing/selftests/tpm2/tpm2.py.
>
> This change was found and written with an AI coding assistant (Claude
> Opus 5.5, Anthropic), while building trial sessions on an AMD fTPM with
> the value 0x03.
Please delete this paragraph. It is your responsibility to do the
fact checking. I.e. refer to a section in appropriate TCG spec that
defines this instead.
>
> Fixes: 699e3efd6c64 ("tpm: Add HMAC session start and end functions")
> Signed-off-by: Alban Munari <alban.kernel@gmail.com>
If no code uses it why fixes-tag?
> ---
> include/linux/tpm_command.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/tpm_command.h b/include/linux/tpm_command.h
> index fc446a1282e2..076ee8ce816c 100644
> --- a/include/linux/tpm_command.h
> +++ b/include/linux/tpm_command.h
> @@ -171,7 +171,7 @@ struct tpm1_get_random_out {
> enum tpm2_session_types {
> TPM2_SE_HMAC = 0x00,
> TPM2_SE_POLICY = 0x01,
> - TPM2_SE_TRIAL = 0x02,
> + TPM2_SE_TRIAL = 0x03,
> };
>
> enum tpm2_timeouts {
>
> ---
> base-commit: 05441d697f7f9a927264f4058cbbc6a03dfcac9d
> change-id: 20261108-tpm-se-trial-580bef9b4f17
>
> Best regards,
> --
> Alban Munari <alban.kernel@gmail.com>
>
>
I think better action would be delete the enum and change the single
site to tpm_buf_append_u8(buf, 0x00 /* HMAC */);
Br, Jarkko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-08 18:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-08 18:05 [PATCH] tpm: Fix the value of TPM2_SE_TRIAL Alban Munari via B4 Relay
2026-11-08 18:28 ` Jarkko Sakkinen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®