From: "Jarkko Sakkinen" <jarkko@kernel.org>
To: "Daniel P. Smith" <dpsmith@apertussolutions.com>,
"Lino Sanfilippo" <l.sanfilippo@kunbus.com>,
"Alexander Steffen" <Alexander.Steffen@infineon.com>,
"Jason Gunthorpe" <jgg@ziepe.ca>,
"Sasha Levin" <sashal@kernel.org>,
<linux-integrity@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: "Ross Philipson" <ross.philipson@oracle.com>,
"Kanth Ghatraju" <kanth.ghatraju@oracle.com>,
"Peter Huewe" <peterhuewe@gmx.de>
Subject: Re: [PATCH 1/3] tpm: protect against locality counter underflow
Date: Fri, 23 Feb 2024 22:50:43 +0200 [thread overview]
Message-ID: <CZCR76MKS60B.UHM5MC0SBOQY@suppilovahvero> (raw)
In-Reply-To: <4bd31b91-1f6a-4081-9ad8-e5fae29d0dd7@apertussolutions.com>
On Fri Feb 23, 2024 at 3:57 AM EET, Daniel P. Smith wrote:
> On 2/20/24 17:31, Jarkko Sakkinen wrote:
> > On Tue Feb 20, 2024 at 10:26 PM UTC, Jarkko Sakkinen wrote:
> >> On Tue Feb 20, 2024 at 8:54 PM UTC, Lino Sanfilippo wrote:
> >>> for (i = 0; i <= MAX_LOCALITY; i++)
> >>> __tpm_tis_relinquish_locality(priv, i);
> >>
> >> I'm pretty unfamiliar with Intel TXT so asking a dummy question:
> >> if Intel TXT uses locality 2 I suppose we should not try to
> >> relinquish it, or?
> >>
> >> AFAIK, we don't have a symbol called MAX_LOCALITY.
> >
> > OK it was called TPM_MAX_LOCALITY :-) I had the patch set applied
> > in one branch but looked up with wrong symbol name.
> >
> > So I reformalize my question to two parts:
> >
> > 1. Why does TXT leave locality 2 open in the first place? I did
> > not see explanation. Isn't this a bug in TXT?
>
> It does so because that is what the TCG D-RTM specification requires.
> See Section 5.3.4.10 of the TCG D-RTM specification[1], the first
> requirement is, "The DLME SHALL receive control with access to Locality 2."
From below also the locality enumeration would be good to have
documented (as a reminder).
>
> > 2. Because localities are not too useful these days given TPM2's
> > policy mechanism I cannot recall out of top of my head can
> > you have two localities open at same time. So what kind of
> > conflict happens when you try to open locality 0 and have
> > locality 2 open?
>
> I would disagree and would call your attention to the TCG's
> definition/motivation for localities, Section 3.2 of Client PTP
> specification[2].
>
> "“Locality” is an assertion to the TPM that a command’s source is
> associated with a particular component. Locality can be thought of as a
> hardware-based authorization. The TPM is not actually aware of the
> nature of the relationship between the locality and the component. The
> ability to reset and extend notwithstanding, it is important to note
> that, from a PCR “usage” perspective, there is no hierarchical
> relationship between different localities. The TPM simply enforces
> locality restrictions on TPM assets (such as PCR or SEALed blobs)."
>
> As stated, from the TPM specification perspective, it is not aware of
> this mapping to components and leaves it to the platform to enforce.
Yeah, TPM is a passive component, not active actor, in everything.
The way I see locality as way to separate e.g. kernel and user space
driver TPM transactions is pretty much like actor-dependent salt
(e.g. if 0 was for user space and 1 was for kernel).
>
> "The protection and separation of the localities (and therefore the
> association with the associated components) is entirely the
> responsibility of the platform components. Platform components,
> including the OS, may provide the separation of localities using
> protection mechanisms such as virtual memory or paging."
>
> The x86 manufactures opted to adopt the D-RTM specification which
> defines the components as follows:
>
> Locality 4: Usually associated with the CPU executing microcode. This is
> used to establish the Dynamic RTM.
> Locality 3: Auxiliary components. Use of this is optional and, if used,
> it is implementation dependent.
> Locality 2: Dynamically Launched OS (Dynamic OS) “runtime” environment.
> Locality 1: An environment for use by the Dynamic OS.
> Locality 0: The Static RTM, its chain of trust and its environment.
>
> And the means to protect and separate those localities are encoded in
> the x86 chipset, i.e A D-RTM Event must be used to access any of the
> D-RTM Localities (Locality1 - Locality4).
>
> For Intel, Locality 4 can only be accessed when a dedicated signal
> between the CPU and the chipset is raised, thus only allowing the CPU to
> utilize Locality 4. The CPU will then close Locality 4, authenticate and
> give control to the ACM with access to Locality 3. When the ACM is
> complete, it will instruct the chipset to lock Locality 3 and give
> control to the DLME (MLE in Intel parlance) with Locality 2 open. It is
> up to the DLME, the Linux kernel in this case, to decide how to assign
> components to Locality 1 and 2.
>
> As to proposals to utilize localities by the Linux kernel, the only one
> I was aware of was dropped because they couldn't open the higher localities.
>
> I would also highlight that the D-RTM implementation guide for Arm
> allows for a hardware D-RTM event, which the vendor may choose to
> implement a hardware/CPU enforced access to TPM localities. Thus, the
> ability to support localities will also become a requirement for certain
> Arm CPUs.
>
> [1]
> https://trustedcomputinggroup.org/wp-content/uploads/TCG_D-RTM_Architecture_v1-0_Published_06172013.pdf
> [2]
> https://trustedcomputinggroup.org/wp-content/uploads/PC-Client-Specific-Platform-TPM-Profile-for-TPM-2p0-v1p05p_r14_pub.pdf
BR, Jarkko
next prev parent reply other threads:[~2024-02-23 20:50 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20240131170824.6183-1-dpsmith@apertussolutions.com>
2024-01-31 17:08 ` [PATCH 1/3] tpm: protect against locality counter underflow Daniel P. Smith
2024-02-01 22:21 ` Jarkko Sakkinen
2024-02-02 3:08 ` Lino Sanfilippo
2024-02-12 20:05 ` Jarkko Sakkinen
2024-02-19 17:54 ` Daniel P. Smith
2024-02-20 18:42 ` Alexander Steffen
2024-02-20 19:04 ` Jarkko Sakkinen
2024-02-20 20:54 ` Lino Sanfilippo
2024-02-20 22:23 ` Jarkko Sakkinen
2024-02-20 23:19 ` Lino Sanfilippo
2024-02-21 0:40 ` Jarkko Sakkinen
2024-02-23 1:58 ` Daniel P. Smith
2024-02-23 12:58 ` Jarkko Sakkinen
2024-02-25 11:23 ` Daniel P. Smith
2024-02-26 9:39 ` Jarkko Sakkinen
2024-02-20 22:26 ` Jarkko Sakkinen
2024-02-20 22:31 ` Jarkko Sakkinen
2024-02-20 23:26 ` Lino Sanfilippo
2024-02-21 0:42 ` Jarkko Sakkinen
2024-02-21 12:37 ` James Bottomley
2024-02-21 19:43 ` Jarkko Sakkinen
2024-02-21 19:45 ` Jarkko Sakkinen
2024-02-22 9:06 ` James Bottomley
2024-02-22 23:49 ` Jarkko Sakkinen
2024-02-23 1:57 ` Daniel P. Smith
2024-02-23 20:40 ` Jarkko Sakkinen
2024-02-23 20:42 ` Jarkko Sakkinen
2024-02-23 1:57 ` Daniel P. Smith
2024-02-23 20:50 ` Jarkko Sakkinen [this message]
2024-02-20 22:57 ` ross.philipson
2024-02-20 23:10 ` Jarkko Sakkinen
2024-02-20 23:13 ` Jarkko Sakkinen
2024-02-23 1:56 ` Daniel P. Smith
2024-02-23 20:44 ` Jarkko Sakkinen
2024-02-24 2:34 ` Lino Sanfilippo
2024-02-26 9:38 ` Jarkko Sakkinen
2024-02-23 1:55 ` Daniel P. Smith
2024-02-26 12:43 ` Alexander Steffen
2024-02-24 2:06 ` Lino Sanfilippo
2024-02-23 0:01 ` Jarkko Sakkinen
2024-01-31 17:08 ` [PATCH 2/3] tpm: ensure tpm is in known state at startup Daniel P. Smith
2024-02-01 22:33 ` Jarkko Sakkinen
2024-02-19 19:17 ` Daniel P. Smith
2024-02-19 20:17 ` Jarkko Sakkinen
2024-01-31 17:08 ` [PATCH 3/3] tpm: make locality request return value consistent Daniel P. Smith
2024-02-01 22:49 ` Jarkko Sakkinen
2024-02-19 20:29 ` Daniel P. Smith
2024-02-19 20:45 ` Jarkko Sakkinen
2024-02-20 18:57 ` Alexander Steffen
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=CZCR76MKS60B.UHM5MC0SBOQY@suppilovahvero \
--to=jarkko@kernel.org \
--cc=Alexander.Steffen@infineon.com \
--cc=dpsmith@apertussolutions.com \
--cc=jgg@ziepe.ca \
--cc=kanth.ghatraju@oracle.com \
--cc=l.sanfilippo@kunbus.com \
--cc=linux-integrity@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterhuewe@gmx.de \
--cc=ross.philipson@oracle.com \
--cc=sashal@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;
as well as URLs for NNTP newsgroup(s).