Re: [RFC PATCH] platform/x86: Add sysfs interface for Intel TXT status

From: Matthew Garrett
Date: Wed Mar 09 2022 - 05:53:52 EST


On Wed, Mar 09, 2022 at 10:40:03AM +0000, Jonathan McDowell wrote:

> This module provides read-only access to the Intel TXT (Trusted
> Execution Technology) status registers, allowing userspace to determine
> the status of measured boot and whether the dynamic root of trust for
> measurement (DRTM) has been fully enabled.

So there's the obvious issue that in the event that the system has been
compromised this information is no longer trustworthy - is this expected
to just be informative for diagnostic purposes rather than forming any
part of security policy?

> + These registers provide details about the status of the platform's
> + measured launch and execution environment, allowing userspace to
> + make trust based decisions. See tboot

Mm. This makes it sound like it's expected that userspace make decisions
based on this, which sounds like a bad plan?

> +/* Shows if TXT has been enabled */
> +static int txt_enabled_show(struct seq_file *m, void *v)
> +{
> + /* If the BIOS has enabled TXT then the heap base will be set */

Sorry it's not that I want to say "Wait are you trusting that the BIOS
will do the right thing here" but wait are you trusting that the BIOS
will do the right thing here? Does setting the heap base guarantee that
TXT was enabled (and, conversely, are there any scenarios where TXT was
enabled and the BIOS could have cleared the heap base after a
measurement event?)

> +/* Shows the 256 bit hash of the public key */
> +static int txt_key_show(struct seq_file *m, void *v)
> +{
> + seq_printf(m, "%016llx%016llx%016llx%016llx\n",
> + cpu_to_be64(*(u64 *)(txt_pub_regs + TXT_CR_PUBLIC_KEY)),
> + cpu_to_be64(*(u64 *)(txt_pub_regs + TXT_CR_PUBLIC_KEY + 8)),
> + cpu_to_be64(*(u64 *)(txt_pub_regs + TXT_CR_PUBLIC_KEY + 16)),
> + cpu_to_be64(*(u64 *)(txt_pub_regs + TXT_CR_PUBLIC_KEY + 24)));

What's the expected consumer of this, and what are they expected to do
with it?