Start building drivers/attestation
Subsystems (7)
Jason Gunthorpe
maintainercover Start building drivers/attestation
Move tsm_report and tsm_mr, along with all their drivers, into drivers/attestation. There are no functional changes, but some modules are renamed to consistent attestation_* names.
This largely just moves drivers/virt/coco/* stuff to drivers/attestation and makes some adjustments to have per-arch subdirectories to hold all the stuff. virt/coco was OK when this was only going to be used inside confidential VMs, but with the new coming needs for bare metal and host support under the same umbrella it isn't a good place to build an entire subsystem.
The attestation subsystem is intended to support drivers for all Roots of Trust (ROTs), both local to the CPU and on-device ROTs accessed through SPDM. A well-known example of a ROT is a Trusted Platform Module, though many different specifications for much simpler ROTs now exist.
The existing drivers are all for the ROTs integrated into confidential VMs. AMD, Intel and ARM each have an attestation ROT linked to their respective implementations.
A following set of drivers, like ARM FIRME, will start to bring in non-TPM ROTs on bare metal systems. The kernel SPDM implementation will also live here and use the upcoming enhanced uAPI.
Eventually we hope to provide a kernel multiplexer so that in-kernel users, like IMA, can access any attestation measurement register instead of being hardwired to use only the TPM.
Several reorganization and cleanup passes will be needed after this to turn it into a well-formed subsystem.
Jason Gunthorpe (4):
attestation: Start the new subsystem using tsm_report and mr
attestation: Move the ARM Realm Token tsm_report driver
attestation: Move Intel TDX Guest tsm_report and mr driver
attestation: Move AMD SEV Guest tsm_report driver
.../sysfs-devices-virtual-misc-tdx_guest | 2 +-
Documentation/driver-api/attestation.rst | 36 +++++++++++++++++++
Documentation/driver-api/coco/index.rst | 10 ------
.../driver-api/coco/measurement-registers.rst | 12 -------
Documentation/driver-api/index.rst | 2 +-
MAINTAINERS | 5 ++-
arch/x86/coco/tdx/tdx.c | 8 ++---
drivers/Kconfig | 2 ++
drivers/Makefile | 2 ++
drivers/attestation/Kconfig | 23 ++++++++++++
drivers/attestation/Makefile | 9 +++++
drivers/attestation/amd/Kconfig | 15 ++++++++
drivers/attestation/amd/Makefile | 4 +++
.../sev-guest => attestation/amd}/sev-guest.c | 2 +-
drivers/attestation/arm/Kconfig | 12 +++++++
drivers/attestation/arm/Makefile | 4 +++
.../main.c => attestation/arm/cca-guest.c} | 2 +-
drivers/attestation/intel/Kconfig | 13 +++++++
drivers/attestation/intel/Makefile | 4 +++
.../intel}/tdx-guest.c | 4 +--
.../{virt/coco/guest => attestation}/tsm-mr.c | 0
.../report.c => attestation/tsm-report.c} | 0
drivers/virt/coco/Kconfig | 8 -----
drivers/virt/coco/Makefile | 4 ---
drivers/virt/coco/arm-cca-guest/Kconfig | 11 ------
drivers/virt/coco/arm-cca-guest/Makefile | 4 ---
drivers/virt/coco/guest/Kconfig | 16 ---------
drivers/virt/coco/guest/Makefile | 4 ---
drivers/virt/coco/sev-guest/Kconfig | 13 -------
drivers/virt/coco/sev-guest/Makefile | 2 --
drivers/virt/coco/tdx-guest/Kconfig | 12 -------
drivers/virt/coco/tdx-guest/Makefile | 2 --
samples/Kconfig | 3 +-
tools/testing/selftests/tdx/config | 2 +-
34 files changed, 138 insertions(+), 114 deletions(-)
create mode 100644 Documentation/driver-api/attestation.rst
delete mode 100644 Documentation/driver-api/coco/index.rst
delete mode 100644 Documentation/driver-api/coco/measurement-registers.rst
create mode 100644 drivers/attestation/Kconfig
create mode 100644 drivers/attestation/Makefile
create mode 100644 drivers/attestation/amd/Kconfig
create mode 100644 drivers/attestation/amd/Makefile
rename drivers/{virt/coco/sev-guest => attestation/amd}/sev-guest.c (99%)
create mode 100644 drivers/attestation/arm/Kconfig
create mode 100644 drivers/attestation/arm/Makefile
rename drivers/{virt/coco/arm-cca-guest/main.c => attestation/arm/cca-guest.c} (99%)
create mode 100644 drivers/attestation/intel/Kconfig
create mode 100644 drivers/attestation/intel/Makefile
rename drivers/{virt/coco/tdx-guest => attestation/intel}/tdx-guest.c (99%)
rename drivers/{virt/coco/guest => attestation}/tsm-mr.c (100%)
rename drivers/{virt/coco/guest/report.c => attestation/tsm-report.c} (100%)
delete mode 100644 drivers/virt/coco/arm-cca-guest/Kconfig
delete mode 100644 drivers/virt/coco/arm-cca-guest/Makefile
delete mode 100644 drivers/virt/coco/guest/Kconfig
delete mode 100644 drivers/virt/coco/guest/Makefile
delete mode 100644 drivers/virt/coco/sev-guest/Kconfig
delete mode 100644 drivers/virt/coco/sev-guest/Makefile
delete mode 100644 drivers/virt/coco/tdx-guest/Kconfig
delete mode 100644 drivers/virt/coco/tdx-guest/Makefilebase-commit: 08b2d931027c237d749c934bcad406a79818123b
Signature · 1 line
2.43.0
Jason Gunthorpe
maintainerPATCH 1/4 attestation: Start the new subsystem using tsm_report and mr
Create a basic starting point for drivers/attestation by moving the tsm_report and tsm_mr core code into drivers/attestation and revising the Documentation.
The attestation subsystem is intended to support drivers for all Roots of Trust (ROTs), both local to the CPU and on-device ROTs accessed through SPDM. A well-known example of a ROT is a Trusted Platform Module, though many different specifications for much simpler ROTs now exist.
In general, a ROT is a HW device that securely holds a private key, can generate signed evidence reflecting its current state, and often includes a measurement register system to create a tamper-proof log signed by its private key. Sophisticated ROTs may also provide functions like sealing.
ROTs have become a significant security technology in the server space. They are used to ensure the supply chain has not been tampered with and to confirm directly that devices are running the expected, untampered firmware and software.
tsm_report and tsm_mr each implement half of a ROT. tsm_mr allows manipulating the measurement registers that tsm_report produces signed evidence over. As things are restructured there will be one driver for the ROT, and the two uAPIs of report and mr will continue forward using that single driver.
Ultimately the subsystem should encompass at least the following devices:
* A simplified TPM interface for quote and PCR extend
* AMD CC VM signed reports
* ARM CCA VM signed reports and REM measurement registers
* ARM FIRME bare metal signed reports
* Caliptra open source ROT
* Intel TDX CC VM signed reports and RTMR measurement registers
* SPDM protocol over PCIe DOE and other transports in bare metal
* "SPDM" evidence inside a CC guest using a TDISP device
---
.../sysfs-devices-virtual-misc-tdx_guest | 2 +-
Documentation/driver-api/attestation.rst | 36 +++++++++++++++++++
Documentation/driver-api/coco/index.rst | 10 ------
.../driver-api/coco/measurement-registers.rst | 12 -------
Documentation/driver-api/index.rst | 2 +-
MAINTAINERS | 4 +--
drivers/Kconfig | 2 ++
drivers/Makefile | 2 ++
drivers/attestation/Kconfig | 17 +++++++++
drivers/attestation/Makefile | 5 +++
.../{virt/coco/guest => attestation}/tsm-mr.c | 0
.../report.c => attestation/tsm-report.c} | 0
drivers/virt/coco/Kconfig | 2 --
drivers/virt/coco/Makefile | 1 -
drivers/virt/coco/arm-cca-guest/Kconfig | 2 +-
drivers/virt/coco/guest/Kconfig | 16 ---------
drivers/virt/coco/guest/Makefile | 4 ---
drivers/virt/coco/sev-guest/Kconfig | 2 +-
drivers/virt/coco/tdx-guest/Kconfig | 3 +-
samples/Kconfig | 3 +-
20 files changed, 70 insertions(+), 55 deletions(-)
create mode 100644 Documentation/driver-api/attestation.rst
delete mode 100644 Documentation/driver-api/coco/index.rst
delete mode 100644 Documentation/driver-api/coco/measurement-registers.rst
create mode 100644 drivers/attestation/Kconfig
create mode 100644 drivers/attestation/Makefile
rename drivers/{virt/coco/guest => attestation}/tsm-mr.c (100%)
rename drivers/{virt/coco/guest/report.c => attestation/tsm-report.c} (100%)
delete mode 100644 drivers/virt/coco/guest/Kconfig
delete mode 100644 drivers/virt/coco/guest/MakefileDocumentation/ABI/testing/sysfs-devices-virtual-misc-tdx_guest +1 -1
@@ -14,7 +14,7 @@ Description: https://www.intel.com/content/www/us/en/developer/tools/trust-domain-extensions/documentation.html#architecture See also: - https://docs.kernel.org/driver-api/coco/measurement-registers.html + https://docs.kernel.org/driver-api/attestation.html What: /sys/devices/virtual/misc/tdx_guest/measurements/mrconfigid Date: April, 2025
Documentation/driver-api/attestation.rst new file +36 -0
@@ -0,0 +1,36 @@ +.. SPDX-License-Identifier: GPL-2.0 +.. include:: <isonum.txt> + +===================== +Attestation Subsystem +===================== + +Attestation subsystem is intended to support drivers for all Roots of Trust +(ROTs), both local to the CPU and on-device ROTs accessed through SPDM. A well +known example of a ROT is a Trusted Platform Module, though many different +specifications for much simpler ROTs exist now. + +In general a ROT is a HW device that securely holds a private key, can generate +a signed evidence reflecting its current state and often includes a measurement +register system to create a tamper proof log signed by its private key. +Sophisticated ROTs may also provide functions like sealing. + +ROTs have become a significant security technology in the server space. They are +used to ensure the supply chain has not been tampered with and confirm directly +that devices are running expected untampered firmware and software. + +Measurement Registers +===================== + +"Measurement Registers" (called a PCR in the TPM standards) are used for +creating a tamper proof log. The register stores the current top of something +like a Merkle Tree which chains cryptographic hash functions together to reflect +the current content of a dynamically growing log. When the ROT generates signed +evidence it will sign this value which allows verifying that the associated log +is unchanged. + +.. kernel-doc:: include/linux/tsm-mr.h + :internal: + +.. kernel-doc:: drivers/attestation/tsm-mr.c + :export:
Documentation/driver-api/coco/index.rst deleted +0 -10
@@ -1,10 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0 - -====================== -Confidential Computing -====================== - -.. toctree:: - :maxdepth: 1 - - measurement-registers
Documentation/driver-api/coco/measurement-registers.rst deleted +0 -12
@@ -1,12 +0,0 @@ -.. SPDX-License-Identifier: GPL-2.0 -.. include:: <isonum.txt> - -===================== -Measurement Registers -===================== - -.. kernel-doc:: include/linux/tsm-mr.h - :internal: - -.. kernel-doc:: drivers/virt/coco/guest/tsm-mr.c - :export:
Documentation/driver-api/index.rst +1 -1
@@ -80,9 +80,9 @@ Subsystem-specific APIs 80211/index acpi/index + attestation backlight/lp855x-driver.rst clk - coco/index console crypto/index dmaengine/index
MAINTAINERS +2 -2
@@ -28543,12 +28543,12 @@ L: [email protected] S: Maintained T: git git://git.kernel.org/pub/scm/linux/kernel/git/tsm/linux.git F: Documentation/ABI/testing/configfs-tsm-report -F: Documentation/driver-api/coco/ +F: Documentation/driver-api/attestation.rst F: Documentation/driver-api/pci/tsm.rst +F: drivers/attestation/ F: drivers/crypto/ccp/sev-dev-tio.* F: drivers/crypto/ccp/sev-dev-tsm.c F: drivers/pci/tsm.c -F: drivers/virt/coco/guest/ F: drivers/virt/coco/tsm-core.c F: include/linux/*tsm*.h F: samples/tsm-mr/
drivers/Kconfig +2 -0
@@ -143,6 +143,8 @@ source "drivers/uio/Kconfig" source "drivers/vfio/Kconfig" +source "drivers/attestation/Kconfig" + source "drivers/virt/Kconfig" source "drivers/virtio/Kconfig"
drivers/Makefile +2 -0
@@ -159,6 +159,8 @@ obj-$(CONFIG_REMOTEPROC) += remoteproc/ obj-$(CONFIG_RPMSG) += rpmsg/ obj-$(CONFIG_SOUNDWIRE) += soundwire/ +obj-$(CONFIG_ATTESTATION) += attestation/ + # Virtualization drivers obj-y += virt/ obj-$(CONFIG_HYPERV) += hv/
drivers/attestation/Kconfig new file +17 -0
@@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-only + +menuconfig ATTESTATION + tristate "Attestation and root of trust devices" + select CONFIGFS_FS + select CRYPTO_HASH_INFO + help + Attestation and root of trust (RoT) devices include a range of + hardware used in machine attestation. Typically, this hardware + protects a private key and can generate signed evidence to report + its state. A root of trust often has measurement registers used to + create a tamper-proof log. + + The subsystem supports drivers for devices of this class and provides + uAPIs to get the information out to userspace. + + If you are unsure, say N.
drivers/attestation/Makefile new file +5 -0
@@ -0,0 +1,5 @@ +# SPDX-License-Identifier: GPL-2.0 +attestation-y := \ + tsm-mr.o \ + tsm-report.o +obj-$(CONFIG_ATTESTATION) += attestation.o
drivers/attestation/tsm-mr.c renamed from drivers/virt/coco/guest/tsm-mr.c +0 -0
drivers/attestation/tsm-report.c renamed from drivers/virt/coco/guest/report.c +0 -0
drivers/virt/coco/Kconfig +0 -2
@@ -13,8 +13,6 @@ source "drivers/virt/coco/sev-guest/Kconfig" source "drivers/virt/coco/tdx-guest/Kconfig" source "drivers/virt/coco/arm-cca-guest/Kconfig" - -source "drivers/virt/coco/guest/Kconfig" endif source "drivers/virt/coco/tdx-host/Kconfig"
drivers/virt/coco/Makefile +0 -1
@@ -9,4 +9,3 @@ obj-$(CONFIG_INTEL_TDX_GUEST) += tdx-guest/ obj-$(CONFIG_INTEL_TDX_HOST) += tdx-host/ obj-$(CONFIG_ARM_CCA_GUEST) += arm-cca-guest/ obj-$(CONFIG_TSM) += tsm-core.o -obj-$(CONFIG_TSM_GUEST) += guest/
drivers/virt/coco/arm-cca-guest/Kconfig +1 -1
@@ -2,7 +2,7 @@ config ARM_CCA_GUEST tristate "Arm CCA Guest driver" depends on ARM_RMM_RSI depends on HAVE_ARM_SMCCC_DISCOVERY - select TSM_REPORTS + depends on ATTESTATION help The driver provides userspace interface to request and attestation report from the Realm Management Monitor(RMM).
drivers/virt/coco/guest/Kconfig deleted +0 -16
@@ -1,16 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -# -# Confidential computing shared guest collateral -# -config TSM_GUEST - bool - -config TSM_REPORTS - select TSM_GUEST - select CONFIGFS_FS - tristate - -config TSM_MEASUREMENTS - select TSM_GUEST - select CRYPTO_HASH_INFO - bool
drivers/virt/coco/guest/Makefile deleted +0 -4
@@ -1,4 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_TSM_REPORTS) += tsm_report.o -tsm_report-y := report.o -obj-$(CONFIG_TSM_MEASUREMENTS) += tsm-mr.o
drivers/virt/coco/sev-guest/Kconfig +1 -1
@@ -2,7 +2,7 @@ config SEV_GUEST tristate "AMD SEV Guest driver" default m depends on AMD_MEM_ENCRYPT - select TSM_REPORTS + depends on ATTESTATION help SEV-SNP firmware provides the guest a mechanism to communicate with the PSP without risk from a malicious hypervisor who wishes to read,
drivers/virt/coco/tdx-guest/Kconfig +1 -2
@@ -1,8 +1,7 @@ config TDX_GUEST_DRIVER tristate "TDX Guest driver" depends on INTEL_TDX_GUEST - select TSM_REPORTS - select TSM_MEASUREMENTS + depends on ATTESTATION help The driver provides userspace interface to communicate with the TDX module to request the TDX guest details like attestation
samples/Kconfig +1 -2
@@ -195,10 +195,9 @@ config SAMPLE_TIMER config SAMPLE_TSM_MR tristate "TSM measurement sample" + depends on ATTESTATION select CRYPTO_LIB_SHA256 select CRYPTO_LIB_SHA512 - select TSM_MEASUREMENTS - select VIRT_DRIVERS help Build a sample module that emulates MRs (Measurement Registers) and exposes them to user mode applications through the TSM sysfs
Signature · 1 line
2.43.0
Re: [PATCH tsm 1/4] attestation: Start the new subsystem using tsm_report and mr
Quoted 36 lines · Jason Gunthorpe
Create a basic starting point for
drivers/attestationby moving thetsm_reportandtsm_mrcore code intodrivers/attestationand revising the Documentation.The attestation subsystem is intended to support drivers for all Roots of Trust (ROTs), both local to the CPU and on-device ROTs accessed through SPDM. A well-known example of a ROT is a Trusted Platform Module, though many different specifications for much simpler ROTs now exist.
In general, a ROT is a HW device that securely holds a private key, can generate signed evidence reflecting its current state, and often includes a measurement register system to create a tamper-proof log signed by its private key. Sophisticated ROTs may also provide functions like sealing.
ROTs have become a significant security technology in the server space. They are used to ensure the supply chain has not been tampered with and to confirm directly that devices are running the expected, untampered firmware and software.
tsm_reportandtsm_mreach implement half of a ROT.tsm_mrallows manipulating the measurement registers thattsm_reportproduces signed evidence over. As things are restructured there will be one driver for the ROT, and the two uAPIs of report and mr will continue forward using that single driver.Ultimately the subsystem should encompass at least the following devices:
* A simplified TPM interface for quote and PCR extend
* AMD CC VM signed reports
* ARM CCA VM signed reports and REM measurement registers
* ARM FIRME bare metal signed reports
* Caliptra open source ROT
* Intel TDX CC VM signed reports and RTMR measurement registers
* SPDM protocol over PCIe DOE and other transports in bare metal
* "SPDM" evidence inside a CC guest using a TDISP deviceSigned-off-by Jason Gunthorpe <[email protected]>
<...>
drivers/attestation/Kconfig line 4
Quoted 7 lines
drivers/attestation/Kconfig new file +4
-0@@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-only + +menuconfig ATTESTATION + tristate "Attestation and root of trust devices"
I wonder if you really want this subsystem to be built as module. Why not to declare as bool?
Thanks
Quoted 13 lines
drivers/attestation/Kconfig new file +13
-0+ select CONFIGFS_FS + select CRYPTO_HASH_INFO + help + Attestation and root of trust (RoT) devices include a range of + hardware used in machine attestation. Typically, this hardware + protects a private key and can generate signed evidence to report + its state. A root of trust often has measurement registers used to + create a tamper-proof log. + + The subsystem supports drivers for devices of this class and provides + uAPIs to get the information out to userspace. + + If you are unsure, say N.
Jason Gunthorpe
maintainerRe: [PATCH tsm 1/4] attestation: Start the new subsystem using tsm_report and mr
Quoted 9 lines · Leon Romanovsky
drivers/attestation/Kconfig line 4
Quoted 5 lines · Jason Gunthorpe
drivers/attestation/Kconfig new file +4
-0@@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-only + +menuconfig ATTESTATION + tristate "Attestation and root of trust devices"I wonder if you really want this subsystem to be built as module. Why not to declare as bool?
When we get a kapi the in-kernel users can depend on it and then it can naturally be forced to non-modular. IMA and DRTM will both by non-modular users.
ATM we don't have that and all the existing is non-modular so this seems OK.
Jason
Jason Gunthorpe
maintainerPATCH 2/4 attestation: Move the ARM Realm Token tsm_report driver
In reply to Jason Gunthorpedrivers/virt/coco/arm-cca-guest/main.c is a bit broadly named, but it is the driver for the Root of Trust inside the RMM, which the guest accesses only through RSI calls.
This is commonly called the "Realm Token". It also has 4 measurement registers, but there is no driver for them in Linux yet.
Move it into drivers/attestation/arm/cca-guest.c.
The simple rename takes the arm_smccc_driver for SMC_RSI_ABI_VERSION along with it. This isn't going to work long term, but Yeoreum has some good ideas on how to split multi-function SMCCC interfaces into subsystem-specific drivers that will solve this.
---
MAINTAINERS | 1 -
drivers/attestation/Kconfig | 4 ++++
drivers/attestation/Makefile | 2 ++
drivers/attestation/arm/Kconfig | 12 ++++++++++++
drivers/attestation/arm/Makefile | 4 ++++
.../main.c => attestation/arm/cca-guest.c} | 2 +-
drivers/virt/coco/Kconfig | 2 --
drivers/virt/coco/Makefile | 1 -
drivers/virt/coco/arm-cca-guest/Kconfig | 11 -----------
drivers/virt/coco/arm-cca-guest/Makefile | 4 ----
10 files changed, 23 insertions(+), 20 deletions(-)
create mode 100644 drivers/attestation/arm/Kconfig
create mode 100644 drivers/attestation/arm/Makefile
rename drivers/{virt/coco/arm-cca-guest/main.c => attestation/arm/cca-guest.c} (99%)
delete mode 100644 drivers/virt/coco/arm-cca-guest/Kconfig
delete mode 100644 drivers/virt/coco/arm-cca-guest/MakefileMAINTAINERS +0 -1
@@ -4041,7 +4041,6 @@ F: Documentation/ABI/testing/sysfs-firmware-cca F: Documentation/arch/arm64/ F: arch/arm64/ F: drivers/firmware/arm_rmm/ -F: drivers/virt/coco/arm-cca-guest/ F: drivers/virt/coco/pkvm-guest/ F: include/linux/arm-rmi-cmds.h F: include/linux/arm-rsi-cmds.h
drivers/attestation/Kconfig +4 -0
@@ -15,3 +15,7 @@ menuconfig ATTESTATION uAPIs to get the information out to userspace. If you are unsure, say N. + +if ATTESTATION +source "drivers/attestation/arm/Kconfig" +endif # ATTESTATION
drivers/attestation/Makefile +2 -0
@@ -3,3 +3,5 @@ attestation-y := \ tsm-mr.o \ tsm-report.o obj-$(CONFIG_ATTESTATION) += attestation.o + +obj-$(CONFIG_ATTESTATION_ARM_CCA_GUEST) += arm/
drivers/attestation/arm/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-only +config ATTESTATION_ARM_CCA_GUEST + tristate "Arm CCA Realm Token Attestation Driver" + depends on ARM_RMM_RSI + depends on HAVE_ARM_SMCCC_DISCOVERY + help + Driver for the Realm Token provided by the Root of Trust inside + the Realm Management Monitor (RMM) through an RSI. + + Reports are available in user-created directories under + /sys/kernel/config/tsm/report/ with provider "arm_cca_guest". + This driver does not expose TSM measurement registers.
drivers/attestation/arm/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only +attestation_arm_cca_guest-y := cca-guest.o + +obj-$(CONFIG_ATTESTATION_ARM_CCA_GUEST) += attestation_arm_cca_guest.o
drivers/attestation/arm/cca-guest.c renamed from drivers/virt/coco/arm-cca-guest/main.c +1 -1
@@ -158,7 +158,7 @@ static int arm_cca_report_new(struct tsm_report *report, void *data) }static const struct tsm_report_ops arm_cca_tsm_report_ops = { - .name =KBUILD_MODNAME , + .name ="arm_cca_guest" , .report_new = arm_cca_report_new, };
drivers/virt/coco/Kconfig +0 -2
@@ -11,8 +11,6 @@ source "drivers/virt/coco/pkvm-guest/Kconfig" source "drivers/virt/coco/sev-guest/Kconfig" source "drivers/virt/coco/tdx-guest/Kconfig" - -source "drivers/virt/coco/arm-cca-guest/Kconfig" endif source "drivers/virt/coco/tdx-host/Kconfig"
drivers/virt/coco/Makefile +0 -1
@@ -7,5 +7,4 @@ obj-$(CONFIG_ARM_PKVM_GUEST) += pkvm-guest/ obj-$(CONFIG_SEV_GUEST) += sev-guest/ obj-$(CONFIG_INTEL_TDX_GUEST) += tdx-guest/ obj-$(CONFIG_INTEL_TDX_HOST) += tdx-host/ -obj-$(CONFIG_ARM_CCA_GUEST) += arm-cca-guest/ obj-$(CONFIG_TSM) += tsm-core.o
drivers/virt/coco/arm-cca-guest/Kconfig deleted +0 -11
@@ -1,11 +0,0 @@ -config ARM_CCA_GUEST - tristate "Arm CCA Guest driver" - depends on ARM_RMM_RSI - depends on HAVE_ARM_SMCCC_DISCOVERY - depends on ATTESTATION - help - The driver provides userspace interface to request and - attestation report from the Realm Management Monitor(RMM). - - If you choose 'M' here, this module will be called - arm-cca-guest.
drivers/virt/coco/arm-cca-guest/Makefile deleted +0 -4
@@ -1,4 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -obj-$(CONFIG_ARM_CCA_GUEST) += arm-cca-guest.o - -arm-cca-guest-y += main.o
Signature · 1 line
2.43.0
Aneesh Kumar K.V
maintainerRe: [PATCH tsm 2/4] attestation: Move the ARM Realm Token tsm_report driver
Quoted 7 lines · Jason Gunthorpe
drivers/virt/coco/arm-cca-guest/main.cis a bit broadly named, but it is the driver for the Root of Trust inside the RMM, which the guest accesses only through RSI calls.This is commonly called the "Realm Token". It also has 4 measurement registers, but there is no driver for them in Linux yet.
Quoted 7 lines
Move it into
drivers/attestation/arm/cca-guest.c.The simple rename takes the
arm_smccc_driverforSMC_RSI_ABI_VERSIONalong with it. This isn't going to work long term, but Yeoreum has some good ideas on how to split multi-function SMCCC interfaces into subsystem-specific drivers that will solve this.
[ ... 150 lines skipped ... ]
That creates quite a bit of confusion around the guest driver. The CoCo driver, arm-cca-guest.ko, will gain many additional features. The model I have been working towards is for arm-cca-guest.ko to be the driver for the arm-rsi device and, depending on the relevant conditions, register with different subsystems. For example, it registers an attestation device by calling:
attestation_cca_guest_register(dsc->realm_dev, dsc->binding, tsm);
attestation_cca_guest_register() will be provided by attestation-cca-guest.ko, with the implementation in drivers/attestation/arm/cca/da-guest.c.
IMHO, drivers/virt/coco should remain the location of the CoCo driver, which should manage the arm-rsi device. Once tsm_report is moved to the attestation framework, the cca-guest attestation driver would similarly provide the corresponding registration functions.
-aneesh
Jason Gunthorpe
maintainerRe: [PATCH tsm 2/4] attestation: Move the ARM Realm Token tsm_report driver
Quoted 17 lines · Aneesh Kumar K.V
Quoted 7 lines · Jason Gunthorpe
drivers/virt/coco/arm-cca-guest/main.cis a bit broadly named, but it is the driver for the Root of Trust inside the RMM, which the guest accesses only through RSI calls.This is commonly called the "Realm Token". It also has 4 measurement registers, but there is no driver for them in Linux yet.
Quoted 7 lines
Move it into
drivers/attestation/arm/cca-guest.c.The simple rename takes the
arm_smccc_driverforSMC_RSI_ABI_VERSIONalong with it. This isn't going to work long term, but Yeoreum has some good ideas on how to split multi-function SMCCC interfaces into subsystem-specific drivers that will solve this.
Quoted 4 lines
[ ... 150 lines skipped ... ]
That creates quite a bit of confusion around the guest driver. The CoCo driver, arm-cca-guest.ko, will gain many additional features.
Not really, it prevent confusions by splitting things up by functionality.
This file today is 100% the realm token driver. It would make things worse to cram a bunch of other unrelated stuff into it later on and then try to split out again.
Lets start with things in the right place before we add more stuff.
Quoted 6 lines
The model I have been working towards is for arm-cca-guest.ko to be the driver for the arm-rsi device and, depending on the relevant conditions, register with different subsystems. For example, it registers an attestation device by calling:
attestation_cca_guest_register(dsc->realm_dev, dsc->binding, tsm);
That call is the job of the tsm driver, and we still need to figure out where that all lives. A tsm driver for bare metal living in drivers/virt/coco is pretty nonsensical too. As is AMD putting their tsm driver in drivers/crypto :\
TSM has the same issue, I don't want to see drivers strewn all over the place. I'm strongly thinking that drivers/firwmare/tsm/ is probably the right thing to do there too.
Quoted 3 lines
attestation_cca_guest_register()will be provided by attestation-cca-guest.ko, with the implementation indrivers/attestation/arm/cca/da-guest.c.
Sure, that makes sense, and this patch is just the realm token version of the same idea.
Quoted 2 lines
IMHO,
drivers/virt/cocoshould remain the location of the CoCo driver, which should manage the arm-rsi device.
We don't need a "rsi device" for the realm token, we just need to autoprobe the module somehow.
Quoted 3 lines
Once
tsm_reportis moved to the attestation framework, the cca-guest attestation driver would similarly provide the corresponding registration functions.
That doesn't seem as nice - I prefer Yeoreum's enhancement to the smcc bus..
But which ever direction things go the report/attestation code wants to live here where I moved it and all this code belongs there. We will figure out the driver binding to deal with the 'multi function smccc' in one way or another so we can have proper drivers housed in their proper subsystems.
The FIRME stuff has the same issue it wants an attestation driver and a TSM driver, which is why I liked the smcc bus enhancement. It is nice and reusable for each. You can just fork off the two drivers naturally and then have some shared 'arm_rsi' or 'arm_firme' helper library under drivers/firmware/arm as necessary.
Jason
Jason Gunthorpe
maintainerPATCH 3/4 attestation: Move Intel TDX Guest tsm_report and mr driver
In reply to Jason Gunthorpetdx-guest.c is the driver for the Root of Trust inside the TDX module accessed by the guest.
The Intel TDX spec supports two token formats and 4 measurement registers.
Move it into drivers/attestation/intel/tdx-guest.c.
Module autoloading continues to be triggered by the x86_cpu_id match mechanism.
---
arch/x86/coco/tdx/tdx.c | 8 ++++----
drivers/attestation/Kconfig | 1 +
drivers/attestation/Makefile | 1 +
drivers/attestation/intel/Kconfig | 13 +++++++++++++
drivers/attestation/intel/Makefile | 4 ++++
.../tdx-guest => attestation/intel}/tdx-guest.c | 4 ++--
drivers/virt/coco/Kconfig | 2 --
drivers/virt/coco/Makefile | 1 -
drivers/virt/coco/tdx-guest/Kconfig | 11 -----------
drivers/virt/coco/tdx-guest/Makefile | 2 --
tools/testing/selftests/tdx/config | 2 +-
11 files changed, 26 insertions(+), 23 deletions(-)
create mode 100644 drivers/attestation/intel/Kconfig
create mode 100644 drivers/attestation/intel/Makefile
rename drivers/{virt/coco/tdx-guest => attestation/intel}/tdx-guest.c (99%)
delete mode 100644 drivers/virt/coco/tdx-guest/Kconfig
delete mode 100644 drivers/virt/coco/tdx-guest/Makefilearch/x86/coco/tdx/tdx.c +4 -4
@@ -139,7 +139,7 @@ int tdx_mcall_get_report0(u8 *reportdata, u8 *tdreport)return 0 ; } -EXPORT_SYMBOL_FOR_MODULES (tdx_mcall_get_report0,"tdx-guest" ); +EXPORT_SYMBOL_FOR_MODULES (tdx_mcall_get_report0,"attestation_intel_tdx_guest" );/** * tdx_mcall_extend_rtmr() - Wrapper to extend RTMR registers using
@@ -175,7 +175,7 @@ int tdx_mcall_extend_rtmr(u8 index, u8 *data)return 0 ; } -EXPORT_SYMBOL_FOR_MODULES (tdx_mcall_extend_rtmr,"tdx-guest" ); +EXPORT_SYMBOL_FOR_MODULES (tdx_mcall_extend_rtmr,"attestation_intel_tdx_guest" );/** * tdx_hcall_get_quote() - Wrapper to request TD Quote using GetQuote
@@ -196,7 +196,7 @@ u64 tdx_hcall_get_quote(void *buf, size_t size)/* Since buf is a shared memory, set the shared (decrypted) bits */ return _tdx_hypercall (TDVMCALL_GET_QUOTE ,cc_mkdec (virt_to_phys (buf)), size,0 ,0 ); } -EXPORT_SYMBOL_FOR_MODULES (tdx_hcall_get_quote,"tdx-guest" ); +EXPORT_SYMBOL_FOR_MODULES (tdx_hcall_get_quote,"attestation_intel_tdx_guest" );/* * Ask the TDX module what the largest Quote on the host platform might be.
@@ -213,7 +213,7 @@ int tdx_get_max_quote_size(u64 *max_quote_size)return 0 ; } -EXPORT_SYMBOL_FOR_MODULES (tdx_get_max_quote_size,"tdx-guest" ); +EXPORT_SYMBOL_FOR_MODULES (tdx_get_max_quote_size,"attestation_intel_tdx_guest" );/* * The kernel cannot handle #VEs when accessing normal kernel memory. Ensure
drivers/attestation/Kconfig +1 -0
@@ -18,4 +18,5 @@ menuconfig ATTESTATION if ATTESTATION source "drivers/attestation/arm/Kconfig" +source "drivers/attestation/intel/Kconfig" endif # ATTESTATION
drivers/attestation/Makefile +1 -0
@@ -5,3 +5,4 @@ attestation-y := \ obj-$(CONFIG_ATTESTATION) += attestation.o obj-$(CONFIG_ATTESTATION_ARM_CCA_GUEST) += arm/ +obj-$(CONFIG_ATTESTATION_INTEL_TDX_GUEST) += intel/
drivers/attestation/intel/Kconfig new file +13 -0
@@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0-only +config ATTESTATION_INTEL_TDX_GUEST + tristate "Intel TDX Guest Attestation Driver" + depends on INTEL_TDX_GUEST + help + Driver for the TDX guest signed quote from the Root of Trust inside + the TDX module for confidential VMs. The quote includes 4 measurement + registers. + + Reports are available in user-created directories under + /sys/kernel/config/tsm/report/ with provider "tdx_guest". + Measurement registers are exposed under + /sys/devices/virtual/misc/tdx_guest/measurements/.
drivers/attestation/intel/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 +attestation_intel_tdx_guest-y := tdx-guest.o + +obj-$(CONFIG_ATTESTATION_INTEL_TDX_GUEST) += attestation_intel_tdx_guest.o
drivers/attestation/intel/tdx-guest.c renamed from drivers/virt/coco/tdx-guest/tdx-guest.c +2 -2
@@ -403,7 +403,7 @@ static const struct attribute_group *tdx_attr_groups[] = { };static struct miscdevice tdx_misc_dev = { - .name =KBUILD_MODNAME , + .name ="tdx_guest" , .minor =MISC_DYNAMIC_MINOR , .fops = &tdx_guest_fops, .groups = tdx_attr_groups,
@@ -416,7 +416,7 @@ static const struct x86_cpu_id tdx_guest_ids[] = {MODULE_DEVICE_TABLE (x86cpu, tdx_guest_ids);static const struct tsm_report_ops tdx_tsm_ops = { - .name =KBUILD_MODNAME , + .name ="tdx_guest" , .report_new = tdx_report_new, .report_attr_visible = tdx_report_attr_visible, .report_bin_attr_visible = tdx_report_bin_attr_visible,
drivers/virt/coco/Kconfig +0 -2
@@ -9,8 +9,6 @@ source "drivers/virt/coco/efi_secret/Kconfig" source "drivers/virt/coco/pkvm-guest/Kconfig" source "drivers/virt/coco/sev-guest/Kconfig" - -source "drivers/virt/coco/tdx-guest/Kconfig" endif source "drivers/virt/coco/tdx-host/Kconfig"
drivers/virt/coco/Makefile +0 -1
@@ -5,6 +5,5 @@ obj-$(CONFIG_EFI_SECRET) += efi_secret/ obj-$(CONFIG_ARM_PKVM_GUEST) += pkvm-guest/ obj-$(CONFIG_SEV_GUEST) += sev-guest/ -obj-$(CONFIG_INTEL_TDX_GUEST) += tdx-guest/ obj-$(CONFIG_INTEL_TDX_HOST) += tdx-host/ obj-$(CONFIG_TSM) += tsm-core.o
drivers/virt/coco/tdx-guest/Kconfig deleted +0 -11
@@ -1,11 +0,0 @@ -config TDX_GUEST_DRIVER - tristate "TDX Guest driver" - depends on INTEL_TDX_GUEST - depends on ATTESTATION - help - The driver provides userspace interface to communicate with - the TDX module to request the TDX guest details like attestation - report. - - To compile this driver as module, choose M here. The module will - be called tdx-guest.
drivers/virt/coco/tdx-guest/Makefile deleted +0 -2
@@ -1,2 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_TDX_GUEST_DRIVER) += tdx-guest.o
tools/testing/selftests/tdx/config +1 -1
@@ -1 +1 @@ -CONFIG_TDX_GUEST_DRIVER=y +CONFIG_ATTESTATION_INTEL_TDX_GUEST=y
Signature · 1 line
2.43.0
Re: [PATCH tsm 3/4] attestation: Move Intel TDX Guest tsm_report and mr driver
Quoted 95 lines · Jason Gunthorpe
tdx-guest.cis the driver for the Root of Trust inside the TDX module accessed by the guest.The Intel TDX spec supports two token formats and 4 measurement registers.
Move it into
drivers/attestation/intel/tdx-guest.c.Module autoloading continues to be triggered by the
x86_cpu_idmatch mechanism.Signed-off-by Jason Gunthorpe <[email protected]>--- arch/x86/coco/tdx/tdx.c | 8 ++++---- drivers/attestation/Kconfig | 1 + drivers/attestation/Makefile | 1 + drivers/attestation/intel/Kconfig | 13 +++++++++++++ drivers/attestation/intel/Makefile | 4 ++++ .../tdx-guest => attestation/intel}/tdx-guest.c | 4 ++-- drivers/virt/coco/Kconfig | 2 -- drivers/virt/coco/Makefile | 1 - drivers/virt/coco/tdx-guest/Kconfig | 11 ----------- drivers/virt/coco/tdx-guest/Makefile | 2 -- tools/testing/selftests/tdx/config | 2 +- 11 files changed, 26 insertions(+), 23 deletions(-) create mode 100644 drivers/attestation/intel/Kconfig create mode 100644 drivers/attestation/intel/Makefile rename drivers/{virt/coco/tdx-guest => attestation/intel}/tdx-guest.c (99%) delete mode 100644 drivers/virt/coco/tdx-guest/Kconfig delete mode 100644 drivers/virt/coco/tdx-guest/Makefilearch/x86/coco/tdx/tdx.c +4
-4@@ -139,7 +139,7 @@ int tdx_mcall_get_report0(u8 *reportdata, u8 *tdreport)return 0 ; } -EXPORT_SYMBOL_FOR_MODULES (tdx_mcall_get_report0,"tdx-guest" ); +EXPORT_SYMBOL_FOR_MODULES (tdx_mcall_get_report0,"attestation_intel_tdx_guest" );/** * tdx_mcall_extend_rtmr() - Wrapper to extend RTMR registers using @@ -175,7 +175,7 @@ int tdx_mcall_extend_rtmr(u8 index, u8 *data)return 0 ; } -EXPORT_SYMBOL_FOR_MODULES (tdx_mcall_extend_rtmr,"tdx-guest" ); +EXPORT_SYMBOL_FOR_MODULES (tdx_mcall_extend_rtmr,"attestation_intel_tdx_guest" );/** * tdx_hcall_get_quote() - Wrapper to request TD Quote using GetQuote @@ -196,7 +196,7 @@ u64 tdx_hcall_get_quote(void *buf, size_t size)/* Since buf is a shared memory, set the shared (decrypted) bits */ return _tdx_hypercall (TDVMCALL_GET_QUOTE ,cc_mkdec (virt_to_phys (buf)), size,0 ,0 ); } -EXPORT_SYMBOL_FOR_MODULES (tdx_hcall_get_quote,"tdx-guest" ); +EXPORT_SYMBOL_FOR_MODULES (tdx_hcall_get_quote,"attestation_intel_tdx_guest" );/* * Ask the TDX module what the largest Quote on the host platform might be. @@ -213,7 +213,7 @@ int tdx_get_max_quote_size(u64 *max_quote_size)return 0 ; } -EXPORT_SYMBOL_FOR_MODULES (tdx_get_max_quote_size,"tdx-guest" ); +EXPORT_SYMBOL_FOR_MODULES (tdx_get_max_quote_size,"attestation_intel_tdx_guest" );/* * The kernel cannot handle #VEs when accessing normal kernel memory. Ensure drivers/attestation/Kconfig +1
-0@@ -18,4 +18,5 @@ menuconfig ATTESTATION if ATTESTATION source "drivers/attestation/arm/Kconfig" +source "drivers/attestation/intel/Kconfig" endif # ATTESTATIONdrivers/attestation/Makefile +1
-0@@ -5,3 +5,4 @@ attestation-y := \ obj-$(CONFIG_ATTESTATION) += attestation.o obj-$(CONFIG_ATTESTATION_ARM_CCA_GUEST) += arm/ +obj-$(CONFIG_ATTESTATION_INTEL_TDX_GUEST) += intel/drivers/attestation/intel/Kconfig new file +0
-0
drivers/attestation/intel/Kconfig line 8
Quoted 8 lines
drivers/attestation/intel/Kconfig new file +8
-0@@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-2.0-only +config ATTESTATION_INTEL_TDX_GUEST + tristate "Intel TDX Guest Attestation Driver" + depends on INTEL_TDX_GUEST + help + Driver for the TDX guest signed quote from the Root of Trust inside + the TDX module for confidential VMs. The quote includes 4 measurement + registers.
Unlike the RMM and the PSP, the TDX module doesn't sign anything. It produces the TD report, and the TD Quoting Enclave (QE) on the host signs it into a quote, which the guest gets through the GetQuote hypercall. See the Attestation section of Documentation/arch/x86/tdx.rst.
Also looking at tsm_mrs[], it looks to expose 8 measurement registers.
How about something like this?
Driver for TDX guest attestation. The TDX module produces a TD report, and the host's TD Quoting Enclave signs it into a quote through the GetQuote hypercall. The report carries MRTD, RTMR0-RTMR3, MRCONFIGID, MROWNER and MROWNERCONFIG.
DJ> +
Quoted 95 lines
drivers/attestation/intel/Kconfig new file +4
-0+ Reports are available in user-created directories under + /sys/kernel/config/tsm/report/ with provider "tdx_guest". + Measurement registers are exposed under + /sys/devices/virtual/misc/tdx_guest/measurements/.drivers/attestation/intel/Makefile new file +4
-0@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 +attestation_intel_tdx_guest-y := tdx-guest.o + +obj-$(CONFIG_ATTESTATION_INTEL_TDX_GUEST) += attestation_intel_tdx_guest.odrivers/attestation/intel/tdx-guest.c renamed from drivers/virt/coco/tdx-guest/tdx-guest.c +2
-2@@ -403,7 +403,7 @@ static const struct attribute_group *tdx_attr_groups[] = { };static struct miscdevice tdx_misc_dev = { - .name =KBUILD_MODNAME , + .name ="tdx_guest" , .minor =MISC_DYNAMIC_MINOR , .fops = &tdx_guest_fops, .groups = tdx_attr_groups,@@ -416,7 +416,7 @@ static const struct x86_cpu_id tdx_guest_ids[] = {MODULE_DEVICE_TABLE (x86cpu, tdx_guest_ids);static const struct tsm_report_ops tdx_tsm_ops = { - .name =KBUILD_MODNAME , + .name ="tdx_guest" , .report_new = tdx_report_new, .report_attr_visible = tdx_report_attr_visible, .report_bin_attr_visible = tdx_report_bin_attr_visible,drivers/virt/coco/Kconfig +0
-2@@ -9,8 +9,6 @@ source "drivers/virt/coco/efi_secret/Kconfig" source "drivers/virt/coco/pkvm-guest/Kconfig" source "drivers/virt/coco/sev-guest/Kconfig" - -source "drivers/virt/coco/tdx-guest/Kconfig" endif source "drivers/virt/coco/tdx-host/Kconfig"drivers/virt/coco/Makefile +0
-1@@ -5,6 +5,5 @@ obj-$(CONFIG_EFI_SECRET) += efi_secret/ obj-$(CONFIG_ARM_PKVM_GUEST) += pkvm-guest/ obj-$(CONFIG_SEV_GUEST) += sev-guest/ -obj-$(CONFIG_INTEL_TDX_GUEST) += tdx-guest/ obj-$(CONFIG_INTEL_TDX_HOST) += tdx-host/ obj-$(CONFIG_TSM) += tsm-core.odrivers/virt/coco/tdx-guest/Kconfig deleted +0
-11@@ -1,11 +0,0 @@ -config TDX_GUEST_DRIVER - tristate "TDX Guest driver" - depends on INTEL_TDX_GUEST - depends on ATTESTATION - help - The driver provides userspace interface to communicate with - the TDX module to request the TDX guest details like attestation - report. - - To compile this driver as module, choose M here. The module will - be called tdx-guest.drivers/virt/coco/tdx-guest/Makefile deleted +0
-2@@ -1,2 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_TDX_GUEST_DRIVER) += tdx-guest.otools/testing/selftests/tdx/config +1
-1@@ -1 +1 @@ -CONFIG_TDX_GUEST_DRIVER=y +CONFIG_ATTESTATION_INTEL_TDX_GUEST=y
Jason Gunthorpe
maintainerRe: [PATCH tsm 3/4] attestation: Move Intel TDX Guest tsm_report and mr driver
Quoted 6 lines · Dave Jiang
Quoted 6 lines
drivers/attestation/intel/Kconfig new file +6
-0+# SPDX-License-Identifier: GPL-2.0-only +config ATTESTATION_INTEL_TDX_GUEST + tristate "Intel TDX Guest Attestation Driver" + depends on INTEL_TDX_GUEST + help + Driver for the TDX guest signed quote from the Root of Trust inside
Quoted 8 lines
drivers/attestation/intel/Kconfig line 8
Quoted 2 lines
drivers/attestation/intel/Kconfig new file +2
-0+ the TDX module for confidential VMs. The quote includes 4 measurement + registers.Unlike the RMM and the PSP, the TDX module doesn't sign anything. It produces the TD report, and the TD Quoting Enclave (QE) on the host signs it into a quote, which the guest gets through the GetQuote hypercall. See the Attestation section of
Documentation/arch/x86/tdx.rst.
Yeah, but from this perspective these complications are all invisible and hidden in the driver. It doesn't matter that there is the complicated dance, at the end of the day TDX module is fully in control of the data that is signed by the platform. That is no different from any other CC VM ROT.
Quoted 1 line
Also looking at tsm_mrs[], it looks to expose 8 measurement registers.
I was only thinking of the mutable ones as measurement registers, but right, the non-mutable ones are there too. ARM also has non-mutable ones.
Quoted 6 lines
How about something like this?
Driver for TDX guest attestation. The TDX module produces a TD report, and the host's TD Quoting Enclave signs it into a quote through the GetQuote hypercall. The report carries MRTD, RTMR0-RTMR3, MRCONFIGID, MROWNER and MROWNERCONFIG.
Can we simplify the first part: "The TDX module produces evidence signed by the platform" ?
To keep the language in line with the proposed uAPI?
Thanks,
Jason
Re: [PATCH tsm 3/4] attestation: Move Intel TDX Guest tsm_report and mr driver
Quoted 30 lines · Jason Gunthorpe
Quoted 6 lines · Dave Jiang
Quoted 6 lines
drivers/attestation/intel/Kconfig new file +6
-0+# SPDX-License-Identifier: GPL-2.0-only +config ATTESTATION_INTEL_TDX_GUEST + tristate "Intel TDX Guest Attestation Driver" + depends on INTEL_TDX_GUEST + help + Driver for the TDX guest signed quote from the Root of Trust insideQuoted 8 lines
drivers/attestation/intel/Kconfig line 8
Quoted 2 lines
drivers/attestation/intel/Kconfig new file +2
-0+ the TDX module for confidential VMs. The quote includes 4 measurement + registers.Unlike the RMM and the PSP, the TDX module doesn't sign anything. It produces the TD report, and the TD Quoting Enclave (QE) on the host signs it into a quote, which the guest gets through the GetQuote hypercall. See the Attestation section of
Documentation/arch/x86/tdx.rst.Yeah, but from this perspective these complications are all invisible and hidden in the driver. It doesn't matter that there is the complicated dance, at the end of the day TDX module is fully in control of the data that is signed by the platform. That is no different from any other CC VM ROT.
Quoted 1 line
Also looking at tsm_mrs[], it looks to expose 8 measurement registers.
I was only thinking of the mutable ones as measurement registers, but right, the non-mutable ones are there too. ARM also has non-mutable ones.
Quoted 2 lines
How about something like this?
Quoted 7 lines
Quoted 4 lines
Driver for TDX guest attestation. The TDX module produces a TD report, and the host's TD Quoting Enclave signs it into a quote through the GetQuote hypercall. The report carries MRTD, RTMR0-RTMR3, MRCONFIGID, MROWNER and MROWNERCONFIG.
Can we simplify the first part: "The TDX module produces evidence signed by the platform" ?
Yup. Also Rick has pointed out that with the new DICE based scheme it should be same as other vendors. So simplified will do.
DJ
Quoted 5 lines
To keep the language in line with the proposed uAPI?
Thanks,
Jason
Edgecombe, Rick P
maintainerRe: [PATCH tsm 3/4] attestation: Move Intel TDX Guest tsm_report and mr driver
In reply to Dave JiangQuoted 6 lines · Dave Jiang
Quoted 6 lines
drivers/attestation/intel/Kconfig new file +5
-0+config ATTESTATION_INTEL_TDX_GUEST + tristate "Intel TDX Guest Attestation Driver" + depends on INTEL_TDX_GUEST + help + Driver for the TDX guest signed quote from the Root of Trustinside
Quoted 8 lines
drivers/attestation/intel/Kconfig line 8
Quoted 3 lines
(quoted diff) +1
-0+ the TDX module for confidential VMs. The quote includes 4measurement
drivers/attestation/intel/Kconfig new file +1
-0+ registers.Unlike the RMM and the PSP, the TDX module doesn't sign anything. It produces the TD report, and the TD Quoting Enclave (QE) on the host signs it into a quote, which the guest gets through the GetQuote hypercall. See the Attestation section of
Documentation/arch/x86/tdx.rst.
This is changing with DICE based attestation though. The TDX module will do the signing.
Quoted 9 lines
Also looking at tsm_mrs[], it looks to expose 8 measurement registers.
How about something like this?
Driver for TDX guest attestation. The TDX module produces a TD report, and the host's TD Quoting Enclave signs it into a quote through the GetQuote hypercall. The report carries MRTD, RTMR0-RTMR3, MRCONFIGID, MROWNER and MROWNERCONFIG.
Let's make it more generic. Especially since from the guest perspective, it doesn't know what is doing the signing. It is just makes a hypercall to the host which can direct the signing to the location of it's choosing. How about
Driver for the TDX guest signed quote from the Root of Trust of the TDX platform for confidential VMs. The quote includes 4 measurement registers.
Jason Gunthorpe
maintainerRe: [PATCH tsm 3/4] attestation: Move Intel TDX Guest tsm_report and mr driver
Quoted 7 lines · Rick P
Quoted 6 lines
How about something like this?
Driver for TDX guest attestation. The TDX module produces a TD report, and the host's TD Quoting Enclave signs it into a quote through the GetQuote hypercall. The report carries MRTD, RTMR0-RTMR3, MRCONFIGID, MROWNER and MROWNERCONFIG.
Quoted 7 lines
Let's make it more generic. Especially since from the guest perspective, it doesn't know what is doing the signing. It is just makes a hypercall to the host which can direct the signing to the location of it's choosing. How about
Driver for the TDX guest signed quote from the Root of Trust of the TDX platform for confidential VMs. The quote includes 4 measurement registers.
Yeah, that feels about the right level of detail to me. I tweaked it slightly:
config ATTESTATION_INTEL_TDX_GUEST
tristate "Intel TDX Guest Attestation Driver"
depends on INTEL_TDX_GUEST
help
Driver for the TDX guest signed evidence from the Root of Trust of the TDX platform for confidential VMs. The quote includes 4 extendable measurement registers.
Reports are available in user-created directories under /sys/kernel/config/tsm/report/ with provider "tdx_guest". Measurement registers are exposed under /sys/devices/virtual/misc/tdx_guest/measurements/.
Thanks,
Jason
Jason Gunthorpe
maintainerPATCH 4/4 attestation: Move AMD SEV Guest tsm_report driver
In reply to Jason Gunthorpesev-guest.c is the driver for the Root of Trust inside the PSP accessed by confidential VMs.
It supports a direct access path and one that first goes through the Secure VM Service Module (SVSM) running at VM Privilege Level 0 (VMPL0). This allows the SVSM to mix its own data into the challenge, for instance to bind the vTPM's EK. It also supports both a new and an old report format.
Move it into drivers/attestation/amd/sev-guest.c.
Module autoloading still uses the platform_driver created by the arch code.
---
drivers/attestation/Kconfig | 1 +
drivers/attestation/Makefile | 1 +
drivers/attestation/amd/Kconfig | 15 +++++++++++++++
drivers/attestation/amd/Makefile | 4 ++++
.../sev-guest => attestation/amd}/sev-guest.c | 2 +-
drivers/virt/coco/Kconfig | 2 --
drivers/virt/coco/Makefile | 1 -
drivers/virt/coco/sev-guest/Kconfig | 13 -------------
drivers/virt/coco/sev-guest/Makefile | 2 --
9 files changed, 22 insertions(+), 19 deletions(-)
create mode 100644 drivers/attestation/amd/Kconfig
create mode 100644 drivers/attestation/amd/Makefile
rename drivers/{virt/coco/sev-guest => attestation/amd}/sev-guest.c (99%)
delete mode 100644 drivers/virt/coco/sev-guest/Kconfig
delete mode 100644 drivers/virt/coco/sev-guest/Makefiledrivers/attestation/Kconfig +1 -0
@@ -17,6 +17,7 @@ menuconfig ATTESTATION If you are unsure, say N. if ATTESTATION +source "drivers/attestation/amd/Kconfig" source "drivers/attestation/arm/Kconfig" source "drivers/attestation/intel/Kconfig" endif # ATTESTATION
drivers/attestation/Makefile +1 -0
@@ -4,5 +4,6 @@ attestation-y := \ tsm-report.o obj-$(CONFIG_ATTESTATION) += attestation.o +obj-$(CONFIG_ATTESTATION_AMD_SEV_GUEST) += amd/ obj-$(CONFIG_ATTESTATION_ARM_CCA_GUEST) += arm/ obj-$(CONFIG_ATTESTATION_INTEL_TDX_GUEST) += intel/
drivers/attestation/amd/Kconfig new file +15 -0
@@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-only +config ATTESTATION_AMD_SEV_GUEST + tristate "AMD SEV Guest Attestation Driver" + depends on AMD_MEM_ENCRYPT + help + Driver for the SEV-SNP firmware to access the root of trust in the PSP + for confidential VMs. This provides at least two kinds of signed + reports using a GUID scheme to select them. There are no measurement + registers. + + Reports are available in user-created directories under + /sys/kernel/config/tsm/report/ with provider "sev_guest". + + The /dev/sev-guest misc device also provides report and derived-key + ioctls. SVSM service reports and manifests use the TSM interface.
drivers/attestation/amd/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only +attestation_amd_sev_guest-y := sev-guest.o + +obj-$(CONFIG_ATTESTATION_AMD_SEV_GUEST) += attestation_amd_sev_guest.o
drivers/attestation/amd/sev-guest.c renamed from drivers/virt/coco/sev-guest/sev-guest.c +1 -1
@@ -612,7 +612,7 @@ static bool sev_report_bin_attr_visible(int n) }static struct tsm_report_ops sev_tsm_report_ops = { - .name =KBUILD_MODNAME , + .name ="sev_guest" , .report_new = sev_report_new, .report_attr_visible = sev_report_attr_visible, .report_bin_attr_visible = sev_report_bin_attr_visible,
drivers/virt/coco/Kconfig +0 -2
@@ -7,8 +7,6 @@ if VIRT_DRIVERS source "drivers/virt/coco/efi_secret/Kconfig" source "drivers/virt/coco/pkvm-guest/Kconfig" - -source "drivers/virt/coco/sev-guest/Kconfig" endif source "drivers/virt/coco/tdx-host/Kconfig"
drivers/virt/coco/Makefile +0 -1
@@ -4,6 +4,5 @@ # obj-$(CONFIG_EFI_SECRET) += efi_secret/ obj-$(CONFIG_ARM_PKVM_GUEST) += pkvm-guest/ -obj-$(CONFIG_SEV_GUEST) += sev-guest/ obj-$(CONFIG_INTEL_TDX_HOST) += tdx-host/ obj-$(CONFIG_TSM) += tsm-core.o
drivers/virt/coco/sev-guest/Kconfig deleted +0 -13
@@ -1,13 +0,0 @@ -config SEV_GUEST - tristate "AMD SEV Guest driver" - default m - depends on AMD_MEM_ENCRYPT - depends on ATTESTATION - help - SEV-SNP firmware provides the guest a mechanism to communicate with - the PSP without risk from a malicious hypervisor who wishes to read, - alter, drop or replay the messages sent. The driver provides - userspace interface to communicate with the PSP to request the - attestation report and more. - - If you choose 'M' here, this module will be called sev-guest.
drivers/virt/coco/sev-guest/Makefile deleted +0 -2
@@ -1,2 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only -obj-$(CONFIG_SEV_GUEST) += sev-guest.o
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH tsm 4/4] attestation: Move AMD SEV Guest tsm_report driver
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] attestation: sev-guest module rename breaks vmpck_id module parameter ABI - [Low] attestation…
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [Medium] attestation: sev-guest module rename breaks vmpck_id module parameter ABI
- [Low] attestation: CONFIG_ATTESTATION_AMD_SEV_GUEST drops default m from SEV_GUEST
--
commit ca861c491d1af0016726a054ada60dd92452cdc8
Author: Jason Gunthorpe <[email protected]>
attestation: Move AMD SEV Guest tsm_report driver
This commit moves the AMD SEV guest driver from drivers/virt/coco/sev-guest/ to drivers/attestation/amd/ under the new CONFIG_ATTESTATION_AMD_SEV_GUEST option.
drivers/attestation/amd/Kconfig line 4
Quoted 10 lines
drivers/attestation/amd/Kconfig new file +4
-0@@ -0,0 +1,15 @@ +# SPDX-License-Identifier: GPL-2.0-only +config ATTESTATION_AMD_SEV_GUEST + tristate "AMD SEV Guest Attestation Driver" + depends on AMD_MEM_ENCRYPT
[Severity: Low]
Should ATTESTATION_AMD_SEV_GUEST preserve the "default m" that SEV_GUEST had? Without it, existing configs with AMD_MEM_ENCRYPT and ATTESTATION enabled will disable the SEV guest driver by default on olddefconfig.
[ ... ]
drivers/attestation/amd/Makefile line 4
Quoted 10 lines
drivers/attestation/amd/Makefile new file +4
-0@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0-only +attestation_amd_sev_guest-y := sev-guest.o + +obj-$(CONFIG_ATTESTATION_AMD_SEV_GUEST) += attestation_amd_sev_guest.o
[Severity: Medium]
Does renaming the module from sev-guest to attestation_amd_sev_guest break the vmpck_id module parameter and module reloading?
sev-guest.c defines module_param(vmpck_id, int, 0444), and Documentation/virt/coco/sev-guest.rst tells users to recover from a wiped VMPCK by reloading the sev-guest driver with vmpck_id. Changing KBUILD_MODNAME without MODULE_PARAM_PREFIX or MODULE_ALIAS("sev-guest") moves the parameter from sev_guest.vmpck_id and /sys/module/sev_guest/parameters/vmpck_id to attestation_amd_sev_guest.vmpck_id and breaks "modprobe sev-guest".
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
Borislav Petkov
maintainerRe: [PATCH tsm 4/4] attestation: Move AMD SEV Guest tsm_report driver
In reply to Jason GunthorpeQuoted 2 lines · Jason Gunthorpe
sev-guest.cis the driver for the Root of Trust inside the PSP accessed by confidential VMs.
"The driver provides userspace interface to communicate with the PSP to request the attestation report and more."
So "and more" is no more?
Nothing else is going to need this thing and it will get hijacked into attestation/?
I guess that's a question for Tom and Mike...
Signature · 4 lines
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquetteJason Gunthorpe
maintainerRe: [PATCH tsm 4/4] attestation: Move AMD SEV Guest tsm_report driver
Quoted 8 lines · Borislav Petkov
Quoted 2 lines · Jason Gunthorpe
sev-guest.cis the driver for the Root of Trust inside the PSP accessed by confidential VMs."The driver provides userspace interface to communicate with the PSP to request the attestation report and more."
So "and more" is no more?
What do you mean? The weird misc device is still there, but other than the symmetric key derivation it is already all absorbed into tsm_report and should be obsoleted.
Is there some other "and more" I missed?
Jason
Re: [PATCH tsm 4/4] attestation: Move AMD SEV Guest tsm_report driver
Quoted 8 lines · Jason Gunthorpe
Quoted 7 lines · Borislav Petkov
Quoted 2 lines · Jason Gunthorpe
sev-guest.cis the driver for the Root of Trust inside the PSP accessed by confidential VMs."The driver provides userspace interface to communicate with the PSP to request the attestation report and more."
Quoted 7 lines
Quoted 1 line
So "and more" is no more?
What do you mean? The weird misc device is still there, but other than the symmetric key derivation it is already all absorbed into
tsm_reportand should be obsoleted.Is there some other "and more" I missed?
I'm about to submit a patch series to support the new SNP_GET_TPM_INFO guest request, which would be obtained via the SEV guest driver. So, yes, there is more.
Maybe just move the attestation support from the SEV guest driver into the new file and make the SEV guest driver dependent on that code.
Thanks,
Tom
Quoted 3 lines
Jason
Jason Gunthorpe
maintainerRe: [PATCH tsm 4/4] attestation: Move AMD SEV Guest tsm_report driver
Quoted 15 lines · Tom Lendacky
Quoted 14 lines · Jason Gunthorpe
Quoted 8 lines · Borislav Petkov
Quoted 2 lines · Jason Gunthorpe
sev-guest.cis the driver for the Root of Trust inside the PSP accessed by confidential VMs."The driver provides userspace interface to communicate with the PSP to request the attestation report and more."
So "and more" is no more?
What do you mean? The weird misc device is still there, but other than the symmetric key derivation it is already all absorbed into
tsm_reportand should be obsoleted.
Quoted 5 lines
Quoted 1 line
Is there some other "and more" I missed?
I'm about to submit a patch series to support the new
SNP_GET_TPM_INFOguest request, which would be obtained via the SEV guest driver. So, yes, there is more.
From the docs this looks like perfectly fine attestation evidence. It is a blob signed by the ROT after all.
Returning it to userspace should definately flow through attestation subsystem (even tsm_report can do it, I think?) not AMD private ioctls.. It is exactly why we are investing so much to build a common cross-vendor framework that works for everything.
It will eventually work better because your pTPM binding information can just be transparently discovered, picked up by systemd-report and delivered to the verifier, without any userspace hassles.
Quoted 2 lines
Maybe just move the attestation support from the SEV guest driver into the new file and make the SEV guest driver dependent on that code.
There are probably module ordering issues with that kind of split :(
My expecation was the misc device is only used for attestation and ROT related topics. That is what the current state is, is that wrong?
More broadly AMD should not be having its own private misc device with no common APIs with anyone. Dan and Greg both told everyone that same message a long time ago, go build more common APIs.
My expectation, based on what is in there now, that the misc device will eventually be kconfig'd away as a legacy interface since the new interfaces will fully encompass it. The existing AMD implementation of tsm_report is already very close to obsoleting it.
Do you see it differently?
Jason
Re: [PATCH tsm 4/4] attestation: Move AMD SEV Guest tsm_report driver
Quoted 22 lines · Jason Gunthorpe
Quoted 15 lines · Tom Lendacky
Quoted 14 lines · Jason Gunthorpe
Quoted 8 lines · Borislav Petkov
Quoted 2 lines · Jason Gunthorpe
sev-guest.cis the driver for the Root of Trust inside the PSP accessed by confidential VMs."The driver provides userspace interface to communicate with the PSP to request the attestation report and more."
So "and more" is no more?
What do you mean? The weird misc device is still there, but other than the symmetric key derivation it is already all absorbed into
tsm_reportand should be obsoleted.Quoted 5 lines
Quoted 1 line
Is there some other "and more" I missed?
I'm about to submit a patch series to support the new
SNP_GET_TPM_INFOguest request, which would be obtained via the SEV guest driver. So, yes, there is more.
Quoted 7 lines
From the docs this looks like perfectly fine attestation evidence. It is a blob signed by the ROT after all.
Returning it to userspace should definately flow through attestation subsystem (even
tsm_reportcan do it, I think?) not AMD private ioctls.. It is exactly why we are investing so much to build a common cross-vendor framework that works for everything.
So something like /sys/kernel/config/tsm/report/tpmblob? Both outblob and tpmblob take a nonce, so would we want to use the same inblob or a different file?
Or would it be better to be a separate configfs directory, e.g. /sys/kernel/config/tsm/tpm-report, with inblob and outblob for consistency?
Does TDX or CCA having anything similar for a pTPM binding?
Thanks,
Tom
Quoted 26 lines
It will eventually work better because your pTPM binding information can just be transparently discovered, picked up by systemd-report and delivered to the verifier, without any userspace hassles.
Quoted 2 lines
Maybe just move the attestation support from the SEV guest driver into the new file and make the SEV guest driver dependent on that code.
There are probably module ordering issues with that kind of split :(
My expecation was the misc device is only used for attestation and ROT related topics. That is what the current state is, is that wrong?
More broadly AMD should not be having its own private misc device with no common APIs with anyone. Dan and Greg both told everyone that same message a long time ago, go build more common APIs.
My expectation, based on what is in there now, that the misc device will eventually be kconfig'd away as a legacy interface since the new interfaces will fully encompass it. The existing AMD implementation of
tsm_reportis already very close to obsoleting it.Do you see it differently?
Jason
Jason Gunthorpe
maintainerRe: [PATCH tsm 4/4] attestation: Move AMD SEV Guest tsm_report driver
Quoted 26 lines · Tom Lendacky
Quoted 25 lines · Jason Gunthorpe
Quoted 15 lines · Tom Lendacky
Quoted 14 lines · Jason Gunthorpe
Quoted 8 lines · Borislav Petkov
Quoted 2 lines · Jason Gunthorpe
sev-guest.cis the driver for the Root of Trust inside the PSP accessed by confidential VMs."The driver provides userspace interface to communicate with the PSP to request the attestation report and more."
So "and more" is no more?
What do you mean? The weird misc device is still there, but other than the symmetric key derivation it is already all absorbed into
tsm_reportand should be obsoleted.Quoted 5 lines
Quoted 1 line
Is there some other "and more" I missed?
I'm about to submit a patch series to support the new
SNP_GET_TPM_INFOguest request, which would be obtained via the SEV guest driver. So, yes, there is more.From the docs this looks like perfectly fine attestation evidence. It is a blob signed by the ROT after all.
Quoted 8 lines
Quoted 4 lines
Returning it to userspace should definately flow through attestation subsystem (even
tsm_reportcan do it, I think?) not AMD private ioctls.. It is exactly why we are investing so much to build a common cross-vendor framework that works for everything.So something like
/sys/kernel/config/tsm/report/tpmblob? Both outblob and tpmblob take a nonce, so would we want to use the same inblob or a different file?
I would imagine you use one of the mechanisms to change the outblob? It is a signed report so it should go that way as a single request with dedicated inblob sequence to specify the nonce.
eg you could give it a GUID and run it through the GUID mechanism.
With the new uAPI it will be cleaner..
Quoted 4 lines
Or would it be better to be a separate configfs directory, e.g.
/sys/kernel/config/tsm/tpm-report, with inblob and outblob for consistency?Does TDX or CCA having anything similar for a pTPM binding?
I have not seen anyone do pROT binding into VMs yet. I'm aware of conversations but nothing concrete. Usually people are interested in a quote from the pROT, not just a binding. Is that where you are going too?
What is the use case to share the pTPM's EK to the guest without any further interaction to the pTPM?
If you imagine further pTPM interaction then maybe this should be its own guest attestation driver to represent the pTPM.
Jason
Re: [PATCH tsm 4/4] attestation: Move AMD SEV Guest tsm_report driver
Quoted 36 lines · Jason Gunthorpe
Quoted 26 lines · Tom Lendacky
Quoted 25 lines · Jason Gunthorpe
Quoted 15 lines · Tom Lendacky
Quoted 14 lines · Jason Gunthorpe
Quoted 8 lines · Borislav Petkov
Quoted 2 lines · Jason Gunthorpe
sev-guest.cis the driver for the Root of Trust inside the PSP accessed by confidential VMs."The driver provides userspace interface to communicate with the PSP to request the attestation report and more."
So "and more" is no more?
What do you mean? The weird misc device is still there, but other than the symmetric key derivation it is already all absorbed into
tsm_reportand should be obsoleted.Quoted 5 lines
Quoted 1 line
Is there some other "and more" I missed?
I'm about to submit a patch series to support the new
SNP_GET_TPM_INFOguest request, which would be obtained via the SEV guest driver. So, yes, there is more.From the docs this looks like perfectly fine attestation evidence. It is a blob signed by the ROT after all.
Quoted 8 lines
Quoted 4 lines
Returning it to userspace should definately flow through attestation subsystem (even
tsm_reportcan do it, I think?) not AMD private ioctls.. It is exactly why we are investing so much to build a common cross-vendor framework that works for everything.So something like
/sys/kernel/config/tsm/report/tpmblob? Both outblob and tpmblob take a nonce, so would we want to use the same inblob or a different file?
Quoted 5 lines
I would imagine you use one of the mechanisms to change the outblob? It is a signed report so it should go that way as a single request with dedicated inblob sequence to specify the nonce.
eg you could give it a GUID and run it through the GUID mechanism.
Currently the service_provider is used to route between a direct guest request and an SVSM-based guest request, so the same mechanism could be used to add a route for the TPM request.
Quoted 8 lines
With the new uAPI it will be cleaner..
Quoted 4 lines
Or would it be better to be a separate configfs directory, e.g.
/sys/kernel/config/tsm/tpm-report, with inblob and outblob for consistency?Does TDX or CCA having anything similar for a pTPM binding?
Quoted 7 lines
I have not seen anyone do pROT binding into VMs yet. I'm aware of conversations but nothing concrete. Usually people are interested in a quote from the pROT, not just a binding. Is that where you are going too?
What is the use case to share the pTPM's EK to the guest without any further interaction to the pTPM?
My understanding of it is based on section 3.8 of the SNP 1.59 ABI. Given that, having it be part of the current /sys/kernel/config/tsm/report/ seems to make sense.
I can delay my series until this lands to build on the new file location.
Quoted 3 lines
If you imagine further pTPM interaction then maybe this should be its own guest attestation driver to represent the pTPM.
There is nothing further that I'm aware of.
Thanks,
Tom
Quoted 2 lines
Jason
Jason Gunthorpe
maintainerRe: [PATCH tsm 4/4] attestation: Move AMD SEV Guest tsm_report driver
Quoted 5 lines · Tom Lendacky
Quoted 1 line
eg you could give it a GUID and run it through the GUID mechanism.
Currently the
service_provideris used to route between a direct guest request and an SVSM-based guest request, so the same mechanism could be used to add a route for the TPM request.
Yeah that seems like a good thing to try to me.
Quoted 6 lines
Quoted 2 lines
What is the use case to share the pTPM's EK to the guest without any further interaction to the pTPM?
My understanding of it is based on section 3.8 of the SNP 1.59 ABI. Given that, having it be part of the current
/sys/kernel/config/tsm/report/seems to make sense.
That section is pretty clear and is more like what I imagined:
The relying party receives the following objects:
* SEV attestation key certificate chain
* Guest attestation report
* TPM EK certificate chain
* TPM attestation key (AK) blob
* TPM quote
* TPM binding object (TPM_INFO structure. See Table
So tell me where they all come out of the uapi on the guest?
I think it should be
sev-guest attestation driver (this patch)
1: evidence-get(amd-certificates)
2: evidence-get(amd-guest-report)
6: evidence-get(amd-tpm-info)
amd-guest-ptpm attestation driver:
3: evidence-get(tpm ek)
4: evidence-get(tpm ak)
5: evidence-get(tpm signed quote)
This latter one should mirror how the eventual TPM/attestation adaptor will look.
Alternatively you skip #6 as part of the uAPI and instead kernel ensures #3 is authentic internally then userspace trusts it. Most of our guest/host tamper preventions are kept invisible to userspace.
I also think this is perhaps incomplete as a TPM quote without any of the PCR logs is of highly questionable utility.
In any case don't half implement a feature, you need to show how all of this works together, including the host to guest API for items 3-5.
I think you will have a much easier time to build it on top of Jiri's new uapi than trying to squeeze all of this into tsm_report. I'm not that excited about new creative tsm_report users at this point...
And all of section 3.8 is unambiguously attestation related..
Jason
Re: [PATCH tsm 4/4] attestation: Move AMD SEV Guest tsm_report driver
Quoted 35 lines · Jason Gunthorpe
Quoted 5 lines · Tom Lendacky
Quoted 1 line
eg you could give it a GUID and run it through the GUID mechanism.
Currently the
service_provideris used to route between a direct guest request and an SVSM-based guest request, so the same mechanism could be used to add a route for the TPM request.Yeah that seems like a good thing to try to me.
Quoted 6 lines
Quoted 2 lines
What is the use case to share the pTPM's EK to the guest without any further interaction to the pTPM?
My understanding of it is based on section 3.8 of the SNP 1.59 ABI. Given that, having it be part of the current
/sys/kernel/config/tsm/report/seems to make sense.That section is pretty clear and is more like what I imagined:
The relying party receives the following objects:
* SEV attestation key certificate chain
* Guest attestation report
* TPM EK certificate chain
* TPM attestation key (AK) blob
* TPM quote
* TPM binding object (TPM_INFOstructure. See TableSo tell me where they all come out of the uapi on the guest?
I think it should be
sev-guest attestation driver (this patch)
1: evidence-get(amd-certificates)
2: evidence-get(amd-guest-report)
6: evidence-get(amd-tpm-info)
Quoted 4 lines
amd-guest-ptpm attestation driver:
3: evidence-get(tpm ek)
4: evidence-get(tpm ak)
5: evidence-get(tpm signed quote)
3-5 could come from the host/hypervisor, it isn't required to come from the guest since this is a pTPM relationship and not vTPM. This could use existing host methods (which could include PCR logs as you referenced below).
Quoted 3 lines
This latter one should mirror how the eventual TPM/attestation adaptor will look.
Has there been any discussion about how this TPM/attestation adapter will look? What is done today for 3-5?
Thanks,
Tom
Quoted 18 lines
Alternatively you skip #6 as part of the uAPI and instead kernel ensures #3 is authentic internally then userspace trusts it. Most of our guest/host tamper preventions are kept invisible to userspace.
I also think this is perhaps incomplete as a TPM quote without any of the PCR logs is of highly questionable utility.
In any case don't half implement a feature, you need to show how all of this works together, including the host to guest API for items 3-5.
I think you will have a much easier time to build it on top of Jiri's new uapi than trying to squeeze all of this into
tsm_report. I'm not that excited about new creativetsm_reportusers at this point...And all of section 3.8 is unambiguously attestation related..
Jason
Jason Gunthorpe
maintainerRe: [PATCH tsm 4/4] attestation: Move AMD SEV Guest tsm_report driver
Quoted 7 lines · Tom Lendacky
Quoted 7 lines
I think it should be
sev-guest attestation driver (this patch)
1: evidence-get(amd-certificates)
2: evidence-get(amd-guest-report)
6: evidence-get(amd-tpm-info)
Quoted 8 lines
Quoted 4 lines
amd-guest-ptpm attestation driver:
3: evidence-get(tpm ek)
4: evidence-get(tpm ak)
5: evidence-get(tpm signed quote)3-5 could come from the host/hypervisor, it isn't required to come from the guest since this is a pTPM relationship and not vTPM. This could use existing host methods (which could include PCR logs as you referenced below).
It really depends on the workflow you are trying to build.
If the VM has no visibility to the pTPM information then the verifier has to do something to ensure it has an appropriate fresh collection for the hypervisor, it can't just come inband from the VM's collector.
IMHO that would be really hard to use, and has some security wrinkles since it is hard to establish lifecycle binding of the pTPM quote to the actual running VM if the VM itself isn't fetching the quote.
I always imagined the VM would obtain the pTPM's quote as part of its single evidence collection and the verifier could check it in a single pass instead of trying to correlate two collection operations.
Quoted 5 lines
Quoted 2 lines
This latter one should mirror how the eventual TPM/attestation adaptor will look.
Has there been any discussion about how this TPM/attestation adapter will look? What is done today for 3-5?
No, just ideas that it would need to come into existance. It is all standards based and well known so I think we can have confidence in the few items you'd need
Jason
Quoted 24 lines · Tue, Dec 01, 2026 at 01:52:20AM +0100, [email protected] wrote:
Move
tsm_reportandtsm_mr, along with all their drivers, intodrivers/attestation. There are no functional changes, but some modules are renamed to consistent attestation_* names.This largely just moves
drivers/virt/coco/*stuff todrivers/attestationand makes some adjustments to have per-arch subdirectories to hold all the stuff.virt/cocowas OK when this was only going to be used inside confidential VMs, but with the new coming needs for bare metal and host support under the same umbrella it isn't a good place to build an entire subsystem.The attestation subsystem is intended to support drivers for all Roots of Trust (ROTs), both local to the CPU and on-device ROTs accessed through SPDM. A well-known example of a ROT is a Trusted Platform Module, though many different specifications for much simpler ROTs now exist.
The existing drivers are all for the ROTs integrated into confidential VMs. AMD, Intel and ARM each have an attestation ROT linked to their respective implementations.
A following set of drivers, like ARM FIRME, will start to bring in non-TPM ROTs on bare metal systems. The kernel SPDM implementation will also live here and use the upcoming enhanced uAPI.
Quoted 6 lines
Eventually we hope to provide a kernel multiplexer so that in-kernel users, like IMA, can access any attestation measurement register instead of being hardwired to use only the TPM.
Several reorganization and cleanup passes will be needed after this to turn it into a well-formed subsystem.
Looks fine to me overall. Thanks!
set-