From: Jarkko Sakkinen <jarkko@kernel.org>
To: Matthew Garrett <matthewg@nvidia.com>
Cc: mjg59@srcf.ucam.org, keyrings@vger.kernel.org,
James.Bottomley@hansenpartnership.com,
linux-integrity@vger.kernel.org, rafael@kernel.org,
linux-pm@vger.kernel.org, linux-efi@vger.kernel.org
Subject: Re: [PATCH 01/17] tpm: Define a kernel-owned TPM NV index that can't be modified by userland
Date: Fri, 13 Nov 2026 02:45:03 +0200 [thread overview]
Message-ID: <avZdj5oROgc0HL4L@kernel.org> (raw)
In-Reply-To: <avZcgwi7EetC2DtG@kernel.org>
On Fri, Nov 13, 2026 at 02:40:39AM +0200, Jarkko Sakkinen wrote:
> On Thu, Oct 08, 2026 at 06:20:17AM -0700, Matthew Garrett wrote:
> > +#ifdef CONFIG_TCG_TPM_KERNEL_NVINDEX
> > +/*
> > + * Commands that undefine or modify an NV index, and the position of the
> > + * NV index in the command's handle area.
> > + */
> > +static const struct {
> > + u32 cc;
> > + unsigned int handle;
> > +} tpm2_nv_modify_cmds[] = {
> > + { TPM2_CC_NV_UNDEFINE_SPACE_SPECIAL, 0 },
> > + { TPM2_CC_NV_UNDEFINE_SPACE, 1 },
> > + { TPM2_CC_NV_INCREMENT, 1 },
> > + { TPM2_CC_NV_SET_BITS, 1 },
> > + { TPM2_CC_NV_EXTEND, 1 },
> > + { TPM2_CC_NV_WRITE, 1 },
> > + { TPM2_CC_NV_WRITE_LOCK, 1 },
> > + { TPM2_CC_NV_CHANGE_AUTH, 0 },
> > + { TPM2_CC_NV_READ_LOCK, 1 },
> > +};
>
> There's also tpm2_ordinal_duration_map:
>
> static const struct {
> unsigned long ordinal;
> unsigned long duration;
> } tpm2_ordinal_duration_map[] = {
> {TPM2_CC_STARTUP, 750},
> {TPM2_CC_SELF_TEST, 3000},
> {TPM2_CC_GET_RANDOM, 2000},
> {TPM2_CC_SEQUENCE_UPDATE, 750},
> {TPM2_CC_SEQUENCE_COMPLETE, 750},
> {TPM2_CC_EVENT_SEQUENCE_COMPLETE, 750},
> {TPM2_CC_HASH_SEQUENCE_START, 750},
> {TPM2_CC_VERIFY_SIGNATURE, 30000},
> {TPM2_CC_PCR_EXTEND, 750},
> {TPM2_CC_HIERARCHY_CONTROL, 2000},
> {TPM2_CC_HIERARCHY_CHANGE_AUTH, 2000},
> {TPM2_CC_GET_CAPABILITY, 750},
> {TPM2_CC_NV_READ, 2000},
> {TPM2_CC_CREATE_PRIMARY, 300000},
> {TPM2_CC_CREATE, 300000},
> {TPM2_CC_CREATE_LOADED, 300000},
> };
>
> I'd consider something along the lines of:
>
> enum tpm2_cc_nv {
> TPM2_CC_NV_NA = -1, /* not available */
> TPM2_CC_NV_H0 = 0,
> TPM2_CC_NV_H1 = 1,
> };
>
> static const struct {
> u32 cc;
> u32 duration;
> enum tpm2_cc_nv nv;
> } tpm2_cc_map[] {
> /* ... */
> };
>
And I'd do this as a separate patch without adding new command codes or
other NV specific shenanigans. I.e. all entries have just TPM2_CC_NV_NA
set.
Further I'd sequence this like:
1. A patch that does above refactor.
2. A patch that adds the mechanics. This is a point that can be already
tested separately, thus it is important.
3. A patch that adds the new CC's and populates the entries to
tpm2_cc_map.
Br, Jarkko
next prev parent reply other threads:[~2026-11-13 0:45 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-08 13:20 [RFC] Make hibernation work with lockdown Matthew Garrett
2026-10-08 13:20 ` [PATCH 01/17] tpm: Define a kernel-owned TPM NV index that can't be modified by userland Matthew Garrett
2026-10-08 13:41 ` Matthew Garrett
2026-10-08 16:24 ` Jarkko Sakkinen
2026-10-08 16:23 ` Jarkko Sakkinen
2026-10-09 8:33 ` Matthew Garrett
2026-10-10 21:36 ` Jarkko Sakkinen
2026-10-08 17:06 ` Ilias Apalodimas
2026-10-10 9:22 ` James Bottomley
2026-10-10 21:26 ` Matthew Garrett
2026-10-11 6:04 ` James Bottomley
2026-10-11 10:23 ` Matthew Garrett
2026-10-11 10:27 ` James Bottomley
2026-10-11 11:28 ` Matthew Garrett
2026-10-11 8:21 ` James Bottomley
2026-11-13 0:40 ` Jarkko Sakkinen
2026-11-13 0:45 ` Jarkko Sakkinen [this message]
2026-11-13 0:50 ` Jarkko Sakkinen
2026-10-08 13:20 ` [PATCH 02/17] efi: Add a mechanism to modify TPM state depending on kernel security features Matthew Garrett
2026-10-08 16:38 ` Jarkko Sakkinen
2026-10-08 13:20 ` [PATCH 03/17] tpm: Allow tpm2_start_auth_session() to start an audit session Matthew Garrett
2026-10-08 13:20 ` [PATCH 04/17] tpm: Log commands executed in " Matthew Garrett
2026-10-08 13:20 ` [PATCH 05/17] tpm: Add a kernel attestation key and signed audit digest retrieval Matthew Garrett
2026-10-08 16:45 ` James Bottomley
2026-10-09 8:29 ` Matthew Garrett
2026-10-08 13:20 ` [PATCH 06/17] tpm: Use TPM2_NV_ReadPublic to read NV index names Matthew Garrett
2026-10-08 13:20 ` [PATCH 07/17] tpm: Add in-kernel support for reading NV indices Matthew Garrett
2026-10-08 13:20 ` [PATCH 08/17] tpm: Add NV define, undefine and write helpers Matthew Garrett
2026-10-08 13:20 ` [PATCH 09/17] tpm: Provision the kernel NV index at registration Matthew Garrett
2026-10-08 13:20 ` [PATCH 10/17] tpm: Move the bounds-checked response reader to a header Matthew Garrett
2026-10-08 13:20 ` [PATCH 11/17] tpm: Add kernel signing key creation with audited provenance Matthew Garrett
2026-10-08 17:00 ` James Bottomley
2026-10-09 8:31 ` Matthew Garrett
2026-10-08 13:20 ` [PATCH 12/17] tpm: Add signing with the kernel signing key Matthew Garrett
2026-10-08 13:20 ` [PATCH 13/17] tpm: Add verification of kernel signing key provenance Matthew Garrett
2026-10-10 9:34 ` James Bottomley
2026-10-10 21:18 ` Matthew Garrett
2026-10-10 9:42 ` James Bottomley
2026-10-10 21:20 ` Matthew Garrett
2026-10-08 13:20 ` [PATCH 14/17] PM: hibernate: Add image digest and signature page infrastructure Matthew Garrett
2026-10-08 13:20 ` [PATCH 15/17] PM: hibernate: Sign and verify images with a kernel-generated TPM key Matthew Garrett
2026-10-08 13:20 ` [PATCH 16/17] PM: hibernate: Refuse to verify images with a virtual TPM Matthew Garrett
2026-10-08 13:20 ` [PATCH 17/17] PM: hibernate: Allow hibernation under lockdown with signed images Matthew Garrett
2026-10-08 16:53 ` Jarkko Sakkinen
2026-10-09 8:31 ` Matthew Garrett
2026-10-10 21:29 ` Jarkko Sakkinen
2026-10-08 15:56 ` [RFC] Make hibernation work with lockdown Jarkko Sakkinen
2026-10-23 15:28 ` Jarkko Sakkinen
2026-10-23 19:13 ` Jarkko Sakkinen
2026-10-31 3:01 ` Jarkko Sakkinen
2026-11-07 22:34 ` Neal Gompa
2026-11-10 1:36 ` Jarkko Sakkinen
2026-11-13 0:06 ` Jarkko Sakkinen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=avZdj5oROgc0HL4L@kernel.org \
--to=jarkko@kernel.org \
--cc=James.Bottomley@hansenpartnership.com \
--cc=keyrings@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=matthewg@nvidia.com \
--cc=mjg59@srcf.ucam.org \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox