attestation: Add a common subsystem and TDX support
Subsystems (4)
v2 cover attestation: Add a common subsystem and TDX support
From: Jiri Pirko <[email protected]>
Linux has several attestation interfaces, each tied to one technology. Extending a measurement takes device-specific flows for TPM, CCA, TDX and SEV, none of them discoverable, and requesting a signed quote takes another set, SPDM included. A new root of trust has no logical home short of squeezing it into tsm_report and tsm_mr: tsm_report covers reports alone, the MRs went to tsm_mr, and SPDM fits neither.
This series adds a common attestation subsystem. Its goal is to support platform, TEE and device roots of trust through one model, including TPM2, TDX, SEV-SNP, Arm CCA, FIRME, Caliptra and PCI/TSM-backed devices, so that a program extends a register or asks for evidence without knowing the hardware behind it. This first series implements the common subsystem and a TDX provider. The native TDX interfaces, /dev/tdx_guest, tsm_report and tsm_mr, stay as they are.
RFC v1 [1] posted this and CTLV as one patchset. For convenience, v2 splits it in two, and this series applies on top of the CTLV series, posted alongside as
[PATCH RFC v2 00/15] ctlv: Add a schema-driven TLV uAPI for character devices
Each attestation device has a node, /dev/attestation/attestationN, that speaks CTLV: a request is checked against the family's schema and executed at once, rather than assembled through several files. The base family, ctlv-attestation, has what every provider shares, so a tool written against it works with any provider. TDX's family, ctlv-attestation-tdx, inherits it and adds no ops. It fills the base family's extension points: device-get's info with the TD's MRCONFIGID, MROWNER and MROWNERCONFIG, and evidence-vendor-format with the two TDX Quote formats.
The base family's ops, as ctlvgen --signatures prints them, with the purpose of each:
# What the device supports, fixed for its life, and its family's fields. device-get() ->
{ caps: { evidence?: { objects[16]: { id, class, formats[4]?,
vendor-formats[4]?, max-length,
challenge-lengths[8]?: { length?,
min-length?,
max-length? } } },
mr?: { flags } }, info: device-info }# Evidence: each object named, written to a blob the caller supplies,
# a signed one made by the call over the challenge.
evidence-get(challenge?, objects[16]: { id, data: out blob }) ->
{ results[16]: { format?, vendor-format?, length }, mr-generation? } # Describe every MR, or the one an ID names.
mr-get(id?) -> { items[]: { id, mr-desc } }
# One MR's values, a digest per bank, and the MR generation they
# reflect.
mr-read(id) -> { mr-generation, mr-values[hash-algo]: mr-value }# Extend banks of one MR by the caller's digests. mr-extend(id, mr-values[hash-algo]: mr-value) -> { mr-generation }
An mr-desc is an MR's name, its banks, what it allows and its register index, and an mr-value one bank's hash algorithm and digest. The userspace ABI gives each op's request, reply, errors and access.
On TDX, evidence-get returns the Quote over a 64-byte challenge, labelled a legacy or a DICE one, and, where ACPI describes it, the CCEL event log. The MRs are MRTD, which cannot be extended, and RTMR0 to RTMR3, all SHA-384. With ctlvctl from the CTLV series and CTLV_SPEC_DIR pointing at Documentation/ctlv/specs, the simulator's output, rewritten for a TD, its lengths left out:
# The device and its family chain.
$ ctlvctl list attestation/attestation0 ctlv/ctlv-attestation/ctlv-attestation-tdx
# What it supports.
$ ctlvctl exec attestation/attestation0 device-get
# device-get, 1 fragment, generation 0
device-get caps
device-get caps.evidence
device-get caps.evidence.objects
device-get caps.evidence.objects.id 0
device-get caps.evidence.objects.class signed
device-get caps.evidence.objects.vendor-formats quote
device-get caps.evidence.objects.vendor-formats quote-dice
device-get caps.evidence.objects.max-length 131048
device-get caps.evidence.objects.challenge-lengths
device-get caps.evidence.objects.challenge-lengths.length 64
device-get caps.evidence.objects
device-get caps.evidence.objects.id 1
device-get caps.evidence.objects.class event-log
device-get caps.evidence.objects.formats ccel
device-get caps.evidence.objects.max-length ...
device-get caps.mr
device-get caps.mr.flags extend
device-get info
device-info.mrconfigid hex:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
device-info.mrowner hex:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
device-info.mrownerconfig hex:000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 # A Quote over a 64-byte nonce, written to quote.bin.
$ nonce=$(openssl rand -hex 64)
$ ctlvctl exec attestation/attestation0 evidence-get --json \
'{"challenge":"hex:'"$nonce"'",
"objects":[{"id":0,"data":{"file":"quote.bin"}}]}'
# evidence-get, 1 fragment, generation 0
mr-generation 0
evidence-get results
evidence-get results.vendor-format quote
evidence-get results.length ...# Every MR.
$ ctlvctl exec attestation/attestation0 mr-get
# mr-get, 1 fragment, generation 0
mr-get items
mr-get items.id 0
mr-desc.name mrtd
mr-desc.supported-hash-algorithms HASH_ALGO_SHA384
mr-desc.caps 0
mr-get items
mr-get items.id 1
mr-desc.name rtmr0
mr-desc.supported-hash-algorithms HASH_ALGO_SHA384
mr-desc.register-index 0
mr-desc.caps extend
...# The value of RTMR0, MR 1.
$ ctlvctl exec attestation/attestation0 mr-read id=1
# mr-read, 1 fragment, generation 0
mr-generation 0
mr-values
mr-value.hash-algo HASH_ALGO_SHA384
mr-value.data hex:b57a300eac0c9b8593bafbadee812f8915456913c28010dab20d700446169bdd56e1af87ce94d66c8fd2d456b3e42826 # Extend RTMR3, MR 4, by a file's SHA-384 digest.
$ digest=$(sha384sum app.img | cut -d' ' -f1)
$ ctlvctl exec attestation/attestation0 mr-extend --json \
'{"id":4,"mr-values":[{"hash-algo":"HASH_ALGO_SHA384",
"data":"hex:'"$digest"'"}]}'
# mr-extend, 1 fragment, generation 0
mr-generation 1This series is the first part. The branch [2] has the whole work, building on it: CTLV's events, the MR journal with IMA as its first user, memfd and dma-buf evidence blobs, an mr-extend that hashes the caller's data, evidence acceptance and device security, a simulation provider, KUnit tests and selftests.
The series adds 3480 lines:
attestation core, C 1340
generated files 770 TDX provider, C 470 docs 462 family specifications 206 ABI snapshots 170
registry, build 62
Changes since RFC v1, each patch listing its own:
- Each evidence object has an ID, a class, signed or event-log, and the formats it may have: from evidence-format for a layout a standard defines, from evidence-vendor-format, whose values the device's family gives, for a vendor's. A signed object lists the challenge lengths it takes.
- evidence-get names objects by ID, may omit the challenge, and takes output blobs of any length, failing with the length one needs.
- TDX labels each Quote, returns the CCEL log, and leaves the TDREPORT to /dev/tdx_guest.
- The MR journal and its notifications are left out, until IMA uses the subsystem.
- mr-extend may extend some of an MR's banks, and every MR can be read.
- mr-get, a query, describes every MR or the one its optional id names, and mr-dump is gone.
- Attestation has its own class and /dev/attestation/ nodes, and the TDX provider is part of tdx-guest instead of a module of its own.
- The specs are written as op trees and records, with a comment on every item, and a userspace ABI document describes the family.
The patches:
1 the base family's specification and generated files 2 the userspace ABI 3-5 the provider and instance core, the MRs, and the CTLV ops 6 how to write a provider 7 tdx-guest's native attestation service, for the provider 8-9 the TDX family's specification and implementation
Note to reviewers: the uAPI, in 1 and 2, and the provider API, in 3 and 6, matter most at this stage.
[1] https://lore.kernel.org/all/[email protected]/
[2] https://github.com/jpirko/linux_mlxsw/commits/wip_attestation_all_2
Jiri Pirko (9):
attestation: Add the base family specification and generated files
Documentation: attestation: Add userspace ABI
attestation: Prepare provider and instance core
attestation: Prepare measurement registers
attestation: Add CTLV operation handling
Documentation: attestation: Describe how to write a provider
tdx-guest: Expose the native attestation service API
attestation: Add the TDX family specification and generated files
attestation: Add the TDX family implementation
.../ctlv/abi/ctlv-attestation-tdx.yaml | 21 +
Documentation/ctlv/abi/ctlv-attestation.yaml | 147 +++++
Documentation/ctlv/abi/families.registry.yaml | 2 +
Documentation/ctlv/families.yaml | 2 +
Documentation/ctlv/generated-files.yaml | 14 +
.../ctlv/specs/ctlv-attestation-tdx.yaml | 25 +
.../ctlv/specs/ctlv-attestation.yaml | 181 +++++++
Documentation/driver-api/attestation.rst | 99 ++++
Documentation/driver-api/index.rst | 1 +
.../userspace-api/attestation-tdx.rst | 59 +++
Documentation/userspace-api/attestation.rst | 294 ++++++++++
Documentation/userspace-api/index.rst | 1 +
Documentation/virt/coco/tdx-guest.rst | 8 +
MAINTAINERS | 13 +
drivers/Kconfig | 2 +
drivers/Makefile | 1 +
drivers/attestation/Kconfig | 16 +
drivers/attestation/Makefile | 5 +
drivers/attestation/core/core.c | 500 ++++++++++++++++++
drivers/attestation/core/ctlv.c | 499 +++++++++++++++++
drivers/attestation/core/internal.h | 34 ++
drivers/attestation/core/mr.c | 64 +++
.../generated/ctlv_attestation_gen.c | 179 +++++++
.../generated/ctlv_attestation_gen.h | 204 +++++++
drivers/virt/coco/tdx-guest/Kconfig | 4 +-
drivers/virt/coco/tdx-guest/Makefile | 6 +
drivers/virt/coco/tdx-guest/attestation.c | 313 +++++++++++
.../coco/tdx-guest/ctlv_attestation_tdx_gen.c | 65 +++
.../coco/tdx-guest/ctlv_attestation_tdx_gen.h | 44 ++
drivers/virt/coco/tdx-guest/internal.h | 48 ++
.../coco/tdx-guest/{tdx-guest.c => main.c} | 137 ++++-
include/linux/attestation.h | 243 +++++++++
include/uapi/ctlv/ctlv_attestation_gen.h | 234 ++++++++
include/uapi/ctlv/ctlv_attestation_tdx_gen.h | 42 ++
include/uapi/ctlv/ctlv_families_gen.h | 2 +
35 files changed, 3480 insertions(+), 29 deletions(-)
create mode 100644 Documentation/ctlv/abi/ctlv-attestation-tdx.yaml
create mode 100644 Documentation/ctlv/abi/ctlv-attestation.yaml
create mode 100644 Documentation/ctlv/specs/ctlv-attestation-tdx.yaml
create mode 100644 Documentation/ctlv/specs/ctlv-attestation.yaml
create mode 100644 Documentation/driver-api/attestation.rst
create mode 100644 Documentation/userspace-api/attestation-tdx.rst
create mode 100644 Documentation/userspace-api/attestation.rst
create mode 100644 drivers/attestation/Kconfig
create mode 100644 drivers/attestation/Makefile
create mode 100644 drivers/attestation/core/core.c
create mode 100644 drivers/attestation/core/ctlv.c
create mode 100644 drivers/attestation/core/internal.h
create mode 100644 drivers/attestation/core/mr.c
create mode 100644 drivers/attestation/generated/ctlv_attestation_gen.c
create mode 100644 drivers/attestation/generated/ctlv_attestation_gen.h
create mode 100644 drivers/virt/coco/tdx-guest/attestation.c
create mode 100644 drivers/virt/coco/tdx-guest/ctlv_attestation_tdx_gen.c
create mode 100644 drivers/virt/coco/tdx-guest/ctlv_attestation_tdx_gen.h
create mode 100644 drivers/virt/coco/tdx-guest/internal.h
rename drivers/virt/coco/tdx-guest/{tdx-guest.c => main.c} (79%)
create mode 100644 include/linux/attestation.h
create mode 100644 include/uapi/ctlv/ctlv_attestation_gen.h
create mode 100644 include/uapi/ctlv/ctlv_attestation_tdx_gen.hSignature · 1 line
2.56.0
RFC PATCH v2 1/9 attestation: Add the base family specification and generated files
From: Jiri Pirko <[email protected]>
Define the base attestation family. Reserve its family ID and add the ABI snapshot, registry entry and generated kernel and UAPI files.
The ABI is intentionally specification-first. The generated descriptor is linked after the provider and operation handlers arrive.
---RFC->RFCv2:
- dropped the MR log ops and the sets, groups and attrs only they use
- dropped the family's priv lifecycle hooks
- made the hash algorithm attrs an enum of <linux/hash_info.h>
- replaced the blob class and representation with an evidence class, signed or event-log
- dropped max-total-output-length
- renamed stubs to extension points
- commented the values, operations and fields
- wrote the spec as op trees and records
- reported each signed object's challenge lengths, in bytes, as a list of up to 8 lengths and ranges
- let evidence-get omit the challenge
- took output blobs of any length
- merged mr-dump into mr-get, a query whose id is an optional filter
- listed an MR's banks in the provider's order, each once
- let mr-extend extend some of an MR's banks
- dropped the MR read caps, as every MR can be read
- numbered every enum member and flag bit
- moved the generated UAPI headers to include/uapi/ctlv/
- documented every item of the spec
- put each field's doc above its generated helpers
- said that every evidence-get produces new evidence
- replaced the format strings with the evidence-format enum and the evidence-vendor-format enum extension point
- named an evidence-get object by its ID
- said message instead of wire
- bounded an MR's banks by hash-algo, not a number
--- Documentation/ctlv/abi/ctlv-attestation.yaml | 147 +++++++++++ Documentation/ctlv/abi/families.registry.yaml | 1 + Documentation/ctlv/families.yaml | 1 + Documentation/ctlv/generated-files.yaml | 7 + .../ctlv/specs/ctlv-attestation.yaml | 181 ++++++++++++++ MAINTAINERS | 9 + .../generated/ctlv_attestation_gen.c | 179 ++++++++++++++ .../generated/ctlv_attestation_gen.h | 204 +++++++++++++++ include/uapi/ctlv/ctlv_attestation_gen.h | 234 ++++++++++++++++++ include/uapi/ctlv/ctlv_families_gen.h | 1 + 10 files changed, 964 insertions(+) create mode 100644 Documentation/ctlv/abi/ctlv-attestation.yaml create mode 100644 Documentation/ctlv/specs/ctlv-attestation.yaml create mode 100644 drivers/attestation/generated/ctlv_attestation_gen.c create mode 100644 drivers/attestation/generated/ctlv_attestation_gen.h create mode 100644 include/uapi/ctlv/ctlv_attestation_gen.h
Documentation/ctlv/abi/ctlv-attestation.yaml new file +147 -0
@@ -0,0 +1,147 @@ +# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) +%YAML 1.2 +--- +# Checked-in ABI snapshot of the ctlv-attestation family, from +# Documentation/ctlv/specs/ctlv-attestation.yaml, written by +# "make -C tools/ctlv regen". +# +# Updating the file is how a UAPI change gets reviewed; an update that +# removes or renumbers anything, narrows a bound, or makes a member required +# is an ABI break, whatever the file says afterwards. +family: {name: ctlv-attestation, id: 1, inherits: ctlv} +enums: + evidence-class: {signed: 1, event-log: 2} + evidence-format: {ccel: 1} + hash-algo: {$header: linux/hash_info.h, $enum: hash_algo, + $end: HASH_ALGO__LAST} +flags: + mr-device-caps: {extend: 0} + mr-caps: {extend: 0} +records: + mr-desc: + id: 0x00010000 + fields: + name: {number: 1, type: string, min-length: 1, max-length: 128} + supported-hash-algorithms: {number: 2, enum: hash-algo, + max-occurrences: hash-algo} + caps: {number: 3, flags: mr-caps} + register-index: {number: 4, type: uint, max: u32-max, optional: true} + mr-value: + id: 0x00020000 + fields: + hash-algo: {number: 1, enum: hash-algo} + data: {number: 2, type: binary, min-length: 16, max-length: 64} + mr-generation: + id: 0x00030000 + fields: + mr-generation: {number: 1, type: uint, max: u32-max} + mr-values: + id: 0x00040000 + fields: + mr-values: {number: 1, record: mr-value, max-occurrences: hash-algo} + device-get request: + id: 0x80010000 + device-get reply: + id: 0xc0010000 + fields: + caps: {number: 1, record: device-get caps} + info: {number: 2, extension: device-info} + device-get caps: + id: 0xc0011000 + fields: + evidence: {number: 1, record: device-get caps.evidence, optional: true} + mr: {number: 2, record: device-get caps.mr, optional: true} + device-get caps.evidence: + id: 0xc0011100 + fields: + objects: {number: 1, record: device-get caps.evidence.objects, + max-occurrences: 16} + device-get caps.evidence.objects: + id: 0xc0011110 + fields: + id: {number: 1, type: uint, max: 15} + class: {number: 2, enum: evidence-class} + formats: {number: 3, enum: evidence-format, max-occurrences: 4, + optional: true} + vendor-formats: {number: 4, enum: evidence-vendor-format, + max-occurrences: 4, optional: true} + max-length: {number: 5, type: uint} + challenge-lengths: + {number: 6, record: device-get caps.evidence.objects.challenge-lengths, + max-occurrences: 8, optional: true} + device-get caps.evidence.objects.challenge-lengths: + id: 0xc0011111 + fields: + length: {number: 1, type: uint, min: 1, max: 4K, unit: bytes, + optional: true} + min-length: {number: 2, type: uint, min: 1, max: 4K, unit: bytes, + optional: true} + max-length: {number: 3, type: uint, min: 1, max: 4K, unit: bytes, + optional: true} + device-get caps.mr: + id: 0xc0011200 + fields: + flags: {number: 1, flags: mr-device-caps} + evidence-get request: + id: 0x80020000 + fields: + challenge: {number: 1, type: binary, min-length: 1, max-length: 4K, + optional: true} + objects: {number: 2, record: evidence-get objects, max-occurrences: 16} + evidence-get objects: + id: 0x80021000 + fields: + id: {number: 1, type: uint, max: 15} + data: {number: 2, blob: output, backings: [va], max-length: u32-max} + evidence-get reply: + id: 0xc0020000 + fields: + results: {number: 1, record: evidence-get results, max-occurrences: 16} + members: ['record mr-generation?'] + evidence-get results: + id: 0xc0021000 + fields: + format: {number: 1, enum: evidence-format, optional: true} + vendor-format: {number: 2, enum: evidence-vendor-format, optional: true} + length: {number: 3, type: uint} + mr-get request: + id: 0x80030000 + fields: + id: {number: 1, type: uint, max: u32-max, optional: true} + mr-get reply: + id: 0xc0030000 + fields: + items: {number: 1, record: mr-get items, max-occurrences: unlimited} + mr-get items: + id: 0xc0031000 + fields: + id: {number: 1, type: uint, max: u32-max} + members: [$include mr-desc] + mr-read request: + id: 0x80040000 + fields: + id: {number: 1, type: uint, max: u32-max} + mr-read reply: + id: 0xc0040000 + members: [record mr-generation, record mr-values] + mr-extend request: + id: 0x80050000 + fields: + id: {number: 1, type: uint, max: u32-max} + members: [record mr-values] + mr-extend reply: + id: 0xc0050000 + members: [record mr-generation] +extensions: {device-info: 1} +enum-extensions: {evidence-vendor-format: 1} +ops: + device-get: {id: 1, type: action, fd-access: read, + request: device-get request, reply: device-get reply} + evidence-get: {id: 2, type: action, availability: dynamic, optional: true, + request: evidence-get request, reply: evidence-get reply} + mr-get: {id: 3, type: query, fd-access: read, optional: true, + request: mr-get request, reply: mr-get reply} + mr-read: {id: 4, type: query, fd-access: read, optional: true, + request: mr-read request, reply: mr-read reply} + mr-extend: {id: 5, type: action, optional: true, request: mr-extend request, + reply: mr-extend reply}
Documentation/ctlv/abi/families.registry.yaml +1 -0
@@ -5,3 +5,4 @@ # Written by "make -C tools/ctlv regen". families: - ctlv + - ctlv-attestation
Documentation/ctlv/families.yaml +1 -0
@@ -15,3 +15,4 @@ families: - ctlv + - ctlv-attestation
Documentation/ctlv/generated-files.yaml +7 -0
@@ -16,3 +16,10 @@ families: kernel-header: include/linux/ctlv_gen.h kernel-source: lib/ctlv/ctlv_gen.c user-source: tools/ctlv/libctlv/ctlv_user_gen.c + + - name: ctlv-attestation + source: Documentation/ctlv/specs/ctlv-attestation.yaml + outputs: + uapi-header: include/uapi/ctlv/ctlv_attestation_gen.h + kernel-header: drivers/attestation/generated/ctlv_attestation_gen.h + kernel-source: drivers/attestation/generated/ctlv_attestation_gen.c
Documentation/ctlv/specs/ctlv-attestation.yaml new file +181 -0
181 lines not on this page · raw message
MAINTAINERS +9 -0
@@ -4433,6 +4433,15 @@ F: rust/kernel/sync/atomic.rs F: rust/kernel/sync/atomic/ F: rust/kernel/sync/refcount.rs +ATTESTATION SUBSYSTEM +M: Jiri Pirko <[email protected]> +L: [email protected] +S: Supported +F: Documentation/ctlv/abi/ctlv-attestation* +F: Documentation/ctlv/specs/ctlv-attestation* +F: drivers/attestation/ +F: include/uapi/ctlv/ctlv_attestation* + ATTO EXPRESSSAS SAS/SATA RAID SCSI DRIVER M: Bradley Grove <[email protected]> L: [email protected]
drivers/attestation/generated/ctlv_attestation_gen.c new file +179 -0
179 lines not on this page · raw message
drivers/attestation/generated/ctlv_attestation_gen.h new file +204 -0
204 lines not on this page · raw message
include/uapi/ctlv/ctlv_attestation_gen.h new file +234 -0
234 lines not on this page · raw message
include/uapi/ctlv/ctlv_families_gen.h +1 -0
@@ -12,6 +12,7 @@enum _ctlv_family {CTLV_FAMILY_ROOT =0 , +CTLV_FAMILY_ATTESTATION =1 , };#endif /* _UAPI_CTLV_CTLV_FAMILIES_GEN_H */
Signature · 1 line
2.56.0
Re: [PATCH RFC v2 1/9] attestation: Add the base family specification and generated files
Quoted 9 lines
[ ... 60 lines skipped ... ]
+++b/Documentation/ctlv/abi/ctlv-attestation.yamlDocumentation/ctlv/abi/ctlv-attestation.yaml new file +6
-0@@ -0,0 +1,147 @@ +# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) +%YAML 1.2 +--- +# Checked-in ABI snapshot of the ctlv-attestation family, from +# Documentation/ctlv/specs/ctlv-attestation.yaml, written by +# "make -C tools/ctlv regen".
Documentation/ctlv/abi/ctlv-attestation.yaml line 16
Quoted 10 lines
Documentation/ctlv/abi/ctlv-attestation.yaml new file +10
-0+# +# Updating the file is how a UAPI change gets reviewed; an update that +# removes or renumbers anything, narrows a bound, or makes a member required +# is an ABI break, whatever the file says afterwards. +family: {name: ctlv-attestation, id: 1, inherits: ctlv} +enums: + evidence-class: {signed: 1, event-log: 2} + evidence-format: {ccel: 1} + hash-algo: {$header: linux/hash_info.h, $enum: hash_algo, + $end: HASH_ALGO__LAST}
I feel like this should parse the C enum into numbers here so the ABI can be checked too?
Quoted 170 lines
Documentation/ctlv/abi/ctlv-attestation.yaml new file +131
-0+flags: + mr-device-caps: {extend: 0} + mr-caps: {extend: 0} +records: + mr-desc: + id: 0x00010000 + fields: + name: {number: 1, type: string, min-length: 1, max-length: 128} + supported-hash-algorithms: {number: 2, enum: hash-algo, + max-occurrences: hash-algo} + caps: {number: 3, flags: mr-caps} + register-index: {number: 4, type: uint, max: u32-max, optional: true} + mr-value: + id: 0x00020000 + fields: + hash-algo: {number: 1, enum: hash-algo} + data: {number: 2, type: binary, min-length: 16, max-length: 64} + mr-generation: + id: 0x00030000 + fields: + mr-generation: {number: 1, type: uint, max: u32-max} + mr-values: + id: 0x00040000 + fields: + mr-values: {number: 1, record: mr-value, max-occurrences: hash-algo} + device-get request: + id: 0x80010000 + device-get reply: + id: 0xc0010000 + fields: + caps: {number: 1, record: device-get caps} + info: {number: 2, extension: device-info} + device-get caps: + id: 0xc0011000 + fields: + evidence: {number: 1, record: device-get caps.evidence, optional: true} + mr: {number: 2, record: device-get caps.mr, optional: true} + device-get caps.evidence: + id: 0xc0011100 + fields: + objects: {number: 1, record: device-get caps.evidence.objects, + max-occurrences: 16} + device-get caps.evidence.objects: + id: 0xc0011110 + fields: + id: {number: 1, type: uint, max: 15} + class: {number: 2, enum: evidence-class} + formats: {number: 3, enum: evidence-format, max-occurrences: 4, + optional: true} + vendor-formats: {number: 4, enum: evidence-vendor-format, + max-occurrences: 4, optional: true} + max-length: {number: 5, type: uint} + challenge-lengths: + {number: 6, record: device-get caps.evidence.objects.challenge-lengths, + max-occurrences: 8, optional: true} + device-get caps.evidence.objects.challenge-lengths: + id: 0xc0011111 + fields: + length: {number: 1, type: uint, min: 1, max: 4K, unit: bytes, + optional: true} + min-length: {number: 2, type: uint, min: 1, max: 4K, unit: bytes, + optional: true} + max-length: {number: 3, type: uint, min: 1, max: 4K, unit: bytes, + optional: true} + device-get caps.mr: + id: 0xc0011200 + fields: + flags: {number: 1, flags: mr-device-caps} + evidence-get request: + id: 0x80020000 + fields: + challenge: {number: 1, type: binary, min-length: 1, max-length: 4K, + optional: true} + objects: {number: 2, record: evidence-get objects, max-occurrences: 16} + evidence-get objects: + id: 0x80021000 + fields: + id: {number: 1, type: uint, max: 15} + data: {number: 2, blob: output, backings: [va], max-length: u32-max} + evidence-get reply: + id: 0xc0020000 + fields: + results: {number: 1, record: evidence-get results, max-occurrences: 16} + members: ['record mr-generation?'] + evidence-get results: + id: 0xc0021000 + fields: + format: {number: 1, enum: evidence-format, optional: true} + vendor-format: {number: 2, enum: evidence-vendor-format, optional: true} + length: {number: 3, type: uint} + mr-get request: + id: 0x80030000 + fields: + id: {number: 1, type: uint, max: u32-max, optional: true} + mr-get reply: + id: 0xc0030000 + fields: + items: {number: 1, record: mr-get items, max-occurrences: unlimited} + mr-get items: + id: 0xc0031000 + fields: + id: {number: 1, type: uint, max: u32-max} + members: [$include mr-desc] + mr-read request: + id: 0x80040000 + fields: + id: {number: 1, type: uint, max: u32-max} + mr-read reply: + id: 0xc0040000 + members: [record mr-generation, record mr-values] + mr-extend request: + id: 0x80050000 + fields: + id: {number: 1, type: uint, max: u32-max} + members: [record mr-values] + mr-extend reply: + id: 0xc0050000 + members: [record mr-generation] +extensions: {device-info: 1} +enum-extensions: {evidence-vendor-format: 1} +ops: + device-get: {id: 1, type: action, fd-access: read, + request: device-get request, reply: device-get reply} + evidence-get: {id: 2, type: action, availability: dynamic, optional: true, + request: evidence-get request, reply: evidence-get reply} + mr-get: {id: 3, type: query, fd-access: read, optional: true, + request: mr-get request, reply: mr-get reply} + mr-read: {id: 4, type: query, fd-access: read, optional: true, + request: mr-read request, reply: mr-read reply} + mr-extend: {id: 5, type: action, optional: true, request: mr-extend request, + reply: mr-extend reply}Documentation/ctlv/abi/families.registry.yaml +1
-0@@ -5,3 +5,4 @@ # Written by "make -C tools/ctlv regen". families: - ctlv + - ctlv-attestationDocumentation/ctlv/families.yaml +1
-0@@ -15,3 +15,4 @@ families: - ctlv + - ctlv-attestationDocumentation/ctlv/generated-files.yaml +7
-0@@ -16,3 +16,10 @@ families: kernel-header: include/linux/ctlv_gen.h kernel-source: lib/ctlv/ctlv_gen.c user-source: tools/ctlv/libctlv/ctlv_user_gen.c + + - name: ctlv-attestation + source: Documentation/ctlv/specs/ctlv-attestation.yaml + outputs: + uapi-header: include/uapi/ctlv/ctlv_attestation_gen.h + kernel-header: drivers/attestation/generated/ctlv_attestation_gen.h + kernel-source: drivers/attestation/generated/ctlv_attestation_gen.cDocumentation/ctlv/specs/ctlv-attestation.yaml new file +0
-0
Documentation/ctlv/specs/ctlv-attestation.yaml line 8
Quoted 8 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +8
-0@@ -0,0 +1,181 @@ +# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) +%YAML 1.2 +--- +# Attestation devices: evidence and measurement registers (MRs). The device's +# family inherits this one, fills device-info and gives evidence-vendor-format +# the formats its vendor defines. +family: ctlv-attestation +inherits: ctlv
This is much easier to read, I think it works well like this!
Quoted 4 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +4
-0+ +enums: + # What an evidence object is. + evidence-class:
Documentation/ctlv/specs/ctlv-attestation.yaml line 22
Quoted 10 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +10
-0+ # Made by evidence-get over its challenge, and signed by the root of + # trust. + - signed + # The platform's log of what firmware and the boot chain measured into + # the MRs. Later extends, through mr-extend or otherwise, are not in it. + - event-log + # A layout of an evidence object that a standard defines. + evidence-format: + # The log area of an ACPI CCEL table, a TCG crypto-agile event log. + - ccel
Lets be in the habit of including a detailed spec reference for things that are standards.
Documentation/ctlv/specs/ctlv-attestation.yaml line 25
Quoted 3 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +3
-0+ # A layout of an evidence object that one vendor defines, given by the + # device's family. + evidence-vendor-format: extension
I find this 'standard' 'vendor' distinction confusing. Is this an artifact of the compilation process?
This would be more usable if there was one enum but both this yaml and the driver yaml can contribute values to it. If we made an 'extendable enum' then the values could be full 64 bit ID numbers with the tree coding so that the extension works the same way as a op and record?
Though I'm a bit nervous about what happens if something in a driver turns into a standard. It would be nice to be able to make the driver's ID promoted to a global ID without changing the ID. That sounds like something the generator could learn to do later I guess.
The comment should be improved to define what consitutes a 'format'. I was advocating that the format should define enough to check the signature and the challenge universally.
Like Peter described the new TDX evidence as "tdx-quote-eat-cwt-1.0".
Poking at the IETF RFCs with AI a bit I think it should be described as "CWT EAT" in this language. The EAT RFC defines the location of the challenge and uses the CWT packaging which defines how the signature is placed.
I think ARM uses this format too, IDK what AMD uses.
The EAT itself should have information inside that describes the "tdx-quote-1.0" idea, so we don't need it externally.
Documentation/ctlv/specs/ctlv-attestation.yaml line 36
Quoted 11 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +11
-0+ # The kernel's hash algorithms. + hash-algo: + $header: linux/hash_info.h + $enum: hash_algo + $end: HASH_ALGO__LAST + +flags: + # What a device offers for its MRs. + mr-device-caps: + # mr-extend is provided. + - extend
I guessed the userspace should learn what operations are supported using introspection directly on the operation? Do we need to specify what ops are implemented in device-get?
Documentation/ctlv/specs/ctlv-attestation.yaml line 48
Quoted 8 lines
[ ... 5 lines skipped ... ]
Documentation/ctlv/specs/ctlv-attestation.yaml new file +7
-0+records: + # One MR, as mr-get describes it. + mr-desc: + # The platform's name for the MR, such as rtmr0. + name: string(1..128) + # Its banks, each once, in the provider's order. + supported-hash-algorithms[hash-algo]: hash-algo
I wonder if it would be wise to put a bit more syntax here:
supported-hash-algorithms[num_entries(hash-algo)]: hash-algo
Just to be clear about exactly what is being extracted from hash_algo.. It is the total number of entries, not the maximum value or something else.
Quoted 29 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +29
-0+ # What it allows. + caps: mr-caps + # The hardware's number for the MR, where it has one: 0 for rtmr0. + register-index?: uint(..u32-max) + + # One bank of an MR. + mr-value: + # The bank's algorithm. + hash-algo: hash-algo + # The digest, as long as hash-algo's. + data: binary(16..64) + + # The device's MR generation, which each extend bumps. + mr-generation: uint(..u32-max) + + # Values for banks of the MR, each bank once. + mr-values[hash-algo]: record mr-value + +ops: + # What the device can do, and its family's fields. + device-get: + type: action + fd-access: read + reply: + # What the device supports, fixed for its life. + caps: + # Present when the device produces evidence. + evidence?: + # One per object evidence-get can produce.
Documentation/ctlv/specs/ctlv-attestation.yaml line 87
Quoted 10 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +10
-0+ objects[16]: + # The device's handle for the object in requests. + id: uint(..15) + # What the object is. + class: evidence-class + # The layouts a standard defines that the object may have. At + # least one of formats and vendor-formats is present. + formats[4]?: evidence-format + # The layouts its vendor defines that the object may have. + vendor-formats[4]?: evidence-vendor-format
How do we want to fit AMD's unique GUID scheme into this?
I'm not sure we should be passing a GUID from userspace to select an opaque blob. If not then the kernel could have the GUID list and report the correct evidence formats as options here?
But then this is maybe a bit limiting because the format is supposed to be the basic envelope, but the AMD version uses almost the same format but they are still different. Though I suppose the difference in the nonce calculation warrants a second format.
And then how does generic userspace even know which one to pick? List them all? Should kernel give some 'default signed evidence' ID ?
So many questions :(
Documentation/ctlv/specs/ctlv-attestation.yaml line 98
Quoted 11 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +11
-0+ # The longest the object gets; a blob this long always holds it. + max-length: uint + # A signed object's challenge lengths: each entry is one length, + # or a range from min-length to max-length. + challenge-lengths[8]?: + # A single length. + length?: uint(1..4K, bytes) + # The shortest of a range. + min-length?: uint(1..4K, bytes) + # The longest of a range. + max-length?: uint(1..4K, bytes)
The comments should be more prescriptive on how userspace has to handle this. I guess if length appears then that length must be used, otherwise within the range described by min/max length
But I wonder if this is worth some additional schema support to define a tagged union?
Quoted 18 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +18
-0+ # Present when the device has MRs. + mr?: + # The MR operations the device provides. + flags: mr-device-caps + # The device's family's fields. + info: extension device-info + + # Evidence objects, written into the caller's blobs. A signed object is made + # by the call, over the challenge, and never reused; the others are read as + # they stand at the call. + evidence-get: + type: action + fd-access: read-write + availability: dynamic + optional: true + request: + # Bound into each signed object named: pass a verifier's nonce, or a hash + # binding one to your context, never data a peer chose. Present exactly
Documentation/ctlv/specs/ctlv-attestation.yaml line 126
Quoted 10 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +10
-0+ # when a signed object is named, and of a length each of them takes. + challenge?: binary(1..4K) + # The objects to produce, each named once. + objects[16]: + # The object, by the ID device-get lists. + id: uint(..15) + # Where the object is written. One too short for it fails the op with + # EMSGSIZE, and error-info's required-length says how long it has to + # be. + data: blob(out, va)
What will this be like when we add memfd later?
Documentation/ctlv/specs/ctlv-attestation.yaml line 138
Quoted 12 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +12
-0+ reply: + # One per object, in request order. + results[16]: + # The layout it came in, where a standard defines it. Exactly one of + # format and vendor-format is present. + format?: evidence-format + # The layout it came in, where its vendor defines it. + vendor-format?: evidence-vendor-format + # The bytes written to its blob. + length: uint + # Present when the evidence depends on the MRs. + mr-generation?: record
Later we will need to add 'tsm controlled challenge' meaning the challenge is an output not an input,
Quoted 20 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +20
-0+ + # The MRs' IDs and descriptions, which do not change; mr-read returns + # values, which change with every extension and are read from the hardware. + mr-get: + type: query + fd-access: read + optional: true + suggested-reply-length: 4K + request: + # Only this MR; every MR without it. + id?: uint(..u32-max) + reply: + # One per MR, ordered by ID. + items[]: + # The device's handle for the MR in requests. + id: uint(..u32-max) + $include: mr-desc + + # One MR's values, and the MR generation they belong to. + mr-read:
Documentation/ctlv/specs/ctlv-attestation.yaml line 168
Quoted 10 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +10
-0+ type: query + fd-access: read + optional: true + suggested-reply-length: 4K + request: + # The MR to read, by the ID mr-get lists. + id: uint(..u32-max) + reply: + mr-generation: record + mr-values: record
Can we leave the generation for a followup with more understanding what it will be used for and how it is computed?
Documentation/ctlv/specs/ctlv-attestation.yaml line 181
Quoted 13 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +13
-0+ + # Extends banks of the MR by digests, as TPM2_PCR_Extend. + mr-extend: + type: action + fd-access: read-write + optional: true + request: + # The MR to extend, by the ID mr-get lists. + id: uint(..u32-max) + # For the banks to extend, each once, in any order. + mr-values: record + reply: + mr-generation: record
The comment should say that mr-values must include exactly every bank inside the MR, not more or less.
If we want to later add something like a log entry as an option this is easy to extend for that, right?
This API eventually needs certificates. I expect that Intel is including the certificates embedded within the EAT returned here as signed evidence. AFAIK ARM does the same
But AMD seems to pass them through 'auxblob' in tsm_report, so there should be a certificates API here to get them. SPDM also has them detached from the evidence.
Signature · 1 line
Jason
Re: [PATCH RFC v2 1/9] attestation: Add the base family specification and generated files
Quoted 14 lines · Fri, Nov 27, 2026 at 01:25:39AM +0100, [email protected] wrote:
Quoted 14 lines
[ ... 60 lines skipped ... ]
+++b/Documentation/ctlv/abi/ctlv-attestation.yamlDocumentation/ctlv/abi/ctlv-attestation.yaml new file +11
-0@@ -0,0 +1,147 @@ +# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) +%YAML 1.2 +--- +# Checked-in ABI snapshot of the ctlv-attestation family, from +# Documentation/ctlv/specs/ctlv-attestation.yaml, written by +# "make -C tools/ctlv regen". +# +# Updating the file is how a UAPI change gets reviewed; an update that +# removes or renumbers anything, narrows a bound, or makes a member required +# is an ABI break, whatever the file says afterwards. +family: {name: ctlv-attestation, id: 1, inherits: ctlv}
Quoted 8 lines
Documentation/ctlv/abi/ctlv-attestation.yaml line 16
Quoted 5 lines
Documentation/ctlv/abi/ctlv-attestation.yaml new file +5
-0+enums: + evidence-class: {signed: 1, event-log: 2} + evidence-format: {ccel: 1} + hash-algo: {$header: linux/hash_info.h, $enum: hash_algo, + $end: HASH_ALGO__LAST}I feel like this should parse the C enum into numbers here so the ABI can be checked too?
Well, note that this only works for uapi/ enums. So those are already part of ABI. I don't think we need to do anything extra here.
Quoted 173 lines
Quoted 173 lines
Documentation/ctlv/abi/ctlv-attestation.yaml new file +131
-0+flags: + mr-device-caps: {extend: 0} + mr-caps: {extend: 0} +records: + mr-desc: + id: 0x00010000 + fields: + name: {number: 1, type: string, min-length: 1, max-length: 128} + supported-hash-algorithms: {number: 2, enum: hash-algo, + max-occurrences: hash-algo} + caps: {number: 3, flags: mr-caps} + register-index: {number: 4, type: uint, max: u32-max, optional: true} + mr-value: + id: 0x00020000 + fields: + hash-algo: {number: 1, enum: hash-algo} + data: {number: 2, type: binary, min-length: 16, max-length: 64} + mr-generation: + id: 0x00030000 + fields: + mr-generation: {number: 1, type: uint, max: u32-max} + mr-values: + id: 0x00040000 + fields: + mr-values: {number: 1, record: mr-value, max-occurrences: hash-algo} + device-get request: + id: 0x80010000 + device-get reply: + id: 0xc0010000 + fields: + caps: {number: 1, record: device-get caps} + info: {number: 2, extension: device-info} + device-get caps: + id: 0xc0011000 + fields: + evidence: {number: 1, record: device-get caps.evidence, optional: true} + mr: {number: 2, record: device-get caps.mr, optional: true} + device-get caps.evidence: + id: 0xc0011100 + fields: + objects: {number: 1, record: device-get caps.evidence.objects, + max-occurrences: 16} + device-get caps.evidence.objects: + id: 0xc0011110 + fields: + id: {number: 1, type: uint, max: 15} + class: {number: 2, enum: evidence-class} + formats: {number: 3, enum: evidence-format, max-occurrences: 4, + optional: true} + vendor-formats: {number: 4, enum: evidence-vendor-format, + max-occurrences: 4, optional: true} + max-length: {number: 5, type: uint} + challenge-lengths: + {number: 6, record: device-get caps.evidence.objects.challenge-lengths, + max-occurrences: 8, optional: true} + device-get caps.evidence.objects.challenge-lengths: + id: 0xc0011111 + fields: + length: {number: 1, type: uint, min: 1, max: 4K, unit: bytes, + optional: true} + min-length: {number: 2, type: uint, min: 1, max: 4K, unit: bytes, + optional: true} + max-length: {number: 3, type: uint, min: 1, max: 4K, unit: bytes, + optional: true} + device-get caps.mr: + id: 0xc0011200 + fields: + flags: {number: 1, flags: mr-device-caps} + evidence-get request: + id: 0x80020000 + fields: + challenge: {number: 1, type: binary, min-length: 1, max-length: 4K, + optional: true} + objects: {number: 2, record: evidence-get objects, max-occurrences: 16} + evidence-get objects: + id: 0x80021000 + fields: + id: {number: 1, type: uint, max: 15} + data: {number: 2, blob: output, backings: [va], max-length: u32-max} + evidence-get reply: + id: 0xc0020000 + fields: + results: {number: 1, record: evidence-get results, max-occurrences: 16} + members: ['record mr-generation?'] + evidence-get results: + id: 0xc0021000 + fields: + format: {number: 1, enum: evidence-format, optional: true} + vendor-format: {number: 2, enum: evidence-vendor-format, optional: true} + length: {number: 3, type: uint} + mr-get request: + id: 0x80030000 + fields: + id: {number: 1, type: uint, max: u32-max, optional: true} + mr-get reply: + id: 0xc0030000 + fields: + items: {number: 1, record: mr-get items, max-occurrences: unlimited} + mr-get items: + id: 0xc0031000 + fields: + id: {number: 1, type: uint, max: u32-max} + members: [$include mr-desc] + mr-read request: + id: 0x80040000 + fields: + id: {number: 1, type: uint, max: u32-max} + mr-read reply: + id: 0xc0040000 + members: [record mr-generation, record mr-values] + mr-extend request: + id: 0x80050000 + fields: + id: {number: 1, type: uint, max: u32-max} + members: [record mr-values] + mr-extend reply: + id: 0xc0050000 + members: [record mr-generation] +extensions: {device-info: 1} +enum-extensions: {evidence-vendor-format: 1} +ops: + device-get: {id: 1, type: action, fd-access: read, + request: device-get request, reply: device-get reply} + evidence-get: {id: 2, type: action, availability: dynamic, optional: true, + request: evidence-get request, reply: evidence-get reply} + mr-get: {id: 3, type: query, fd-access: read, optional: true, + request: mr-get request, reply: mr-get reply} + mr-read: {id: 4, type: query, fd-access: read, optional: true, + request: mr-read request, reply: mr-read reply} + mr-extend: {id: 5, type: action, optional: true, request: mr-extend request, + reply: mr-extend reply}Documentation/ctlv/abi/families.registry.yaml +1
-0@@ -5,3 +5,4 @@ # Written by "make -C tools/ctlv regen". families: - ctlv + - ctlv-attestationDocumentation/ctlv/families.yaml +1
-0@@ -15,3 +15,4 @@ families: - ctlv + - ctlv-attestationDocumentation/ctlv/generated-files.yaml +7
-0@@ -16,3 +16,10 @@ families: kernel-header: include/linux/ctlv_gen.h kernel-source: lib/ctlv/ctlv_gen.c user-source: tools/ctlv/libctlv/ctlv_user_gen.c + + - name: ctlv-attestation + source: Documentation/ctlv/specs/ctlv-attestation.yaml + outputs: + uapi-header: include/uapi/ctlv/ctlv_attestation_gen.h + kernel-header: drivers/attestation/generated/ctlv_attestation_gen.h + kernel-source: drivers/attestation/generated/ctlv_attestation_gen.cDocumentation/ctlv/specs/ctlv-attestation.yaml new file +2
-0@@ -0,0 +1,181 @@ +# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) +%YAML 1.2
Quoted 8 lines
Documentation/ctlv/specs/ctlv-attestation.yaml line 8
Quoted 6 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +6
-0+--- +# Attestation devices: evidence and measurement registers (MRs). The device's +# family inherits this one, fills device-info and gives evidence-vendor-format +# the formats its vendor defines. +family: ctlv-attestation +inherits: ctlvThis is much easier to read, I think it works well like this!
Yeah, pretty happy with it as well. Thanks for the suggestion!
Quoted 10 lines
Quoted 10 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +9
-0+ +enums: + # What an evidence object is. + evidence-class: + # Made by evidence-get over its challenge, and signed by the root of + # trust. + - signed + # The platform's log of what firmware and the boot chain measured into + # the MRs. Later extends, through mr-extend or otherwise, are not in it.
Quoted 8 lines
Documentation/ctlv/specs/ctlv-attestation.yaml line 22
Quoted 5 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +5
-0+ - event-log + # A layout of an evidence object that a standard defines. + evidence-format: + # The log area of an ACPI CCEL table, a TCG crypto-agile event log. + - ccelLets be in the habit of including a detailed spec reference for things that are standards.
Agreed. Will add it.
Quoted 13 lines
Documentation/ctlv/specs/ctlv-attestation.yaml line 25
Quoted 4 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +3
-0+ # A layout of an evidence object that one vendor defines, given by the + # device's family. + evidence-vendor-format: extensionI find this 'standard' 'vendor' distinction confusing. Is this an artifact of the compilation process?
This would be more usable if there was one enum but both this yaml and the driver yaml can contribute values to it. If we made an 'extendable enum' then the values could be full 64 bit ID numbers with the tree coding so that the extension works the same way as a op and record?
Quoted 4 lines
Though I'm a bit nervous about what happens if something in a driver turns into a standard. It would be nice to be able to make the driver's ID promoted to a global ID without changing the ID. That sounds like something the generator could learn to do later I guess.
I see your point. Bit if we have 64bit enum value what included the family id, we still have per-family namespace of enum values. Hard to "promote to global id". We would have to have one range of enum values, some of which would be driver, some global. How exactly you see this happening?
Quoted 12 lines
The comment should be improved to define what consitutes a 'format'. I was advocating that the format should define enough to check the signature and the challenge universally.
Like Peter described the new TDX evidence as "tdx-quote-eat-cwt-1.0".
Poking at the IETF RFCs with AI a bit I think it should be described as "CWT EAT" in this language. The EAT RFC defines the location of the challenge and uses the CWT packaging which defines how the signature is placed.
Quoted 4 lines
I think ARM uses this format too, IDK what AMD uses.
The EAT itself should have information inside that describes the "tdx-quote-1.0" idea, so we don't need it externally.
Perhaps we need 2 attributes, "evidence-packaging" and "evidence-format"? This is a bit unclear to me to be honest.
Quoted 16 lines
Documentation/ctlv/specs/ctlv-attestation.yaml line 36
Quoted 12 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +11
-0+ # The kernel's hash algorithms. + hash-algo: + $header: linux/hash_info.h + $enum: hash_algo + $end: HASH_ALGO__LAST + +flags: + # What a device offers for its MRs. + mr-device-caps: + # mr-extend is provided. + - extendI guessed the userspace should learn what operations are supported using introspection directly on the operation? Do we need to specify what ops are implemented in device-get?
True, will remove this leftover.
Quoted 10 lines
Documentation/ctlv/specs/ctlv-attestation.yaml line 48
Quoted 9 lines
[ ... 5 lines skipped ... ]
Documentation/ctlv/specs/ctlv-attestation.yaml new file +7
-0+records: + # One MR, as mr-get describes it. + mr-desc: + # The platform's name for the MR, such as rtmr0. + name: string(1..128) + # Its banks, each once, in the provider's order. + supported-hash-algorithms[hash-algo]: hash-algo
Quoted 6 lines
I wonder if it would be wise to put a bit more syntax here:
supported-hash-algorithms[num_entries(hash-algo)]: hash-algoJust to be clear about exactly what is being extracted from
hash_algo.. It is the total number of entries, not the maximum value or something else.
I already have this changed in my work tree as:
"supported-hash-algorithms[enum hash-algo]: enum hash-algo". I think it is enough, what do you think?
[...]
Re: [PATCH RFC v2 1/9] attestation: Add the base family specification and generated files
Quoted 17 lines · Jiri Pirko
Quoted 12 lines
Documentation/ctlv/specs/ctlv-attestation.yaml line 25
Quoted 3 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +3
-0+ # A layout of an evidence object that one vendor defines, given by the + # device's family. + evidence-vendor-format: extensionI find this 'standard' 'vendor' distinction confusing. Is this an artifact of the compilation process?
This would be more usable if there was one enum but both this yaml and the driver yaml can contribute values to it. If we made an 'extendable enum' then the values could be full 64 bit ID numbers with the tree coding so that the extension works the same way as a op and record?
Quoted 4 lines
Though I'm a bit nervous about what happens if something in a driver turns into a standard. It would be nice to be able to make the driver's ID promoted to a global ID without changing the ID. That sounds like something the generator could learn to do later I guess.
Quoted 5 lines
I see your point. Bit if we have 64bit enum value what included the family id, we still have per-family namespace of enum values. Hard to "promote to global id". We would have to have one range of enum values, some of which would be driver, some global. How exactly you see this happening?
I would just do the dumb simple thing, if we put something in a driver and realise later it was really global, then have some syntax like
xx:
- new_global = 0x1212342345
Where the hex is the exact value in use by the driver, and the driver continues to have its enum unchanged to hold the value and keep source compatibility.
This would be something used only rarely and to correct mistakes so I view it as OK if it is a bit messy.
Quoted 11 lines
Quoted 11 lines
The comment should be improved to define what consitutes a 'format'. I was advocating that the format should define enough to check the signature and the challenge universally.
Like Peter described the new TDX evidence as "tdx-quote-eat-cwt-1.0".
Poking at the IETF RFCs with AI a bit I think it should be described as "CWT EAT" in this language. The EAT RFC defines the location of the challenge and uses the CWT packaging which defines how the signature is placed.
Quoted 7 lines
Quoted 4 lines
I think ARM uses this format too, IDK what AMD uses.
The EAT itself should have information inside that describes the "tdx-quote-1.0" idea, so we don't need it externally.
Perhaps we need 2 attributes, "evidence-packaging" and "evidence-format"? This is a bit unclear to me to be honest.
I think for now we can just have the packaging, the "CWT EAT". It is supposed to be self describing so userspace should be able to understand what it is after looking inside it.
Quoted 10 lines
Quoted 6 lines
I wonder if it would be wise to put a bit more syntax here:
supported-hash-algorithms[num_entries(hash-algo)]: hash-algoJust to be clear about exactly what is being extracted from
hash_algo.. It is the total number of entries, not the maximum value or something else.I already have this changed in my work tree as:
"supported-hash-algorithms[enum hash-algo]: enum hash-algo". I think it is enough, what do you think?
I still look at it and wonder what value is inside the [], max value or total number? Here we want total number
The enum is certainly helpful though
Jason
Re: [PATCH RFC v2 1/9] attestation: Add the base family specification and generated files
Quoted 24 lines · Mon, Nov 30, 2026 at 09:25:39PM +0100, [email protected] wrote:
Quoted 17 lines · Jiri Pirko
Quoted 12 lines
Documentation/ctlv/specs/ctlv-attestation.yaml line 25
Quoted 3 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +3
-0+ # A layout of an evidence object that one vendor defines, given by the + # device's family. + evidence-vendor-format: extensionI find this 'standard' 'vendor' distinction confusing. Is this an artifact of the compilation process?
This would be more usable if there was one enum but both this yaml and the driver yaml can contribute values to it. If we made an 'extendable enum' then the values could be full 64 bit ID numbers with the tree coding so that the extension works the same way as a op and record?
Quoted 4 lines
Though I'm a bit nervous about what happens if something in a driver turns into a standard. It would be nice to be able to make the driver's ID promoted to a global ID without changing the ID. That sounds like something the generator could learn to do later I guess.
Quoted 5 lines
I see your point. Bit if we have 64bit enum value what included the family id, we still have per-family namespace of enum values. Hard to "promote to global id". We would have to have one range of enum values, some of which would be driver, some global. How exactly you see this happening?
Quoted 5 lines
I would just do the dumb simple thing, if we put something in a driver and realise later it was really global, then have some syntax like
xx:
-new_global=0x1212342345
Ugh, hate this... Will try to figure something else up.
Quoted 24 lines
Where the hex is the exact value in use by the driver, and the driver continues to have its enum unchanged to hold the value and keep source compatibility.
This would be something used only rarely and to correct mistakes so I view it as OK if it is a bit messy.
Quoted 16 lines
Quoted 15 lines
The comment should be improved to define what consitutes a 'format'. I was advocating that the format should define enough to check the signature and the challenge universally.
Like Peter described the new TDX evidence as "tdx-quote-eat-cwt-1.0".
Poking at the IETF RFCs with AI a bit I think it should be described as "CWT EAT" in this language. The EAT RFC defines the location of the challenge and uses the CWT packaging which defines how the signature is placed.
I think ARM uses this format too, IDK what AMD uses.
The EAT itself should have information inside that describes the "tdx-quote-1.0" idea, so we don't need it externally.
Quoted 6 lines
Quoted 2 lines
Perhaps we need 2 attributes, "evidence-packaging" and "evidence-format"? This is a bit unclear to me to be honest.
I think for now we can just have the packaging, the "CWT EAT". It is supposed to be self describing so userspace should be able to understand what it is after looking inside it.
Okay.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
I wonder if it would be wise to put a bit more syntax here:
supported-hash-algorithms[num_entries(hash-algo)]: hash-algoJust to be clear about exactly what is being extracted from
hash_algo.. It is the total number of entries, not the maximum value or something else.
Quoted 8 lines
Quoted 3 lines
I already have this changed in my work tree as:
"supported-hash-algorithms[enum hash-algo]: enum hash-algo". I think it is enough, what do you think?I still look at it and wonder what value is inside the [], max value or total number? Here we want total number
The enum is certainly helpful though
the docs define it as "up to once per value of the enum". So it is the number of values,n ever the highest one.
Re: [PATCH RFC v2 1/9] attestation: Add the base family specification and generated files
Quoted 7 lines · Jiri Pirko
Quoted 5 lines
I would just do the dumb simple thing, if we put something in a driver and realise later it was really global, then have some syntax like
xx:
-new_global=0x1212342345Ugh, hate this... Will try to figure something else up.
I'm thinking this should be pretty rare in practice.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
Quoted 3 lines
Just to be clear about exactly what is being extracted from
hash_algo.. It is the total number of entries, not the maximum value or something else.I already have this changed in my work tree as:
"supported-hash-algorithms[enum hash-algo]: enum hash-algo". I think it is enough, what do you think?
Quoted 7 lines
Quoted 4 lines
I still look at it and wonder what value is inside the [], max value or total number? Here we want total number
The enum is certainly helpful though
the docs define it as "up to once per value of the enum". So it is the number of values,n ever the highest one.
I guess my point is it should be clear enough without having to consult the documentation. IMHO this YAML is not a good place to trade succinctness for readability.
Jason
Re: [PATCH RFC v2 1/9] attestation: Add the base family specification and generated files
Quoted 1 line · Wed, Dec 02, 2026 at 03:28:10PM +0100, [email protected] wrote:
On Wed, Dec 02, 2026 at 03:01:58PM +0100, Jiri Pirko wrote:
[..]
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 7 lines
Quoted 3 lines
Just to be clear about exactly what is being extracted from
hash_algo.. It is the total number of entries, not the maximum value or something else.I already have this changed in my work tree as:
"supported-hash-algorithms[enum hash-algo]: enum hash-algo". I think it is enough, what do you think?I still look at it and wonder what value is inside the [], max value or total number? Here we want total number
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
The enum is certainly helpful though
the docs define it as "up to once per value of the enum". So it is the number of values,n ever the highest one.
I guess my point is it should be clear enough without having to consult the documentation. IMHO this YAML is not a good place to trade succinctness for readability.
Okay, will change this to:
supported-hash-algorithms[num_entries(enum hash-algo)]: hash-algo
Re: [PATCH RFC v2 1/9] attestation: Add the base family specification and generated files
In reply to Jiri PirkoQuoted 81 lines · Jiri Pirko
Quoted 24 lines · Mon, Nov 30, 2026 at 09:25:39PM +0100, [email protected] wrote:
Quoted 17 lines · Jiri Pirko
Quoted 12 lines
Documentation/ctlv/specs/ctlv-attestation.yaml line 25
Quoted 3 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +3
-0+ # A layout of an evidence object that one vendor defines, given by the + # device's family. + evidence-vendor-format: extensionI find this 'standard' 'vendor' distinction confusing. Is this an artifact of the compilation process?
This would be more usable if there was one enum but both this yaml and the driver yaml can contribute values to it. If we made an 'extendable enum' then the values could be full 64 bit ID numbers with the tree coding so that the extension works the same way as a op and record?
Quoted 4 lines
Though I'm a bit nervous about what happens if something in a driver turns into a standard. It would be nice to be able to make the driver's ID promoted to a global ID without changing the ID. That sounds like something the generator could learn to do later I guess.
Quoted 5 lines
I see your point. Bit if we have 64bit enum value what included the family id, we still have per-family namespace of enum values. Hard to "promote to global id". We would have to have one range of enum values, some of which would be driver, some global. How exactly you see this happening?
Quoted 5 lines
I would just do the dumb simple thing, if we put something in a driver and realise later it was really global, then have some syntax like
xx:
-new_global=0x1212342345Ugh, hate this... Will try to figure something else up.
Quoted 24 lines
Where the hex is the exact value in use by the driver, and the driver continues to have its enum unchanged to hold the value and keep source compatibility.
This would be something used only rarely and to correct mistakes so I view it as OK if it is a bit messy.
Quoted 16 lines
Quoted 15 lines
The comment should be improved to define what consitutes a 'format'. I was advocating that the format should define enough to check the signature and the challenge universally.
Like Peter described the new TDX evidence as "tdx-quote-eat-cwt-1.0".
Poking at the IETF RFCs with AI a bit I think it should be described as "CWT EAT" in this language. The EAT RFC defines the location of the challenge and uses the CWT packaging which defines how the signature is placed.
I think ARM uses this format too, IDK what AMD uses.
The EAT itself should have information inside that describes the "tdx-quote-1.0" idea, so we don't need it externally.
Quoted 6 lines
Quoted 2 lines
Perhaps we need 2 attributes, "evidence-packaging" and "evidence-format"? This is a bit unclear to me to be honest.
I think for now we can just have the packaging, the "CWT EAT". It is supposed to be self describing so userspace should be able to understand what it is after looking inside it.
Okay.
Quoted 12 lines
Quoted 11 lines
Quoted 7 lines
I wonder if it would be wise to put a bit more syntax here:
supported-hash-algorithms[num_entries(hash-algo)]: hash-algoJust to be clear about exactly what is being extracted from
hash_algo.. It is the total number of entries, not the maximum value or something else.I already have this changed in my work tree as:
"supported-hash-algorithms[enum hash-algo]: enum hash-algo". I think it is enough, what do you think?
Quoted 7 lines
Quoted 4 lines
I still look at it and wonder what value is inside the [], max value or total number? Here we want total number
The enum is certainly helpful though
the docs define it as "up to once per value of the enum". So it is the number of values,n ever the highest one.
What does provider need to provide dissected into pieces at apples/oranges abstraction level? ;-) Assets could be e.g., machine certificates, event logs (signed probably?), attestation keys, endorsement certificates, encrypted credentials (e.g., TPM2_ActivateCredential).
Unless you got TPM2 covered I could probably write a provider within hours when I sit down and do it (even without AI) as long as I know what it needs to output. It's not a big stretch and then it is easier to review the patch set overall.
Br, Jarkko
Re: [PATCH RFC v2 1/9] attestation: Add the base family specification and generated files
Quoted 5 lines · Jarkko Sakkinen
What does provider need to provide dissected into pieces at apples/oranges abstraction level? ;-) Assets could be e.g., machine certificates, event logs (signed probably?), attestation keys, endorsement certificates, encrypted credentials (e.g.,
TPM2_ActivateCredential).
This is a question we need to answer..
One of my big use cases is that a collection agent like systemd-report can have a hope of working agnostically without knowing details of the ROT.
It should be able to list all the unsigned evidence, dump it with the kernel's labels, pick a signed evidence and use that to sign the entire collected data report it sends to the verifier.
So, check what systemd-report needs to collect to give to a verifier to evaluate a TPM quote and that is a very good starting point.
From there we would want to see some well established cross-ROT topics, like maybe sealing?
For TPM it might be interesting to explore passing the raw TPM commands like tpmrm does in a structured way to give a one stop shop for the interface.
Then locality perhaps, IDK what we need to do there in userspace, but with DRTM we need to be able to use locality 2..
Quoted 4 lines
Unless you got TPM2 covered I could probably write a provider within hours when I sit down and do it (even without AI) as long as I know what it needs to output. It's not a big stretch and then it is easier to review the patch set overall.
Yeah, exactly, it does not seem like a stretch.
At this point I think it is helpful to draft some YAML files that we can look at. The main goal at this moment is to be confident in the uAPI design
I'd like to see a draft YAML for AMD also since it is so complicated
And I'm hoping to work on SPDM today.
Jason
Re: [PATCH RFC v2 1/9] attestation: Add the base family specification and generated files
Quoted 30 lines · Jason Gunthorpe
Quoted 5 lines · Jarkko Sakkinen
What does provider need to provide dissected into pieces at apples/oranges abstraction level? ;-) Assets could be e.g., machine certificates, event logs (signed probably?), attestation keys, endorsement certificates, encrypted credentials (e.g.,
TPM2_ActivateCredential).This is a question we need to answer..
One of my big use cases is that a collection agent like systemd-report can have a hope of working agnostically without knowing details of the ROT.
It should be able to list all the unsigned evidence, dump it with the kernel's labels, pick a signed evidence and use that to sign the entire collected data report it sends to the verifier.
So, check what systemd-report needs to collect to give to a verifier to evaluate a TPM quote and that is a very good starting point.
From there we would want to see some well established cross-ROT topics, like maybe sealing?
For TPM it might be interesting to explore passing the raw TPM commands like tpmrm does in a structured way to give a one stop shop for the interface.
Then locality perhaps, IDK what we need to do there in userspace, but with DRTM we need to be able to use locality 2..
Quoted 6 lines
Quoted 4 lines
Unless you got TPM2 covered I could probably write a provider within hours when I sit down and do it (even without AI) as long as I know what it needs to output. It's not a big stretch and then it is easier to review the patch set overall.
Yeah, exactly, it does not seem like a stretch.
It's not and it is great any device test feature :-)
I'm working ATM with edutech for high schools i.e., Linux laptops, Info displays and the whole shebang, and the plaform is deployed to at least 40% of highschool in Finland, and steadily growing number of schools at different parts of Germany.
I.e. there's lot's of kids in two countries and that makes security a challenge because leaking private information of underaged due ignorance is the one way route for big troubles. It will never happen :-)
Without tech bombing details there's cloud, there's Kerberos realm and other stuff, which is not that far away from Entra's machine auth (Intune). Laptops SB-booted at KEK (not MOK) level and things talk to each other with TPM2 handshakes.
I'm interested on ecosystem fit of this, and leveraging opportunities over in-house ad-hoc code. I'm also interested could Himmelblau IDM leverage this feature, which I can investigate a bit.
It's a project I have one draft PR in progress because I need it for building a bridge to our cloud without having to have in-premises AD
server: https://github.com/himmelblau-idm/himmelblau/pull/1982
Quoted 4 lines
At this point I think it is helpful to draft some YAML files that we can look at. The main goal at this moment is to be confident in the uAPI design
One question.
In TPM2 (old AMD Zen 2 laptop):
$ tpm2sh memory HANDLE CLASS DETAILS 01c00002 nv-index rsa-2048:sha256 01c0000a nv-index ecc-nist-p256:sha256
$ tpm2sh memory 01c0000a | openssl x509 -text -noout | head
Certificate:
Data:
Version: 3 (0x2)
Serial Number: 1298017026 (0x4d5e2b02)
Signature Algorithm: ecdsa-with-SHA256
Issuer: C=DE, O=Infineon Technologies AG, OU=OPTIGA(TM), CN=Infineon OPTIGA(TM) TPM 2.0 ECC CA 042
Validity
Not Before: Sep 16 22:18:38 2020 GMT
Not After : Sep 16 22:18:38 2035 GMT
Subject:Downloading and signing the chain is probably user space activity i.e., a border line for the feature in the user space side, or is this even the right conclusion?
Quoted 2 lines
I'd like to see a draft YAML for AMD also since it is so complicated
AMD Secure Processor's VCEK/VLEK signed attestation, and not fTPM related, right? Again, finding the border line by asking trivial questions ;-)
Quoted 2 lines
And I'm hoping to work on SPDM today.
My stance: don't mind if you don't and don't mind if you do type of situation. E.g., if you want help with the TPM2 provider, I could help and having a real cloud ecosystem to draft architecture on would likely help too.
Quoted 2 lines
Jason
Br, Jarkko
Re: [PATCH RFC v2 1/9] attestation: Add the base family specification and generated files
In reply to Jiri PirkoQuoted 2 lines · Wed, Dec 02, 2026 at 03:01:58PM +0100, [email protected] wrote:
Quoted 1 line · Mon, Nov 30, 2026 at 09:25:39PM +0100, [email protected] wrote:
On Fri, Nov 27, 2026 at 01:54:49PM +0100, Jiri Pirko wrote:
[..]
Quoted 16 lines
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
The comment should be improved to define what consitutes a 'format'. I was advocating that the format should define enough to check the signature and the challenge universally.
Like Peter described the new TDX evidence as "tdx-quote-eat-cwt-1.0".
Poking at the IETF RFCs with AI a bit I think it should be described as "CWT EAT" in this language. The EAT RFC defines the location of the challenge and uses the CWT packaging which defines how the signature is placed.
I think ARM uses this format too, IDK what AMD uses.
The EAT itself should have information inside that describes the "tdx-quote-1.0" idea, so we don't need it externally.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
Perhaps we need 2 attributes, "evidence-packaging" and "evidence-format"? This is a bit unclear to me to be honest.
I think for now we can just have the packaging, the "CWT EAT". It is supposed to be self describing so userspace should be able to understand what it is after looking inside it.
Okay.
Actually, how do you know that quote-dice is "CWT EAT"? I wasn't able to find this anywhere. Could someone from Intel jump in and point me to where this is claimed? Peter?
[..]
Re: [PATCH RFC v2 1/9] attestation: Add the base family specification and generated files
Quoted 29 lines · Jiri Pirko
Quoted 2 lines · Wed, Dec 02, 2026 at 03:01:58PM +0100, [email protected] wrote:
Quoted 1 line · Mon, Nov 30, 2026 at 09:25:39PM +0100, [email protected] wrote:
On Fri, Nov 27, 2026 at 01:54:49PM +0100, Jiri Pirko wrote:
[..]
Quoted 23 lines
Quoted 22 lines
Quoted 11 lines
Quoted 11 lines
The comment should be improved to define what consitutes a 'format'. I was advocating that the format should define enough to check the signature and the challenge universally.
Like Peter described the new TDX evidence as "tdx-quote-eat-cwt-1.0".
Poking at the IETF RFCs with AI a bit I think it should be described as "CWT EAT" in this language. The EAT RFC defines the location of the challenge and uses the CWT packaging which defines how the signature is placed.
Quoted 7 lines
Quoted 4 lines
I think ARM uses this format too, IDK what AMD uses.
The EAT itself should have information inside that describes the "tdx-quote-1.0" idea, so we don't need it externally.
Perhaps we need 2 attributes, "evidence-packaging" and "evidence-format"? This is a bit unclear to me to be honest.
I think for now we can just have the packaging, the "CWT EAT". It is supposed to be self describing so userspace should be able to understand what it is after looking inside it.
Quoted 5 lines
Quoted 1 line
Okay.
Actually, how do you know that quote-dice is "CWT EAT"? I wasn't able to find this anywhere. Could someone from Intel jump in and point me to where this is claimed? Peter?
Hi Jiri,
The public documentation is not out yet. Intel should publish something in the near future. The DICE-based quotes will be in the CWT EAT format, but I think the exact details are still in the works.
Thanks,
Peter
Quoted 1 line
Re: [PATCH RFC v2 1/9] attestation: Add the base family specification and generated files
In reply to Jason GunthorpeFri, Nov 27, 2026 at 01:25:39AM +0100, [email protected] wrote:
[...]
Quoted 28 lines
Quoted 11 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +11
-0+ops: + # What the device can do, and its family's fields. + device-get: + type: action + fd-access: read + reply: + # What the device supports, fixed for its life. + caps: + # Present when the device produces evidence. + evidence?: + # One per object evidence-get can produce.Documentation/ctlv/specs/ctlv-attestation.yaml line 87
Quoted 10 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +10
-0+ objects[16]: + # The device's handle for the object in requests. + id: uint(..15) + # What the object is. + class: evidence-class + # The layouts a standard defines that the object may have. At + # least one of formats and vendor-formats is present. + formats[4]?: evidence-format + # The layouts its vendor defines that the object may have. + vendor-formats[4]?: evidence-vendor-formatHow do we want to fit AMD's unique GUID scheme into this?
I'm not sure we should be passing a GUID from userspace to select an opaque blob. If not then the kernel could have the GUID list and report the correct evidence formats as options here?
Quoted 7 lines
But then this is maybe a bit limiting because the format is supposed to be the basic envelope, but the AMD version uses almost the same format but they are still different. Though I suppose the difference in the nonce calculation warrants a second format.
And then how does generic userspace even know which one to pick? List them all? Should kernel give some 'default signed evidence' ID ?
Nothing in this series takes a GUID. The referenced github all_2 branch does, for now: its evidence-get carries over configfs-tsm's three attributes as optional request fields,
service-provider?: string(1..128)
service-guid?: binary(16)
service-manifest-version?: uint(..u32-max)
all three or none, taken only by a device whose evidence caps have the service flag. That is the GUID from userspace selecting an opaque blob that you doubt. Perhaps we can do this differently:
As I understand the SVSM side, a guest under an SVSM has two reports. The PSP's has the challenge as REPORT_DATA. The SVSM's has SHA-512(challenge || manifest) there, the manifest being either the table of all services or one service's own, which is what the GUID selects. Same structure, different binding, so two formats, as you say.
For a guest under an SVSM that has a vTPM, device-get would list:
id class 0 signed the PSP's report 1 signed the SVSM's report over all services 2 auxiliary the services manifest, which 1 binds 3 signed the SVSM's report over the vTPM 4 auxiliary the vTPM's manifest, its EK public area,
which 3 binds
5 cert-chain the certificate table
each with its format; the last two classes are on the branch, not in this series. The caller names a report and its manifest by ID in one evidence-get. The kernel maps GUIDs to formats and learns which services are there from the services manifest, so no GUID crosses the uAPI and a new service is a line in the kernel's table.
For the default I'd say the objects come in the provider's order of preference, so generic userspace takes the first signed one whose format it knows. Would that do, or do you want it explicit?
Quoted 15 lines
So many questions :(
Documentation/ctlv/specs/ctlv-attestation.yaml line 98
Quoted 11 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +11
-0+ # The longest the object gets; a blob this long always holds it. + max-length: uint + # A signed object's challenge lengths: each entry is one length, + # or a range from min-length to max-length. + challenge-lengths[8]?: + # A single length. + length?: uint(1..4K, bytes) + # The shortest of a range. + min-length?: uint(1..4K, bytes) + # The longest of a range. + max-length?: uint(1..4K, bytes)
Quoted 6 lines
The comments should be more prescriptive on how userspace has to handle this. I guess if length appears then that length must be used, otherwise within the range described by min/max length
But I wonder if this is worth some additional schema support to define a tagged union?
What if we just simply drop length and just have min-length and max-length? Then min-length==max-length is just a special case.
Quoted 30 lines
Quoted 19 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +18
-0+ # Present when the device has MRs. + mr?: + # The MR operations the device provides. + flags: mr-device-caps + # The device's family's fields. + info: extension device-info + + # Evidence objects, written into the caller's blobs. A signed object is made + # by the call, over the challenge, and never reused; the others are read as + # they stand at the call. + evidence-get: + type: action + fd-access: read-write + availability: dynamic + optional: true + request: + # Bound into each signed object named: pass a verifier's nonce, or a hash + # binding one to your context, never data a peer chose. Present exactlyDocumentation/ctlv/specs/ctlv-attestation.yaml line 126
Quoted 10 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +10
-0+ # when a signed object is named, and of a length each of them takes. + challenge?: binary(1..4K) + # The objects to produce, each named once. + objects[16]: + # The object, by the ID device-get lists. + id: uint(..15) + # Where the object is written. One too short for it fails the op with + # EMSGSIZE, and error-info's required-length says how long it has to + # be. + data: blob(out, va)
Quoted 1 line
What will this be like when we add memfd later?
The field lists more backings: blob(out, va memfd dma-buf). It's on github branch all_2.
Quoted 14 lines
Documentation/ctlv/specs/ctlv-attestation.yaml line 138
Quoted 13 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +12
-0+ reply: + # One per object, in request order. + results[16]: + # The layout it came in, where a standard defines it. Exactly one of + # format and vendor-format is present. + format?: evidence-format + # The layout it came in, where its vendor defines it. + vendor-format?: evidence-vendor-format + # The bytes written to its blob. + length: uint + # Present when the evidence depends on the MRs. + mr-generation?: record
Quoted 2 lines
Later we will need to add 'tsm controlled challenge' meaning the challenge is an output not an input,
That fits later without breaking anything: the request's challenge is optional already, a result would carry the challenge the TSM chose, and device-get would say per object which of the two it is.
Quoted 26 lines
Quoted 26 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +25
-0+ + # The MRs' IDs and descriptions, which do not change; mr-read returns + # values, which change with every extension and are read from the hardware. + mr-get: + type: query + fd-access: read + optional: true + suggested-reply-length: 4K + request: + # Only this MR; every MR without it. + id?: uint(..u32-max) + reply: + # One per MR, ordered by ID. + items[]: + # The device's handle for the MR in requests. + id: uint(..u32-max) + $include: mr-desc + + # One MR's values, and the MR generation they belong to. + mr-read: + type: query + fd-access: read + optional: true + suggested-reply-length: 4K + request:
Quoted 8 lines
Documentation/ctlv/specs/ctlv-attestation.yaml line 168
Quoted 5 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +5
-0+ # The MR to read, by the ID mr-get lists. + id: uint(..u32-max) + reply: + mr-generation: record + mr-values: recordCan we leave the generation for a followup with more understanding what it will be used for and how it is computed?
Okay. Will move that to journal follow-up.
Quoted 15 lines
Quoted 4 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +3
-0+ + # Extends banks of the MR by digests, as TPM2_PCR_Extend. + mr-extend:Documentation/ctlv/specs/ctlv-attestation.yaml line 181
Quoted 10 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +10
-0+ type: action + fd-access: read-write + optional: true + request: + # The MR to extend, by the ID mr-get lists. + id: uint(..u32-max) + # For the banks to extend, each once, in any order. + mr-values: record + reply: + mr-generation: record
Quoted 2 lines
The comment should say that mr-values must include exactly every bank inside the MR, not more or less.
A subset is meant. v1 wanted every bank, and review of it brought up DRTM, which may extend only one bank while several are active:
https://lore.kernel.org/all/auOVbGYJjIQTN53z@MjU3Nj/
So a bank that is not named is not extended, as with TPM2_PCR_Extend, and a bank the MR does not have is refused. The comment says neither, I'll fix it.
Quoted 3 lines
If we want to later add something like a log entry as an option this is easy to extend for that, right?
Yes, a request can gain optional fields. The all_2 branch does that:
mr-extend takes the data to hash instead of digests, and what to record in the journal with it.
Quoted 8 lines
This API eventually needs certificates. I expect that Intel is including the certificates embedded within the EAT returned here as signed evidence. AFAIK ARM does the same
But AMD seems to pass them through 'auxblob' in
tsm_report, so there should be a certificates API here to get them. SPDM also has them detached from the evidence.
I'd not add an op for them. An evidence object has a class, and the full branch adds cert-chain beside signed and event-log, so certificates could be listed by device-get and read by evidence-get like the log is.
Thanks for the review!
Re: [PATCH RFC v2 1/9] attestation: Add the base family specification and generated files
Quoted 11 lines · Jiri Pirko
Nothing in this series takes a GUID. The referenced github
all_2branch does, for now: its evidence-get carries over configfs-tsm's three attributes as optional request fields,service-provider?: string(1..128)
service-guid?: binary(16)
service-manifest-version?: uint(..u32-max)all three or none, taken only by a device whose evidence caps have the service flag. That is the GUID from userspace selecting an opaque blob that you doubt. Perhaps we can do this differently:
I would like this mess to either all be in the AMD YAML, probably in a form like this
Or somehow more directly standardized into something actually usable by a generic collector.
Quoted 6 lines
As I understand the SVSM side, a guest under an SVSM has two reports. The PSP's has the challenge as
REPORT_DATA. The SVSM's has SHA-512(challenge || manifest) there, the manifest being either the table of all services or one service's own, which is what the GUID selects. Same structure, different binding, so two formats, as you say.
Yeah, since the nonce calculation changes it fails my proposed test of 'can check the signature' because you can't validate the nonce without knowing about the ||
Quoted 10 lines
For a guest under an SVSM that has a vTPM, device-get would list:
id class 0 signed the PSP's report 1 signed the SVSM's report over all services 2 auxiliary the services manifest, which 1 binds 3 signed the SVSM's report over the vTPM 4 auxiliary the vTPM's manifest, its EK public area,which 3 binds
5 cert-chain the certificate table
OK, it seems reasonable and this gets rid of the GUIDs right? We basically hard wire a couple of the choices into the kernel and offer them as id #?
Quoted 5 lines
each with its format; the last two classes are on the branch, not in this series. The caller names a report and its manifest by ID in one evidence-get. The kernel maps GUIDs to formats and learns which services are there from the services manifest, so no GUID crosses the uAPI and a new service is a line in the kernel's table.
How does userspace understand which ID is which of the three signed evidences? I don't think we should make ID uABI?
Quoted 3 lines
For the default I'd say the objects come in the provider's order of preference, so generic userspace takes the first signed one whose format it knows. Would that do, or do you want it explicit?
That seems OK, as long as we can manage that code wise. The reason I suggested offering a default is so the driver can have some kind of natural order defining all the evidence it supports and not contort itself into a specific ordering to make id 0 something particular.
Quoted 16 lines
Quoted 16 lines
Documentation/ctlv/specs/ctlv-attestation.yaml line 98
Quoted 11 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +11
-0+ # The longest the object gets; a blob this long always holds it. + max-length: uint + # A signed object's challenge lengths: each entry is one length, + # or a range from min-length to max-length. + challenge-lengths[8]?: + # A single length. + length?: uint(1..4K, bytes) + # The shortest of a range. + min-length?: uint(1..4K, bytes) + # The longest of a range. + max-length?: uint(1..4K, bytes)The comments should be more prescriptive on how userspace has to handle this. I guess if length appears then that length must be used, otherwise within the range described by min/max length
Quoted 5 lines
Quoted 2 lines
But I wonder if this is worth some additional schema support to define a tagged union?
What if we just simply drop length and just have min-length and max-length? Then min-length==max-length is just a special case.
Makes sense to me
Quoted 13 lines
Quoted 13 lines
Quoted 12 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +12
-0+ # Extends banks of the MR by digests, as TPM2_PCR_Extend. + mr-extend: + type: action + fd-access: read-write + optional: true + request: + # The MR to extend, by the ID mr-get lists. + id: uint(..u32-max) + # For the banks to extend, each once, in any order. + mr-values: record + reply: + mr-generation: record
Quoted 5 lines
Quoted 2 lines
The comment should say that mr-values must include exactly every bank inside the MR, not more or less.
A subset is meant. v1 wanted every bank, and review of it brought up DRTM, which may extend only one bank while several are active:
That sounds aweful, I suppose the issue is DRTM/IMA may not have the loadable modules for every algorithm till after the initrd starts.
But how does the verifier make any sense of this when there is a gap in the extension? Does the TCG log include the hash algorithms that succeeded?
Quoted 7 lines
Quoted 3 lines
But AMD seems to pass them through 'auxblob' in
tsm_report, so there should be a certificates API here to get them. SPDM also has them detached from the evidence.I'd not add an op for them. An evidence object has a class, and the full branch adds cert-chain beside signed and event-log, so certificates could be listed by device-get and read by evidence-get like the log is.
OK
Jason
Re: [PATCH RFC v2 1/9] attestation: Add the base family specification and generated files
Quoted 13 lines · Mon, Nov 30, 2026 at 09:35:38PM +0100, [email protected] wrote:
Quoted 11 lines · Jiri Pirko
Nothing in this series takes a GUID. The referenced github
all_2branch does, for now: its evidence-get carries over configfs-tsm's three attributes as optional request fields,service-provider?: string(1..128)
service-guid?: binary(16)
service-manifest-version?: uint(..u32-max)all three or none, taken only by a device whose evidence caps have the service flag. That is the GUID from userspace selecting an opaque blob that you doubt. Perhaps we can do this differently:
Quoted 5 lines
I would like this mess to either all be in the AMD YAML, probably in a form like this
Or somehow more directly standardized into something actually usable by a generic collector.
Agreed. With the objects below nothing needs the three fields, so I will take them and the service flag out of the base family. If an SNP provider turns out to need a knob of its own, it goes into its YAML.
Quoted 23 lines
Quoted 7 lines
As I understand the SVSM side, a guest under an SVSM has two reports. The PSP's has the challenge as
REPORT_DATA. The SVSM's has SHA-512(challenge || manifest) there, the manifest being either the table of all services or one service's own, which is what the GUID selects. Same structure, different binding, so two formats, as you say.Yeah, since the nonce calculation changes it fails my proposed test of 'can check the signature' because you can't validate the nonce without knowing about the ||
Quoted 10 lines
For a guest under an SVSM that has a vTPM, device-get would list:
id class 0 signed the PSP's report 1 signed the SVSM's report over all services 2 auxiliary the services manifest, which 1 binds 3 signed the SVSM's report over the vTPM 4 auxiliary the vTPM's manifest, its EK public area,which 3 binds
5 cert-chain the certificate table
Quoted 3 lines
OK, it seems reasonable and this gets rid of the GUIDs right? We basically hard wire a couple of the choices into the kernel and offer them as id #?
Right, no GUID crosses the uAPI. The kernel has a table from service GUID to format, reads the services manifest once to learn which services this SVSM has, and lists an object pair for each one it knows. A service the kernel has not heard of is not listed until it gets a line in that table.
Quoted 9 lines
Quoted 6 lines
each with its format; the last two classes are on the branch, not in this series. The caller names a report and its manifest by ID in one evidence-get. The kernel maps GUIDs to formats and learns which services are there from the services manifest, so no GUID crosses the uAPI and a new service is a line in the kernel's table.
How does userspace understand which ID is which of the three signed evidences? I don't think we should make ID uABI?
The ID is not uABI. It only names an object of this device's listing for the call that collects it, and userspace picks an object by what the listing says of it, never by a number it knows in advance.
You are right that my listing does not say enough, though. The PSP's report differs by format, but the SVSM's two reports have the same class and the same format. I would let a report name the object it binds:
id class format binds 0 signed snp-report 1 signed snp-svsm-report 2 2 auxiliary svsm-services-manifest 3 signed snp-svsm-report 4 4 auxiliary tpm-ek-public 5 cert-chain snp-cert-table
The format names are placeholders. The manifest's format then says which service a report is for, and userspace also learns which two objects it has to ask for together. Userspace that wants the vTPM's report looks for the signed object that binds a tpm-ek-public one.
Quoted 9 lines
Quoted 4 lines
For the default I'd say the objects come in the provider's order of preference, so generic userspace takes the first signed one whose format it knows. Would that do, or do you want it explicit?
That seems OK, as long as we can manage that code wise. The reason I suggested offering a default is so the driver can have some kind of natural order defining all the evidence it supports and not contort itself into a specific ordering to make id 0 something particular.
Code wise it is the order of the provider's object table, nothing more. The rule is "the first signed object whose format you know", not "ID 0", so a provider only has to put its signed objects in order of preference among themselves and is free with the rest. If some provider cannot live with that, a flag on one object can be added then. But is it needed?
Quoted 17 lines
Quoted 17 lines
Quoted 17 lines
Documentation/ctlv/specs/ctlv-attestation.yaml line 98
Quoted 12 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +11
-0+ # The longest the object gets; a blob this long always holds it. + max-length: uint + # A signed object's challenge lengths: each entry is one length, + # or a range from min-length to max-length. + challenge-lengths[8]?: + # A single length. + length?: uint(1..4K, bytes) + # The shortest of a range. + min-length?: uint(1..4K, bytes) + # The longest of a range. + max-length?: uint(1..4K, bytes)The comments should be more prescriptive on how userspace has to handle this. I guess if length appears then that length must be used, otherwise within the range described by min/max length
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
But I wonder if this is worth some additional schema support to define a tagged union?
What if we just simply drop length and just have min-length and max-length? Then min-length==max-length is just a special case.
Makes sense to me
Ok
Quoted 20 lines
Quoted 14 lines
Quoted 14 lines
Quoted 13 lines
Documentation/ctlv/specs/ctlv-attestation.yaml new file +12
-0+ # Extends banks of the MR by digests, as TPM2_PCR_Extend. + mr-extend: + type: action + fd-access: read-write + optional: true + request: + # The MR to extend, by the ID mr-get lists. + id: uint(..u32-max) + # For the banks to extend, each once, in any order. + mr-values: record + reply: + mr-generation: recordQuoted 5 lines
Quoted 2 lines
The comment should say that mr-values must include exactly every bank inside the MR, not more or less.
A subset is meant. v1 wanted every bank, and review of it brought up DRTM, which may extend only one bank while several are active:
Quoted 6 lines
That sounds aweful, I suppose the issue is DRTM/IMA may not have the loadable modules for every algorithm till after the initrd starts.
But how does the verifier make any sense of this when there is a gap in the extension? Does the TCG log include the hash algorithms that succeeded?
The verifier replays each bank on its own. An extend entry of the journal carries the digests of exactly the banks it extended, so a bank's replay takes the entries that name it and skips the others. A bank that was left out of an extension therefore has no gap in its own sequence, it just has fewer entries than another bank.
Sergii, feel free to jump in here as this was your suggestion. Thanks!
Quoted 12 lines
Quoted 8 lines
Quoted 4 lines
But AMD seems to pass them through 'auxblob' in
tsm_report, so there should be a certificates API here to get them. SPDM also has them detached from the evidence.I'd not add an op for them. An evidence object has a class, and the full branch adds cert-chain beside signed and event-log, so certificates could be listed by device-get and read by evidence-get like the log is.
OK
Jason
Re: [PATCH RFC v2 1/9] attestation: Add the base family specification and generated files
Quoted 5 lines · Jiri Pirko
You are right that my listing does not say enough, though. The PSP's report differs by format, but the SVSM's two reports have the same class and the same format. I would let a report name the object it binds:
Quoted 7 lines
id class format binds 0 signed snp-report 1 signed snp-svsm-report 2 2 auxiliary svsm-services-manifest 3 signed snp-svsm-report 4 4 auxiliary tpm-ek-public 5 cert-chain snp-cert-table
Did we gain class recently?
If the tpm-ek isn't signed I wonder why it should come out here?
Quoted 11 lines
Quoted 4 lines
That seems OK, as long as we can manage that code wise. The reason I suggested offering a default is so the driver can have some kind of natural order defining all the evidence it supports and not contort itself into a specific ordering to make id 0 something particular.
Code wise it is the order of the provider's object table, nothing more. The rule is "the first signed object whose format you know", not "ID 0", so a provider only has to put its signed objects in order of preference among themselves and is free with the rest. If some provider cannot live with that, a flag on one object can be added then. But is it needed?
I'm worried things like AMD want the snp-report to be the default unless snp-svsm-report is available. That isn't quite so easy to express in a static const array..
Quoted 7 lines
Quoted 6 lines
That sounds aweful, I suppose the issue is DRTM/IMA may not have the loadable modules for every algorithm till after the initrd starts.
But how does the verifier make any sense of this when there is a gap in the extension? Does the TCG log include the hash algorithms that succeeded?
Quoted 7 lines
The verifier replays each bank on its own. An extend entry of the journal carries the digests of exactly the banks it extended, so a bank's replay takes the entries that name it and skips the others. A bank that was left out of an extension therefore has no gap in its own sequence, it just has fewer entries than another bank.
Sergii, feel free to jump in here as this was your suggestion. Thanks!
DRTM would be using the kernel interface so it is a bit different
But OK, just make the comment clear.
Jason
Re: [PATCH RFC v2 1/9] attestation: Add the base family specification and generated files
Quoted 14 lines · Wed, Dec 02, 2026 at 04:08:02PM +0100, [email protected] wrote:
Quoted 5 lines · Jiri Pirko
You are right that my listing does not say enough, though. The PSP's report differs by format, but the SVSM's two reports have the same class and the same format. I would let a report name the object it binds:
Quoted 7 lines
id class format binds 0 signed snp-report 1 signed snp-svsm-report 2 2 auxiliary svsm-services-manifest 3 signed snp-svsm-report 4 4 auxiliary tpm-ek-public 5 cert-chain snp-cert-table
Quoted 1 line
Did we gain class recently?
It is in this RFC v2:
evidence-class:
# Made by evidence-get over its challenge, and signed by the root of # trust.
- signed
# The platform's log of what firmware and the boot chain measured into # the MRs. Later extends, through mr-extend or otherwise, are not in it.
- event-log
Quoted 2 lines
If the tpm-ek isn't signed I wonder why it should come out here?
It is what the report signs, one step removed. REPORT_DATA of the SVSM's report is SHA-512(challenge || manifest), and for the vTPM service the manifest is the EK's public area. The verifier cannot recompute REPORT_DATA without those bytes, so the report does not verify without them. They are also the point of that report: it tells the verifier which EK the attested SVSM stands behind. configfs-tsm hands them out as manifestblob for the same reason.
So it is unsigned evidence that one signed object covers, and "binds" says which one. tpm-ek-public was a poor placeholder, it is the vTPM service's manifest.
Quoted 13 lines
Quoted 6 lines
Quoted 5 lines
That seems OK, as long as we can manage that code wise. The reason I suggested offering a default is so the driver can have some kind of natural order defining all the evidence it supports and not contort itself into a specific ordering to make id 0 something particular.
Quoted 6 lines
Code wise it is the order of the provider's object table, nothing more. The rule is "the first signed object whose format you know", not "ID 0", so a provider only has to put its signed objects in order of preference among themselves and is free with the rest. If some provider cannot live with that, a flag on one object can be added then. But is it needed?
Quoted 3 lines
I'm worried things like AMD want the snp-report to be the default unless snp-svsm-report is available. That isn't quite so easy to express in a static const array..
It is not a static array any more in my working branch. Now a provider adds each object by a call before it registers the device:
attestation_evidence_object_add(att, &props, &ops, priv);
and the order of the calls is the order of the listing. The SNP provider probes for the SVSM first and adds the reports in the order that fits what it found..
Quoted 14 lines
Quoted 14 lines
Quoted 7 lines
That sounds aweful, I suppose the issue is DRTM/IMA may not have the loadable modules for every algorithm till after the initrd starts.
But how does the verifier make any sense of this when there is a gap in the extension? Does the TCG log include the hash algorithms that succeeded?
The verifier replays each bank on its own. An extend entry of the journal carries the digests of exactly the banks it extended, so a bank's replay takes the entries that name it and skips the others. A bank that was left out of an extension therefore has no gap in its own sequence, it just has fewer entries than another bank.
Quoted 5 lines
Quoted 1 line
Sergii, feel free to jump in here as this was your suggestion. Thanks!
DRTM would be using the kernel interface so it is a bit different
But OK, just make the comment clear.
Done.
Thanks!
Quoted 2 lines
Jason
RFC PATCH v2 2/9 Documentation: attestation: Add userspace ABI
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
Describe the attestation family for userspace: its operations and their errors, the evidence objects and the measurement registers.
--- Documentation/userspace-api/attestation.rst | 283 ++++++++++++++++++++ Documentation/userspace-api/index.rst | 1 + MAINTAINERS | 1 + 3 files changed, 285 insertions(+) create mode 100644 Documentation/userspace-api/attestation.rst
Documentation/userspace-api/attestation.rst new file +283 -0
@@ -0,0 +1,283 @@ +.. SPDX-License-Identifier: GPL-2.0 + +========================= +Attestation userspace ABI +========================= + +A confidential guest proves what it runs to a remote verifier with evidence: a +statement of its measurements, signed by its root of trust and carrying a +challenge the verifier chose, and the logs behind those measurements. An +attestation provider gives its device a node, ``/dev/attestation/attestationN``. +Through it a program asks for evidence, and reads and extends the measurement +registers (MRs) the evidence reports. + +The node speaks CTLV, described in :doc:`ctlv`, as a descendant of the +``ctlv-attestation`` family, one family per provider. Every operation below +belongs to ``ctlv-attestation``, so a tool written against it works with any +provider. The specification is +``Documentation/ctlv/specs/ctlv-attestation.yaml`` and the constants are in +``include/uapi/ctlv/ctlv_attestation_gen.h``. + +====================== ====== ========== ================================ +Operation Type Access Purpose +====================== ====== ========== ================================ +device-get action read what the device supports +evidence-get action read-write evidence objects +mr-get query read describe the MRs +mr-read query read one MR's values +mr-extend action read-write extend one MR +====================== ====== ========== ================================ + +``device-get`` is always provided. Every other operation is optional, and a +device provides those its provider implements, which ``op-get`` lists. The +errors below are the family's own. Those of the transport, such as ``EACCES`` +for a descriptor without the access an operation needs, are in :doc:`ctlv`, +and once a device is gone or has stopped, every operation fails with +``ENODEV``. A provider's own failure returns its errno, such as ``EIO``. + +Generations +=========== + +A counter tells a program whether what it holds is still current. It is 32 +bits wide. An operation that would advance it past its maximum fails with +``EOVERFLOW`` and stops the device. + +``mr-generation`` + The state of the MRs. It advances with every extension, and a reply that + depends on MR state carries the generation it reflects. + +Evidence +======== + +``device-get`` +-------------- + +Describes the device: what it supports and the provider's own information. It +takes no request. The reply carries: + +``caps`` + A record for each part the device has: + + ``caps.evidence`` + With ``evidence-get``: one of ``objects`` for each object the device + produces, up to 16, as `Objects`_ describes. + + ``caps.mr`` + With MRs: ``flags``, which has ``extend`` where ``mr-extend`` is + provided. ``mr-read`` is always provided with MRs. + +``info`` + The device's family's fields, its ``device-info``. + +``evidence-get`` +---------------- + +Writes each object the request names into a blob the caller supplies. A +signed object is made by the call, over the challenge, and never reused. The +others, such as an event log, are read as they stand at the call. One call so +returns signed evidence with the log needed to check it. The request carries: + +``challenge`` + The challenge, described below. Present exactly when a signed object is + named. + +``objects`` + 1 to 16 objects, each naming one of the ``caps.evidence.objects`` of + ``device-get`` by its ``id`` and giving ``data``, the output blob it is + written to, sized as described below. + +The reply carries: + +``results`` + One per object, in request order, each giving the object's format in + exactly one of ``format`` and ``vendor-format``, and its ``length``, the + bytes written to its blob. + +``mr-generation`` + Where an object binds MRs, the MR generation the evidence reflects. + +``EINVAL`` + A signed object is named without a challenge, a challenge is given + without one, or its length is one a signed object named does not take. + Two objects are the same. + +``EMSGSIZE`` + An object's blob is too short for it. The error information's + ``required-length`` says how long it has to be. + +``ENOENT`` + An object's ``id`` is not one ``device-get`` lists. + +``EPROTO`` + The root of trust returned an object in a format the device does not + list for it. + +Access is read-write. Availability is dynamic: a device may switch the +operation off for a time, and meanwhile it fails with ``EOPNOTSUPP``. + +The challenge +~~~~~~~~~~~~~ + +A signed object binds the challenge. Each signed object lists its +``challenge-lengths``, up to 8, each one ``length`` or a range from +``min-length`` to ``max-length``, and the subsystem keeps them within 1 to 4K. +The challenge has to be of a length every signed object named lists. + +Pass a nonce from the verifier, or a hash that binds such a nonce to the +caller's own context, such as a key the evidence is to vouch for. Never pass +data a peer chose. Any process that can run ``evidence-get`` can have the +device sign what it passes, and one that passes a peer's bytes makes the +device a signing oracle for that peer. + +Objects +~~~~~~~ + +Each of ``caps.evidence.objects`` describes one object: + +``id`` + 0 to 15, which a request names it by. + +``class`` + What the object is, as ``evidence-class`` below says. + +``formats`` and ``vendor-formats`` + The formats it may have. + +``max-length`` + The longest it gets, however many objects a call asks for. + +``challenge-lengths`` + For a signed object, the challenge lengths it takes. + +``evidence-class`` says what an object is: + +``signed`` + Evidence the root of trust signs over the challenge. It carries its own + signature. + +``event-log`` + The platform's log of what firmware and the boot chain measured into the + MRs, for a verifier to replay. Later extends, through ``mr-extend`` or + otherwise, are not in it. + +A blob of the object's ``max-length`` always holds it. A shorter one saves +memory where objects run shorter than their bound, as certificate chains do: +where the object does not fit, ``evidence-get`` fails with ``EMSGSIZE`` and +returns no evidence, and ``required-length`` in the error information is the +length to retry with. The retry collects the evidence anew, and may pass the +same challenge. + +Two enums name the formats: + +``evidence-format`` + ``ctlv-attestation``'s, for a layout a standard defines, such as the + CCEL, so every family that produces it uses the same value. + +``evidence-vendor-format`` + For a layout one vendor defines, whose values the device's family gives + through a CTLV enum extension point. + +The ABI check of ``regen`` covers both enums. An object lists the formats it +may have, from either enum, in ``formats`` and ``vendor-formats``, and the +reply names the one written in exactly one of ``format`` and +``vendor-format``. A new layout is a new value. + +Measurement registers +===================== + +Extending an MR folds a digest into its value, so the value commits to every +extension in order. An MR has a value for each hash algorithm it supports, a +bank. An MR's ``id`` is the device's handle for it, and ``mr-desc`` describes +it: + +``name`` + The platform's name for the MR, such as ``rtmr0``. + +``supported-hash-algorithms`` + One for each bank, in the provider's order. + +``register-index`` + The hardware's number for the MR, where it has one. + +``caps`` + ``extend`` where the MR may be extended. A provider still refuses an + extend the platform forbids at the time, as with ``EPERM`` for a TPM PCR + the current locality may not extend. + +Every MR can be read, though a read can still fail, as when the caller lacks +authorization or the platform's state forbids it. + +The name, banks, caps and register index describe an MR, and do not change. +The values change with every extension, so the two are read apart. +``mr-get`` describes every MR, which is how a program learns the IDs, or the +one an ID names. It is answered from what the device keeps, while +``mr-read``, which returns one MR's values, asks the hardware. ``mr-read`` and +``mr-extend`` take only the ID. + +A hash algorithm is a constant of ``enum hash_algo`` in +``include/uapi/linux/hash_info.h``, such as ``HASH_ALGO_SHA384``. + +Nothing reserves an MR, and the kernel does not arbitrate between its +writers. Any program with a read-write descriptor can extend it, and so can +the register's own interface, as for a TPM's PCRs. A program that replays an +MR from its own records has to make sure, through the system's configuration, +that it is the only writer; ``mr-generation`` counts only the extensions made +through the device. + +``mr-get`` +---------- + +Describes every MR, in fragments ordered by ID, or only the MR whose ``id`` +the request carries. Each is one of ``items``, with its ``id`` and its +``mr-desc``, as `Measurement registers`_ lists it. The query's generation is +the MR generation, so a continuation fails with ``ESTALE`` once any MR has +changed. + +``ENOENT`` + No MR has that ID. + +Access is read. + +``mr-read`` +----------- + +Returns the current values of the MR whose ``id`` the request carries. The +reply carries: + +``mr-generation`` + The MR generation of the values. + +``mr-values`` + One for each bank, in ``mr-get``'s order, with its ``hash-algo`` and + ``data``. + +``ENOENT`` + No MR has that ID. + +Access is read. + +``mr-extend`` +------------- + +Extends the MR whose ``id`` the request carries. The request carries one of +``mr-values`` for each bank of the MR to extend, in any order, each a +``hash-algo`` and a ``data`` of exactly that algorithm's digest size. The +banks left out keep their values. The device hashes nothing for the caller. + +The reply carries ``mr-generation``, the MR generation after the extension. + +``ENOENT`` + No MR has that ID. + +``EOPNOTSUPP`` + The MR cannot be extended, or the provider cannot extend only some of its + banks. + +``EPERM`` + The platform forbids extending the MR at the time. + +``EINVAL`` + The request carries no ``mr-values``, a value is for a bank the MR does not + have or repeats one, or a digest has the wrong length. + +Access is read-write.
Documentation/userspace-api/index.rst +1 -0
@@ -36,6 +36,7 @@ Security-related interfaces mfd_noexec spec_ctrl tee + attestation check_exec Devices and I/O
MAINTAINERS +1 -0
@@ -4439,6 +4439,7 @@ L: [email protected] S: Supported F: Documentation/ctlv/abi/ctlv-attestation* F: Documentation/ctlv/specs/ctlv-attestation* +F: Documentation/userspace-api/attestation*.rst F: drivers/attestation/ F: include/uapi/ctlv/ctlv_attestation*
Signature · 1 line
2.56.0
RFC PATCH v2 3/9 attestation: Prepare provider and instance core
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
Add provider validation, instance registration and lifecycle management for the attestation family. Each instance is a device of the attestation class, with a node under /dev/attestation/, and embeds its CTLV instance and node.
The provider descriptor is one immutable evidence and MR contract; MR state follows in the next patch. The core object can be compile-checked here. CONFIG_ATTESTATION remains unwired until the CTLV handlers land.
---RFC->RFCv2:
- gave attestation its own device, class and /dev/attestation/ nodes, each a struct ctlv_device
- dropped the goto from attestation_registry_insert()
- noted that instance indexes are never reused
- selected CRYPTO_HASH_INFO
- selected CTLV instead of depending on it
- kept each guard() on one line
- dropped the journal from the Kconfig help
- dropped read(), poll() and the event teardown
- refused hash algorithms the hash-algo enum does not list
- gave each evidence object a class and the formats it may have
- dropped max_total_output_length
- took each signed object's challenge lengths as a list, ascending and disjoint
- left the object count and challenge length limits to CTLV
- added attestation_evidence_write(), for blobs of any length
- let a request omit the challenge
- separated the steps of the longer functions
- took an MR's algorithms in any order, each once
- let mr_extend get the digests of some of an MR's banks
- required mr_read of a provider with MRs, as every MR can be read
- said that an MR's extend cap is fixed
- took the UAPI headers from include/uapi/ctlv/
- named evidence objects by ID, and had the provider give each result's format
--- MAINTAINERS | 1 + drivers/attestation/Kconfig | 12 + drivers/attestation/Makefile | 4 + drivers/attestation/core/core.c | 429 ++++++++++++++++++++++++++++ drivers/attestation/core/internal.h | 21 ++ include/linux/attestation.h | 240 ++++++++++++++++ 6 files changed, 707 insertions(+) create mode 100644 drivers/attestation/Kconfig create mode 100644 drivers/attestation/Makefile create mode 100644 drivers/attestation/core/core.c create mode 100644 drivers/attestation/core/internal.h create mode 100644 include/linux/attestation.h
MAINTAINERS +1 -0
@@ -4441,6 +4441,7 @@ F: Documentation/ctlv/abi/ctlv-attestation* F: Documentation/ctlv/specs/ctlv-attestation* F: Documentation/userspace-api/attestation*.rst F: drivers/attestation/ +F: include/linux/attestation* F: include/uapi/ctlv/ctlv_attestation* ATTO EXPRESSSAS SAS/SATA RAID SCSI DRIVER
drivers/attestation/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +# SPDX-License-Identifier: GPL-2.0-only +menuconfig ATTESTATION + tristate "Attestation" + select CRYPTO_HASH_INFO + select CTLV + help + Provides a CTLV family for evidence and measurement registers. + + Providers register one instance for a physical or logical device and + translate the common operations to their native service. + + If you are unsure, say N.
drivers/attestation/Makefile new file +4 -0
@@ -0,0 +1,4 @@ +# SPDX-License-Identifier: GPL-2.0 +obj-$(CONFIG_ATTESTATION) += attestation.o + +attestation-y := core/core.o
drivers/attestation/core/core.c new file +429 -0
429 lines not on this page · raw message
drivers/attestation/core/internal.h new file +21 -0
@@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef _ATTESTATION_INTERNAL_H +#define _ATTESTATION_INTERNAL_H + +#include <linux/attestation.h> +#include <linux/ctlv.h> +#include <linux/mutex.h> +#include <linux/xarray.h> + +#include "../generated/ctlv_attestation_gen.h" + +#define ATTESTATION_REGISTERED XA_MARK_1 + +bool attestation_registered (struct attestation_dev *att); +void attestation_stop (struct attestation_dev *att); + +int attestation_provider_validate (const struct attestation_provider *provider, +const struct ctlv_family *family); +void attestation_provide_ops (struct attestation_dev *att); + +#endif /* _ATTESTATION_INTERNAL_H */
include/linux/attestation.h new file +240 -0
240 lines not on this page · raw message
Signature · 1 line
2.56.0
Re: [PATCH RFC v2 3/9] attestation: Prepare provider and instance core
Quoted 39 lines
Add provider validation, instance registration and lifecycle management for the attestation family. Each instance is a device of the attestation class, with a node under
/dev/attestation/, and embeds its CTLV instance and node.The provider descriptor is one immutable evidence and MR contract; MR state follows in the next patch. The core object can be compile-checked here.
CONFIG_ATTESTATIONremains unwired until the CTLV handlers land.Assisted-by Cursor: GPT-5.6 SolAssisted-by Cursor: Claude Opus 5.5Signed-off-by Jiri Pirko <[email protected]>---
RFC->RFCv2:
- gave attestation its own device, class and/dev/attestation/nodes, each a structctlv_device
- dropped the goto fromattestation_registry_insert()
- noted that instance indexes are never reused
- selectedCRYPTO_HASH_INFO
- selected CTLV instead of depending on it
- kept eachguard()on one line
- dropped the journal from theKconfighelp
- droppedread(),poll()and the event teardown
- refused hash algorithms the hash-algo enum does not list
- gave each evidence object a class and the formats it may have
- droppedmax_total_output_length
- took each signed object's challenge lengths as a list, ascending and disjoint
- left the object count and challenge length limits to CTLV
- addedattestation_evidence_write(), for blobs of any length
- let a request omit the challenge
- separated the steps of the longer functions
- took an MR's algorithms in any order, each once
- letmr_extendget the digests of some of an MR's banks
- requiredmr_readof a provider with MRs, as every MR can be read
- said that an MR's extend cap is fixed
- took the UAPI headers frominclude/uapi/ctlv/
- named evidence objects by ID, and had the provider give each result's format
Quoted 6 lines
--- MAINTAINERS | 1 + drivers/attestation/Kconfig | 12 + drivers/attestation/Makefile | 4 + drivers/attestation/core/core.c | 429 ++++++++++++++++++++++++++++ drivers/attestation/core/internal.h | 21 ++
Traditionally subsystems put their core code in the top dir and drivers in sub dirs, or loose in the main dir too. The really big big subsystems use a subdir for core.
I think in this case we should skip the core/ subdir. Linus has also complained about the directory name stuttering like core/core.c in the past.
drivers/attestation/core/core.c line 29
Quoted 6 lines
[ ... 78 lines skipped ... ]
drivers/attestation/core/core.c new file +5
-0+/* A reply carries only what hash-algo in ctlv-attestation.yaml lists. */ +static bool attestation_algorithm_valid (enum hash_algo algorithm) +{ +return algorithm >=0 && algorithm <=HASH_ALGO_SHA3_512 && hash_digest_size[algorithm] && + hash_digest_size[algorithm] <=HASH_MAX_DIGESTSIZE ;
<= HASH_ALGO_SHA3_512 should be < ARRAY_SIZE(hash_digest_size) ?
drivers/attestation/core/core.c line 40
Quoted 11 lines
drivers/attestation/core/core.c new file +11
-0+} + +static int attestation_mr_props_validate (const struct attestation_provider *provider, +const struct attestation_mr_props *props) +{ + DECLARE_BITMAP(seen, HASH_ALGO__LAST) = {}; +size_t index; + +if (!props || !props->name || !*props->name ||strlen (props->name) >128 || + !props->algorithms || !props->algorithms_count || props->algorithms_count >23 ) +return -EINVAL ;
The magic numbers should come from someplace..
Quoted 10 lines
drivers/attestation/core/core.c new file +10
-0+for (index =0 ; index < props->algorithms_count; index++) { +enum hash_algo algorithm = props->algorithms[index]; + +if (!attestation_algorithm_valid (algorithm) || +__test_and_set_bit (algorithm, seen)) +return -EINVAL ; + } +if (props->extendable && !provider->mr_extend) +return -EINVAL ; +return 0 ;
drivers/attestation/core/core.c line 59
Quoted 10 lines
drivers/attestation/core/core.c new file +9
-0+} + +/* What device-get and evidence-get carry, as ctlv-attestation.yaml bounds it. */ +#define ATTESTATION_EVIDENCE_OBJECTS_MAX 16 +#define ATTESTATION_EVIDENCE_FORMATS_MAX 4 +#define ATTESTATION_CHALLENGE_LENGTHS_MAX 8 +#define ATTESTATION_CHALLENGE_MAX 4096 +/* Moves with each value appended to evidence-format. */ +#define ATTESTATION_EVIDENCE_FORMAT_LAST CTLV_ATTESTATION_EVIDENCE_FORMAT_CCEL
Should the general schema processor be checking these? Seems odd they are just open coded here when it has the information..
drivers/attestation/core/core.c line 180
Quoted 12 lines
[ ... 110 lines skipped ... ]
drivers/attestation/core/core.c new file +11
-0+static int attestation_registry_insert (struct attestation_dev *att) +{ +unsigned long index; +void *old; +int ret; + +guard (mutex)(&attestation_registry_lock); +if (attestation_next_index >UINT_MAX ) +return -ENOSPC ; + index = attestation_next_index; + ret =xa_reserve (&attestation_instances, index,GFP_KERNEL );
This is usually written as xa_alloc_cyclic()
drivers/attestation/core/core.c line 185
Quoted 5 lines
drivers/attestation/core/core.c new file +5
-0+if (ret) +return ret; + +xa_lock (&attestation_instances); +if (attestation_parent_exists (att->node.dev.parent)) {
Why? What's the issue if a device wants a bunch of attestation end points?
drivers/attestation/core/core.c line 212
Quoted 9 lines
[ ... 19 lines skipped ... ]
drivers/attestation/core/core.c new file +8
-0+bool attestation_registered (struct attestation_dev *att) +{ +bool registered; + +lockdep_assert_held (&att->lock); +xa_lock (&attestation_instances); + registered =xa_get_mark (&attestation_instances, att->index,ATTESTATION_REGISTERED ); +xa_unlock (&attestation_instances);
No need for the spinlock here
drivers/attestation/core/core.c line 271
Quoted 10 lines
[ ... 50 lines skipped ... ]
drivers/attestation/core/core.c new file +9
-0+static int attestation_op_pre (struct ctlv *ctlv,struct ctlv_op_ctx *ctx) +{ +struct attestation_dev *att =attestation_from_ctlv (ctlv); + +mutex_lock (&att->lock); +if (!attestation_registered (att)) { +mutex_unlock (&att->lock); +return -ENODEV ; + }
I'm struggling to figure out why there is an xa mark, it doesn't seem needed by anything?
The revoke flow is already handled by the common code with:
scoped_guard(rwsem_read, &ctlv->registration_lock) {
if (!ctlv->registered || !ctlv->family)
return -ENODEV;
ret = ctlv_op_exec(cfile, &exec, snapshot, &reply, &reply_len);
}Why does it need two layers of the same thing?
In fact, why does the xarray exist at all? Its only purpose is to de-duplicate the parent, which seems pointless and not something a subsystem should do. Seems like it can be removed. It is confusing that the xarray gives an id but then the ctlv has an idr which then gives a different id.
drivers/attestation/core/core.c line 426
Quoted 10 lines
[ ... 146 lines skipped ... ]
drivers/attestation/core/core.c new file +9
-0+static void __exit attestation_module_exit(void) +{ +WARN_ON_ONCE (!xa_empty (&attestation_instances)); +xa_destroy (&attestation_instances); +ctlv_device_class_unregister (&attestation_class); +} + +module_init (attestation_module_init); +module_exit (attestation_module_exit);
subsys_init
Signature · 1 line
Jason
Re: [PATCH RFC v2 3/9] attestation: Prepare provider and instance core
Quoted 46 lines · Fri, Nov 27, 2026 at 01:25:39AM +0100, [email protected] wrote:
Quoted 39 lines
Add provider validation, instance registration and lifecycle management for the attestation family. Each instance is a device of the attestation class, with a node under
/dev/attestation/, and embeds its CTLV instance and node.The provider descriptor is one immutable evidence and MR contract; MR state follows in the next patch. The core object can be compile-checked here.
CONFIG_ATTESTATIONremains unwired until the CTLV handlers land.Assisted-by Cursor: GPT-5.6 SolAssisted-by Cursor: Claude Opus 5.5Signed-off-by Jiri Pirko <[email protected]>---
RFC->RFCv2:
- gave attestation its own device, class and/dev/attestation/nodes, each a structctlv_device
- dropped the goto fromattestation_registry_insert()
- noted that instance indexes are never reused
- selectedCRYPTO_HASH_INFO
- selected CTLV instead of depending on it
- kept eachguard()on one line
- dropped the journal from theKconfighelp
- droppedread(),poll()and the event teardown
- refused hash algorithms the hash-algo enum does not list
- gave each evidence object a class and the formats it may have
- droppedmax_total_output_length
- took each signed object's challenge lengths as a list, ascending and disjoint
- left the object count and challenge length limits to CTLV
- addedattestation_evidence_write(), for blobs of any length
- let a request omit the challenge
- separated the steps of the longer functions
- took an MR's algorithms in any order, each once
- letmr_extendget the digests of some of an MR's banks
- requiredmr_readof a provider with MRs, as every MR can be read
- said that an MR's extend cap is fixed
- took the UAPI headers frominclude/uapi/ctlv/
- named evidence objects by ID, and had the provider give each result's formatQuoted 6 lines
--- MAINTAINERS | 1 + drivers/attestation/Kconfig | 12 + drivers/attestation/Makefile | 4 + drivers/attestation/core/core.c | 429 ++++++++++++++++++++++++++++ drivers/attestation/core/internal.h | 21 ++
Quoted 3 lines
Traditionally subsystems put their core code in the top dir and drivers in sub dirs, or loose in the main dir too. The really big big subsystems use a subdir for core.
Okay. Makes sense.
Quoted 5 lines
I think in this case we should skip the core/ subdir. Linus has also complained about the directory name stuttering like
core/core.cin the past.
Quoted 8 lines
drivers/attestation/core/core.c line 29
Quoted 6 lines
[ ... 78 lines skipped ... ]
drivers/attestation/core/core.c new file +5
-0+/* A reply carries only what hash-algo in ctlv-attestation.yaml lists. */ +static bool attestation_algorithm_valid (enum hash_algo algorithm) +{ +return algorithm >=0 && algorithm <=HASH_ALGO_SHA3_512 && hash_digest_size[algorithm] && + hash_digest_size[algorithm] <=HASH_MAX_DIGESTSIZE ;<=
HASH_ALGO_SHA3_512should be <ARRAY_SIZE(hash_digest_size)?
Sure.
Quoted 14 lines
drivers/attestation/core/core.c line 40
Quoted 12 lines
drivers/attestation/core/core.c new file +11
-0+} + +static int attestation_mr_props_validate (const struct attestation_provider *provider, +const struct attestation_mr_props *props) +{ + DECLARE_BITMAP(seen, HASH_ALGO__LAST) = {}; +size_t index; + +if (!props || !props->name || !*props->name ||strlen (props->name) >128 || + !props->algorithms || !props->algorithms_count || props->algorithms_count >23 ) +return -EINVAL ;The magic numbers should come from someplace..
Agreed.
Quoted 19 lines
Quoted 18 lines
drivers/attestation/core/core.c new file +17
-0+for (index =0 ; index < props->algorithms_count; index++) { +enum hash_algo algorithm = props->algorithms[index]; + +if (!attestation_algorithm_valid (algorithm) || +__test_and_set_bit (algorithm, seen)) +return -EINVAL ; + } +if (props->extendable && !provider->mr_extend) +return -EINVAL ; +return 0 ; +} + +/* What device-get and evidence-get carry, as ctlv-attestation.yaml bounds it. */ +#define ATTESTATION_EVIDENCE_OBJECTS_MAX 16 +#define ATTESTATION_EVIDENCE_FORMATS_MAX 4 +#define ATTESTATION_CHALLENGE_LENGTHS_MAX 8 +#define ATTESTATION_CHALLENGE_MAX 4096
Quoted 5 lines
drivers/attestation/core/core.c line 59
Quoted 2 lines
drivers/attestation/core/core.c new file +2
-0+/* Moves with each value appended to evidence-format. */ +#define ATTESTATION_EVIDENCE_FORMAT_LAST CTLV_ATTESTATION_EVIDENCE_FORMAT_CCELShould the general schema processor be checking these? Seems odd they are just open coded here when it has the information..
Agreed, The generator will emit the bounds the spec declares as constants, and the core will use those, so nothing is open coded and a regen follows the spec. The checks stay where they are, as they fail a provider at probe; the schema processor does check the same when a reply is built, but only then, and with a warning.
Quoted 58 lines
drivers/attestation/core/core.c line 180
Quoted 13 lines
[ ... 110 lines skipped ... ]
drivers/attestation/core/core.c new file +11
-0+static int attestation_registry_insert (struct attestation_dev *att) +{ +unsigned long index; +void *old; +int ret; + +guard (mutex)(&attestation_registry_lock); +if (attestation_next_index >UINT_MAX ) +return -ENOSPC ; + index = attestation_next_index; + ret =xa_reserve (&attestation_instances, index,GFP_KERNEL );This is usually written as
xa_alloc_cyclic()drivers/attestation/core/core.c line 185
Quoted 5 lines
drivers/attestation/core/core.c new file +5
-0+if (ret) +return ret; + +xa_lock (&attestation_instances); +if (attestation_parent_exists (att->node.dev.parent)) {Why? What's the issue if a device wants a bunch of attestation end points?
drivers/attestation/core/core.c line 212
Quoted 9 lines
[ ... 19 lines skipped ... ]
drivers/attestation/core/core.c new file +8
-0+bool attestation_registered (struct attestation_dev *att) +{ +bool registered; + +lockdep_assert_held (&att->lock); +xa_lock (&attestation_instances); + registered =xa_get_mark (&attestation_instances, att->index,ATTESTATION_REGISTERED ); +xa_unlock (&attestation_instances);No need for the spinlock here
drivers/attestation/core/core.c line 271
Quoted 10 lines
[ ... 50 lines skipped ... ]
drivers/attestation/core/core.c new file +9
-0+static int attestation_op_pre (struct ctlv *ctlv,struct ctlv_op_ctx *ctx) +{ +struct attestation_dev *att =attestation_from_ctlv (ctlv); + +mutex_lock (&att->lock); +if (!attestation_registered (att)) { +mutex_unlock (&att->lock); +return -ENODEV ; + }I'm struggling to figure out why there is an xa mark, it doesn't seem needed by anything?
The revoke flow is already handled by the common code with:
scoped_guard(rwsem_read, &ctlv->registration_lock) { if (!ctlv->registered || !ctlv->family) return -ENODEV; ret = ctlv_op_exec(cfile, &exec, snapshot, &reply, &reply_len); }
Quoted 7 lines
Why does it need two layers of the same thing?
In fact, why does the xarray exist at all? Its only purpose is to de-duplicate the parent, which seems pointless and not something a subsystem should do. Seems like it can be removed. It is confusing that the xarray gives an id but then the ctlv has an idr which then gives a different id.
You are right, nothing in this series needs it. It is there for in-kernel consumers, like IMA. It selects an instance by its parent and holds on to it by index. I'll take the registry out of this series and leave revoke to CTLV.
After IMA is work will be posted, I'll look at finding the instance through the class device instead, so there is one ID and no limit on the endpoints of a parent.
Quoted 13 lines
drivers/attestation/core/core.c line 426
Quoted 11 lines
[ ... 146 lines skipped ... ]
drivers/attestation/core/core.c new file +9
-0+static void __exit attestation_module_exit(void) +{ +WARN_ON_ONCE (!xa_empty (&attestation_instances)); +xa_destroy (&attestation_instances); +ctlv_device_class_unregister (&attestation_class); +} + +module_init (attestation_module_init); +module_exit (attestation_module_exit);
subsys_init
Okay. Thanks!
Quoted 3 lines
Signature · 2 lines
-- Jason
Re: [PATCH RFC v2 3/9] attestation: Prepare provider and instance core
Quoted 3 lines · Jiri Pirko
After IMA is work will be posted, I'll look at finding the instance through the class device instead, so there is one ID and no limit on the endpoints of a parent.
Yeah that makes more sense and more broadly we should have some string based way to identify the ROT for IMA to use, somehow. I don't know what that will look like but it can come in a later series.
Jason
Re: [PATCH RFC v2 3/9] attestation: Prepare provider and instance core
Quoted 9 lines · Mon, Nov 30, 2026 at 09:37:38PM +0100, [email protected] wrote:
Quoted 3 lines · Jiri Pirko
After IMA is work will be posted, I'll look at finding the instance through the class device instead, so there is one ID and no limit on the endpoints of a parent.
Yeah that makes more sense and more broadly we should have some string based way to identify the ROT for IMA to use, somehow. I don't know what that will look like but it can come in a later series.
For IMA, I have following identification in mind for now:
kernel parameter:
ima_attestation=<family>:<mr-name>
ima_attestation=<bus>/<dev>:<mr-name>
The device is named either by a family of its chain, or by the bus and name of its parent device; the "/" tells the two apart. Exactly one device has to match.
<mr-name> is what follows the last ":". It is either the name mr-get lists for the MR, or the alias "ima_default", which stands for the MR the provider marks as the one for IMA. The MR has to be extendable.
Examples for a TDX guest, whose MRs are mrtd and rtmr0 to rtmr3:
ima_attestation=ctlv-attestation-tdx:rtmr2 ima_attestation=ctlv-attestation-tdx:ima_default ima_attestation=misc/tdx_guest:rtmr2
A device whose parent is a PCI function, and any attestation device on a machine that has only one:
ima_attestation=pci/0000:00:01.0:rtmr2
ima_attestation=ctlv-attestation:ima_default
MR names are unique on a device, contain no ":", and do not depend on the order in which a provider lists its MRs, so rtmr2 is RTMR2 on every TDX guest.
Re: [PATCH RFC v2 3/9] attestation: Prepare provider and instance core
Quoted 11 lines · Jiri Pirko
Quoted 9 lines · Mon, Nov 30, 2026 at 09:37:38PM +0100, [email protected] wrote:
Quoted 3 lines · Jiri Pirko
After IMA is work will be posted, I'll look at finding the instance through the class device instead, so there is one ID and no limit on the endpoints of a parent.
Yeah that makes more sense and more broadly we should have some string based way to identify the ROT for IMA to use, somehow. I don't know what that will look like but it can come in a later series.
Quoted 6 lines
For IMA, I have following identification in mind for now:
kernel parameter:
ima_attestation=<family>:<mr-name>
ima_attestation=<bus>/<dev>:<mr-name>
We probably want an option to select a "pcr policy", which defines both a ROT to host them and the way the PCRs should be assigned in the system. Overall, in a way that effects all the kernel users and is visible to userspace too.
Like tpm-non-drtm and tpm-drtm both specify the ROT and the MR # to use.
Most liekyl bus/dev is not that useful because we probably won't see two ROTs of the same type in real systems.
In practical cases this would be selecting between FIRME and (firt) TPM, as an example on ARM systems.
It probably makes sense to offer a fixed MR option somehow, maybe that is defining some policy on the command line instead of subsystem by subsystem, I don't know.
Jason
Re: [PATCH RFC v2 3/9] attestation: Prepare provider and instance core
Quoted 19 lines · Thu, Dec 03, 2026 at 02:43:44PM +0100, [email protected] wrote:
Quoted 11 lines · Jiri Pirko
Quoted 9 lines · Mon, Nov 30, 2026 at 09:37:38PM +0100, [email protected] wrote:
Quoted 3 lines · Jiri Pirko
After IMA is work will be posted, I'll look at finding the instance through the class device instead, so there is one ID and no limit on the endpoints of a parent.
Yeah that makes more sense and more broadly we should have some string based way to identify the ROT for IMA to use, somehow. I don't know what that will look like but it can come in a later series.
Quoted 6 lines
For IMA, I have following identification in mind for now:
kernel parameter:
ima_attestation=<family>:<mr-name>
ima_attestation=<bus>/<dev>:<mr-name>
Quoted 7 lines
We probably want an option to select a "pcr policy", which defines both a ROT to host them and the way the PCRs should be assigned in the system. Overall, in a way that effects all the kernel users and is visible to userspace too.
Like tpm-non-drtm and tpm-drtm both specify the ROT and the MR # to use.
Okay. That would be even more abstracted out config.
Quoted 3 lines
Most liekyl bus/dev is not that useful because we probably won't see two ROTs of the same type in real systems.
True. I have it in unlikely case there are multiple devices of the same family and user would still like to pick (like 2 tpm devices).
Quoted 9 lines
In practical cases this would be selecting between FIRME and (firt) TPM, as an example on ARM systems.
It probably makes sense to offer a fixed MR option somehow, maybe that is defining some policy on the command line instead of subsystem by subsystem, I don't know.
Jason
Re: [PATCH RFC v2 3/9] attestation: Prepare provider and instance core
In reply to Jiri PirkoQuoted 11 lines · Jiri Pirko
From: Jiri Pirko <[email protected]>
Add provider validation, instance registration and lifecycle management for the attestation family. Each instance is a device of the attestation class, with a node under
/dev/attestation/, and embeds its CTLV instance and node.The provider descriptor is one immutable evidence and MR contract; MR state follows in the next patch. The core object can be compile-checked here.
CONFIG_ATTESTATIONremains unwired until the CTLV handlers land.
[ ... 444 lines skipped ... ]
Quoted 21 lines
drivers/attestation/core/core.c new file +20
-0+/** +* attestation_register - Make an allocated device reachable. +* @att: device from attestation_alloc() +* +* Return: 0, or a negative errno with @att still to be put. +*/ +int attestation_register (struct attestation_dev *att) +{ +int ret; + + ret =attestation_registry_insert (att); +if (ret) +return ret; +ctlv_publish (&att->ctlv); +xa_lock (&attestation_instances); +__xa_set_mark (&attestation_instances, att->index,ATTESTATION_REGISTERED ); +xa_unlock (&attestation_instances); + + ret =ctlv_device_add (&att->node); +if (ret)
drivers/attestation/core/core.c line 384
Quoted 10 lines
drivers/attestation/core/core.c new file +10
-0+ goto err_withdraw; +return 0 ; + +err_withdraw: +attestation_withdraw (att); +ctlv_unpublish (&att->ctlv); +attestation_registry_remove (att); +return ret; +} +EXPORT_SYMBOL_NS_GPL (attestation_register,"ATTESTATION" );
I ran into this while implementing SPDM attestation. We should keep ctlv->registered false until all registration steps, including ctlv_device_add(), have succeeded. Enabling callbacks should be the final step in attestation_register().
Could we also avoid taking ctlv->registration_lock in ctlv_device_add() and ctlv_publish()? TSM drivers may call attestation_register() while holding their own locks. For CCA, registration holds pci_tsm_rwsem, so taking registration_lock here introduces this dependency:
pci_tsm_rwsem -> ctlv->registration_lock
CTLV operations hold registration_lock while invoking callbacks, and those callbacks may need to acquire pci_tsm_rwsem, creating the reverse dependency.
I think we should preserve this lock ordering:
ctlv->registration_lock -> pci_tsm_rwsem
and avoid taking registration_lock during ctlv_publish() and ctlv_device_add().
-aneesh
Re: [PATCH RFC v2 3/9] attestation: Prepare provider and instance core
Quoted 11 lines · Aneesh Kumar K.V
Could we also avoid taking
ctlv->registration_lockinctlv_device_add()andctlv_publish()? TSM drivers may callattestation_register()while holding their own locks. For CCA, registration holdspci_tsm_rwsem, so takingregistration_lockhere introduces this dependency:pci_tsm_rwsem -> ctlv->registration_lockCTLV operations hold
registration_lockwhile invoking callbacks, and those callbacks may need to acquirepci_tsm_rwsem, creating the reverse dependency.
Quoted 6 lines
I think we should preserve this lock ordering:
ctlv->registration_lock -> pci_tsm_rwsemand avoid taking
registration_lockduringctlv_publish()andctlv_device_add().
That doesn't seem like tsm is using its locks right. Lets not create another rtnl_lock :\
Jason
RFC PATCH v2 4/9 attestation: Prepare measurement registers
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
Add the fixed MRs from the provider descriptor, their lookup and MR extension, which advances an instance-wide MR generation.
The MR objects can be compile-checked here. CONFIG_ATTESTATION remains unwired until the CTLV operation handlers complete the module.
---RFC->RFCv2:
- kept the MR state in struct attestation_dev, which providers embed
- dropped the MR journal and its notifications
- counted MR changes in a plain MR generation
- retitled from "Prepare measurement register journal"
- used the helpers generated for the rewritten spec
- let an extend carry values for some of an MR's banks
- always provided mr-read with MRs
--- drivers/attestation/Makefile | 2 +- drivers/attestation/core/core.c | 71 +++++++++++++++++++++++++++++ drivers/attestation/core/internal.h | 13 ++++++ drivers/attestation/core/mr.c | 64 ++++++++++++++++++++++++++ include/linux/attestation.h | 5 +- 5 files changed, 153 insertions(+), 2 deletions(-) create mode 100644 drivers/attestation/core/mr.c
drivers/attestation/Makefile +1 -1
@@ -1,4 +1,4 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_ATTESTATION) += attestation.o -attestation-y := core/core.o +attestation-y := core/core.o core/mr.o
drivers/attestation/core/core.c +71 -0
105 lines not on this page · raw message
drivers/attestation/core/internal.h +13 -0
@@ -11,11 +11,24 @@#define ATTESTATION_REGISTERED XA_MARK_1 +struct attestation_mr { +const struct attestation_mr_props *props; +}; +bool attestation_registered (struct attestation_dev *att);void attestation_stop (struct attestation_dev *att); +void attestation_mr_changed (struct attestation_dev *att);int attestation_provider_validate (const struct attestation_provider *provider,const struct ctlv_family *family);void attestation_provide_ops (struct attestation_dev *att); +struct attestation_mr *attestation_mr_lookup_live (struct attestation_dev *att,unsigned int mr_id); +int attestation_mr_values_validate (const struct attestation_mr_props *props, +const struct attestation_digest_set *values,bool all_banks); +int attestation_mr_extend_locked (struct attestation_dev *att,struct attestation_mr *mr, +const struct attestation_digest_set *values); + +int attestation_mr_props_encode (struct ctlv_cursor *reply,const struct attestation_mr *mr); +#endif /* _ATTESTATION_INTERNAL_H */
drivers/attestation/core/mr.c new file +64 -0
64 lines not on this page · raw message
include/linux/attestation.h +4 -1
@@ -9,6 +9,7 @@#include <linux/device.h> #include <linux/mutex.h> #include <linux/types.h> +#include <linux/xarray.h> #include <uapi/ctlv/ctlv_attestation_gen.h> #include <uapi/linux/hash_info.h>
@@ -200,9 +201,11 @@ struct attestation_dev {const struct attestation_provider *provider;unsigned int index; -/* Mutable instance state. */ +/* Mutable instance and MR state. */ struct mutex lock; +unsigned int mr_generation; +struct xarray mrs; };/* What a CTLV callback of a family inheriting ctlv-attestation was handed. */
Signature · 1 line
2.56.0
RFC PATCH v2 5/9 attestation: Add CTLV operation handling
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
Translate CTLV evidence and MR operations to the provider core and wire the attestation family into the kernel build.
---RFC->RFCv2:
- handed the op handlers the CTLV instance
- put resolved blobs on evidence decode errors
- continued an MR dump past an MR that does not fit
- dropped the MR log query
- dropped the total output length check and its E2BIG
- reported each evidence object's class and formats
- reported each signed object's challenge lengths as a list, and took a challenge of a length every signed object named lists
- left the MR ID and hash algorithm bounds to CTLV
- used the helpers generated for the rewritten spec
- let evidence-get omit the challenge
- took output blobs of any length
- separated the steps of the longer functions
- let mr-extend extend some of an MR's banks, in any order
- replied to mr-read in the provider's bank order
- dropped the MR read caps, as every MR can be read
- said record instead of nest, the root being one
- took evidence-get's objects by ID, and replied with each one's format and length
--- drivers/Kconfig | 2 + drivers/Makefile | 1 + drivers/attestation/Makefile | 3 +- drivers/attestation/core/ctlv.c | 499 ++++++++++++++++++++++++++++++++ 4 files changed, 504 insertions(+), 1 deletion(-) create mode 100644 drivers/attestation/core/ctlv.c
drivers/Kconfig +2 -0
@@ -25,6 +25,8 @@ source "drivers/cache/Kconfig" source "drivers/connector/Kconfig" +source "drivers/attestation/Kconfig" + source "drivers/firmware/Kconfig" source "drivers/fwctl/Kconfig"
drivers/Makefile +1 -0
@@ -135,6 +135,7 @@ obj-$(CONFIG_MEMSTICK) += memstick/ obj-$(CONFIG_INFINIBAND) += infiniband/ obj-y += firmware/ obj-$(CONFIG_FWCTL) += fwctl/ +obj-$(CONFIG_ATTESTATION) += attestation/ obj-$(CONFIG_CRYPTO) += crypto/ obj-$(CONFIG_SUPERH) += sh/ obj-y += clocksource/
drivers/attestation/Makefile +2 -1
@@ -1,4 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_ATTESTATION) += attestation.o -attestation-y := core/core.o core/mr.o +attestation-y := core/core.o core/ctlv.o core/mr.o \ + generated/ctlv_attestation_gen.o
drivers/attestation/core/ctlv.c new file +499 -0
499 lines not on this page · raw message
Signature · 1 line
2.56.0
RFC PATCH v2 6/9 Documentation: attestation: Describe how to write a provider
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
Describe how a provider registers with the attestation core, how other writers share its MRs and how it is torn down, with the kernel-doc of the provider API.
---RFC->RFCv2:
- split out of the provider and instance core patch
- dropped the journal from the overview
- said how other writers extend the same MRs
- added the kernel-doc to the driver API page
--- Documentation/driver-api/attestation.rst | 99 +++++++++++++++++++++ Documentation/driver-api/index.rst | 1 + Documentation/userspace-api/attestation.rst | 3 +- MAINTAINERS | 1 + 4 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 Documentation/driver-api/attestation.rst
Documentation/driver-api/attestation.rst new file +99 -0
@@ -0,0 +1,99 @@ +.. SPDX-License-Identifier: GPL-2.0-only + +=========== +Attestation +=========== + +The attestation subsystem gives each provider device a node of the +``attestation`` class, ``/dev/attestation/attestationN``, which answers as a +descendant of the ``ctlv-attestation`` family, one family per provider. A +program tells providers apart by the last entry of ``family-get`` on the +open device, and generic tools use the ``ctlv-attestation`` operations on any +of them. The subsystem owns common evidence retrieval and +measurement-register topology. Providers retain ownership of native hardware +access and immutable capability descriptions. + +Registering a provider +====================== + +A provider embeds ``struct attestation_dev`` first in its own structure and +allocates both with ``attestation_alloc()``, passing its +``struct attestation_provider`` and its family descriptor, which inherits +``ctlv-attestation``: + +.. code-block:: c + + struct foo { + struct attestation_dev att; + struct foo_hw *hw; + }; + + foo = attestation_alloc(parent, &foo_provider, + &ctlv_attestation_foo_family, struct foo, att); + if (IS_ERR(foo)) + return PTR_ERR(foo); + foo->hw = hw; + ret = attestation_register(&foo->att); + if (ret) { + attestation_put(&foo->att); + return ret; + } + +A provider callback gets the ``struct attestation_dev`` and reaches the +provider's structure with ``container_of()``. A CTLV callback of the +provider's own family gets the CTLV instance, which +``attestation_from_ctlv()`` turns into the device. No provider callback runs +before ``attestation_register()``, so the provider finishes its own setup in +between. The descriptor, evidence capabilities, fixed MR properties, strings +and arrays remain immutable until the last ``attestation_put()``. + +The subsystem embeds the CTLV instance, and its hooks run every operation, +those of the device's family included, under one instance mutex. That +serializes an operation and its native callback. + +Every MR can be read, so a provider with MRs implements ``mr_read``. +Fixed MRs are listed in the provider descriptor. Their property storage +remains valid until the last ``attestation_put()``. + +The evidence capabilities list the objects ``evidence-get`` produces, each +object's ID being its index. An object gives its class and the formats it +may have, ``ctlv-attestation``'s ``evidence-format`` or its family's +``evidence-vendor-format``, and a signed object its challenge lengths. +``attestation_alloc()`` refuses a format the family does not give. + +``evidence_get`` writes each object with ``attestation_evidence_write()``, +which fails the operation with ``-EMSGSIZE`` where the caller's blob is too +short, and tells the caller how long it has to be. It fills in each object's +result: the format written and its length. A format the object does not list +fails the call with ``-EPROTO``. + +Other writers +============= + +This interface is not the only way to extend a measurement register, and it +does not arbitrate between the ways there are. Every program holding a +read-write descriptor of the device can extend a register through +``mr-extend``, and a register with a native interface of its own can be +extended through that too, as a TPM's PCRs are by programs using +``/dev/tpm0`` or ``/dev/tpmrm0`` and by IMA. Nothing reserves a register for +one writer. A register two writers extend holds the extensions of both, in +the order they arrived, and ``mr-read`` and the evidence report it as it is. +A program that replays a register from its own records has to be its only +writer, by agreement with whatever else runs on the system. + +Teardown +======== + +``attestation_unregister()`` first removes the node, so nothing opens the +device again. It then withdraws the device from the kernel registry, refusing +the operations of files still open. Only then does it unpublish the CTLV +instance, which drains the operations in flight. No provider callback runs +once it returns, so the provider may release its native state before +``attestation_put()``. Open files keep the structure until they close. + +Kernel API +========== + +.. kernel-doc:: include/linux/attestation.h +.. kernel-doc:: drivers/attestation/core/core.c + :export:
Documentation/driver-api/index.rst +1 -0
@@ -38,6 +38,7 @@ of interest to most developers working on device drivers. early-userspace/index connector ctlv + attestation device-io devfreq dma-buf
Documentation/userspace-api/attestation.rst +2 -1
@@ -16,7 +16,8 @@ The node speaks CTLV, described in :doc:`ctlv`, as a descendant of the belongs to ``ctlv-attestation``, so a tool written against it works with any provider. The specification is ``Documentation/ctlv/specs/ctlv-attestation.yaml`` and the constants are in -``include/uapi/ctlv/ctlv_attestation_gen.h``. +``include/uapi/ctlv/ctlv_attestation_gen.h``. Writing a provider is +:doc:`/driver-api/attestation`. ====================== ====== ========== ================================ Operation Type Access Purpose
MAINTAINERS +1 -0
@@ -4439,6 +4439,7 @@ L: [email protected] S: Supported F: Documentation/ctlv/abi/ctlv-attestation* F: Documentation/ctlv/specs/ctlv-attestation* +F: Documentation/driver-api/attestation.rst F: Documentation/userspace-api/attestation*.rst F: drivers/attestation/ F: include/linux/attestation*
Signature · 1 line
2.56.0
RFC PATCH v2 7/9 tdx-guest: Expose the native attestation service API
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
Factor the Quote and measurement-register operations of the misc, TSM report and TSM MR interfaces into helpers declared in a driver-internal header, for an attestation provider built into the driver to share.
---RFC->RFCv2:
- kept the helpers inside tdx-guest, in place of a client API and its header
- dropped the MAINTAINERS lines, which N: tdx already covers
- sized the TSM report outblob to its Quote
- dropped an unreachable return in tdx_do_report()
- dropped the stale kernel client section from tdx-guest.rst
- numbered every enum member
--- drivers/virt/coco/tdx-guest/internal.h | 30 ++++++ drivers/virt/coco/tdx-guest/tdx-guest.c | 130 +++++++++++++++++++----- 2 files changed, 132 insertions(+), 28 deletions(-) create mode 100644 drivers/virt/coco/tdx-guest/internal.h
drivers/virt/coco/tdx-guest/internal.h new file +30 -0
@@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _TDX_GUEST_INTERNAL_H +#define _TDX_GUEST_INTERNAL_H + +#include <crypto/sha2.h> +#include <linux/types.h> + +#define TDX_GUEST_QUOTE_MAX_LEN ((128 * 1024) - 24) + +struct tdx_guest_info { +u8 mrconfigid[SHA384_DIGEST_SIZE ]; +u8 mrowner[SHA384_DIGEST_SIZE ]; +u8 mrownerconfig[SHA384_DIGEST_SIZE ]; +}; + +enum tdx_guest_mr { +TDX_GUEST_MR_MRTD =0 , +TDX_GUEST_MR_RTMR0 =1 , +TDX_GUEST_MR_RTMR1 =2 , +TDX_GUEST_MR_RTMR2 =3 , +TDX_GUEST_MR_RTMR3 =4 , +}; + +/* @reportdata is TDX_REPORTDATA_LEN bytes, and @out holds TDX_GUEST_QUOTE_MAX_LEN. */ +int tdx_guest_quote_get (const u8 *reportdata,void *out,size_t *out_length); +int tdx_guest_mr_read (enum tdx_guest_mr mr,u8 value[SHA384_DIGEST_SIZE ]); +int tdx_guest_rtmr_extend (unsigned int rtmr, +const u8 value[SHA384_DIGEST_SIZE ]); + +#endif /* _TDX_GUEST_INTERNAL_H */
drivers/virt/coco/tdx-guest/tdx-guest.c +102 -28
205 lines not on this page · raw message
Signature · 1 line
2.56.0
RFC PATCH v2 8/9 attestation: Add the TDX family specification and generated files
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
Define the TDX attestation family and reserve family ID 2. Add its ABI snapshot, registry entry and generated kernel and UAPI files.
The ABI is intentionally specification-first. The generated descriptor is linked with the provider implementation in the following patch.
---RFC->RFCv2:
- generated the kernel files into drivers/virt/coco/tdx-guest/
- dropped the family's priv lifecycle hook
- generated an extension fill in place of a stub fill
- wrote the spec as op trees and records
- numbered every enum member
- moved the generated UAPI headers to include/uapi/ctlv/
- documented every item of the spec
- put each field's doc above its generated helpers
- gave the legacy and DICE Quote formats as evidence-vendor-format values
- said message instead of wire
--- .../ctlv/abi/ctlv-attestation-tdx.yaml | 21 ++++++ Documentation/ctlv/abi/families.registry.yaml | 1 + Documentation/ctlv/families.yaml | 1 + Documentation/ctlv/generated-files.yaml | 7 ++ .../ctlv/specs/ctlv-attestation-tdx.yaml | 25 +++++++ MAINTAINERS | 1 + .../coco/tdx-guest/ctlv_attestation_tdx_gen.c | 65 +++++++++++++++++++ .../coco/tdx-guest/ctlv_attestation_tdx_gen.h | 44 +++++++++++++ include/uapi/ctlv/ctlv_attestation_tdx_gen.h | 42 ++++++++++++ include/uapi/ctlv/ctlv_families_gen.h | 1 + 10 files changed, 208 insertions(+) create mode 100644 Documentation/ctlv/abi/ctlv-attestation-tdx.yaml create mode 100644 Documentation/ctlv/specs/ctlv-attestation-tdx.yaml create mode 100644 drivers/virt/coco/tdx-guest/ctlv_attestation_tdx_gen.c create mode 100644 drivers/virt/coco/tdx-guest/ctlv_attestation_tdx_gen.h create mode 100644 include/uapi/ctlv/ctlv_attestation_tdx_gen.h
Documentation/ctlv/abi/ctlv-attestation-tdx.yaml new file +21 -0
@@ -0,0 +1,21 @@ +# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) +%YAML 1.2 +--- +# Checked-in ABI snapshot of the ctlv-attestation-tdx family, from +# Documentation/ctlv/specs/ctlv-attestation-tdx.yaml, written by +# "make -C tools/ctlv regen". +# +# Updating the file is how a UAPI change gets reviewed; an update that +# removes or renumbers anything, narrows a bound, or makes a member required +# is an ABI break, whatever the file says afterwards. +family: {name: ctlv-attestation-tdx, id: 2, inherits: ctlv-attestation} +enums: + evidence-vendor-format: {quote: 1, quote-dice: 2} +records: + device-info: + id: 0x00010000 + fields: + mrconfigid: {number: 1, type: binary, length: 48} + mrowner: {number: 2, type: binary, length: 48} + mrownerconfig: {number: 3, type: binary, length: 48} +fills: {device-info: device-info}
Documentation/ctlv/abi/families.registry.yaml +1 -0
@@ -6,3 +6,4 @@ families: - ctlv - ctlv-attestation + - ctlv-attestation-tdx
Documentation/ctlv/families.yaml +1 -0
@@ -16,3 +16,4 @@ families: - ctlv - ctlv-attestation + - ctlv-attestation-tdx
Documentation/ctlv/generated-files.yaml +7 -0
@@ -23,3 +23,10 @@ families: uapi-header: include/uapi/ctlv/ctlv_attestation_gen.h kernel-header: drivers/attestation/generated/ctlv_attestation_gen.h kernel-source: drivers/attestation/generated/ctlv_attestation_gen.c + + - name: ctlv-attestation-tdx + source: Documentation/ctlv/specs/ctlv-attestation-tdx.yaml + outputs: + uapi-header: include/uapi/ctlv/ctlv_attestation_tdx_gen.h + kernel-header: drivers/virt/coco/tdx-guest/ctlv_attestation_tdx_gen.h + kernel-source: drivers/virt/coco/tdx-guest/ctlv_attestation_tdx_gen.c
Documentation/ctlv/specs/ctlv-attestation-tdx.yaml new file +25 -0
@@ -0,0 +1,25 @@ +# SPDX-License-Identifier: ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause) +%YAML 1.2 +--- +# The attestation device of an Intel TDX guest: Quotes of its TDREPORT, the +# CCEL event log, MRTD and RTMR0 to RTMR3. +family: ctlv-attestation-tdx +inherits: ctlv-attestation + +enums: + # Fills ctlv-attestation's evidence-vendor-format. + evidence-vendor-format: + # An Intel TDX DCAP Quote, from the host's quoting enclave. + - quote + # A DICE-based TDX Quote, an EAT in a CBOR Web Token. + - quote-dice + +records: + # Fills ctlv-attestation's device-info. + device-info: + # MRCONFIGID of the TD, the ID of its non-owner configuration. + mrconfigid: binary(48) + # MROWNER of the TD, the ID of its owner. + mrowner: binary(48) + # MROWNERCONFIG of the TD, the ID of its owner's configuration. + mrownerconfig: binary(48)
MAINTAINERS +1 -0
@@ -4442,6 +4442,7 @@ F: Documentation/ctlv/specs/ctlv-attestation* F: Documentation/driver-api/attestation.rst F: Documentation/userspace-api/attestation*.rst F: drivers/attestation/ +F: drivers/virt/coco/tdx-guest/*attestation* F: include/linux/attestation* F: include/uapi/ctlv/ctlv_attestation*
drivers/virt/coco/tdx-guest/ctlv_attestation_tdx_gen.c new file +65 -0
65 lines not on this page · raw message
drivers/virt/coco/tdx-guest/ctlv_attestation_tdx_gen.h new file +44 -0
44 lines not on this page · raw message
include/uapi/ctlv/ctlv_attestation_tdx_gen.h new file +42 -0
42 lines not on this page · raw message
include/uapi/ctlv/ctlv_families_gen.h +1 -0
@@ -13,6 +13,7 @@enum _ctlv_family {CTLV_FAMILY_ROOT =0 ,CTLV_FAMILY_ATTESTATION =1 , +CTLV_FAMILY_ATTESTATION_TDX =2 , };#endif /* _UAPI_CTLV_CTLV_FAMILIES_GEN_H */
Signature · 1 line
2.56.0
Re: [PATCH RFC v2 8/9] attestation: Add the TDX family specification and generated files
Documentation/ctlv/specs/ctlv-attestation-tdx.yaml line 19
Quoted 3 lines · Jiri Pirko
Documentation/ctlv/specs/ctlv-attestation-tdx.yaml new file +3
-0+records: + # Fills ctlv-attestation's device-info. + device-info:
I feel like this should have some more syntax around it, this is not introducing a new record, but it is hooking an extension point set somewhere else. Without knowing about that there is no way to understand what is happening just from this text.
Maybe it should be in an 'extensions' section for more clarity?
I'm also wondering about the symbol namespaces, how does that work?
Like this is in the tdx yaml, so how does it know to look in the attestation yaml for this? Are the names system wide global or just global to all inheriting yamls?
It seems like this could be regreful down the road, maybe names should be fully qualified for extensions:
extensions:
attestation.device-info:
mrconfigid: binary(48)
?
Jason
Re: [PATCH RFC v2 8/9] attestation: Add the TDX family specification and generated files
Quoted 22 lines · Jason Gunthorpe
Documentation/ctlv/specs/ctlv-attestation-tdx.yaml line 19
Quoted 3 lines · Jiri Pirko
Documentation/ctlv/specs/ctlv-attestation-tdx.yaml new file +3
-0+records: + # Fills ctlv-attestation's device-info. + device-info:I feel like this should have some more syntax around it, this is not introducing a new record, but it is hooking an extension point set somewhere else. Without knowing about that there is no way to understand what is happening just from this text.
Maybe it should be in an 'extensions' section for more clarity?
I'm also wondering about the symbol namespaces, how does that work?
Like this is in the tdx yaml, so how does it know to look in the attestation yaml for this? Are the names system wide global or just global to all inheriting yamls?
It seems like this could be regreful down the road, maybe names should be fully qualified for extensions:
Quoted 7 lines
extensions:
attestation.device-info:
mrconfigid: binary(48)?
Jason
One more why that came to mind from this: why yaml? Not for or against; I just have not found out so far where the roots are for that pick.
Br, Jarkko
Re: [PATCH RFC v2 8/9] attestation: Add the TDX family specification and generated files
Wed, Dec 02, 2026 at 10:31:56PM +0100, [email protected] wrote:
[..]
Quoted 3 lines
One more why that came to mind from this: why yaml? Not for or against; I just have not found out so far where the roots are for that pick.
The spec is input to a generator: the uAPI header, the kernel's schema tables, the user library, ctlvctl's tables and the ABI check all come out of it. So it has to be something a tool reads and a reviewer can still read in a patch, with comments. The kernel already writes its netlink specs and DT bindings in YAML, and the tools to check a file against a schema exist. Nothing deeper than that. Looks like the best fit for the job.
Re: [PATCH RFC v2 8/9] attestation: Add the TDX family specification and generated files
Quoted 8 lines · Jiri Pirko
Wed, Dec 02, 2026 at 10:31:56PM +0100, [email protected] wrote:
[..]
Quoted 3 lines
One more why that came to mind from this: why yaml? Not for or against; I just have not found out so far where the roots are for that pick.
Quoted 7 lines
The spec is input to a generator: the uAPI header, the kernel's schema tables, the user library, ctlvctl's tables and the ABI check all come out of it. So it has to be something a tool reads and a reviewer can still read in a patch, with comments. The kernel already writes its netlink specs and DT bindings in YAML, and the tools to check a file against a schema exist. Nothing deeper than that. Looks like the best fit for the job.
Fine by me, thanks for sharing.
Br, Jarkko
Re: [PATCH RFC v2 8/9] attestation: Add the TDX family specification and generated files
In reply to Jason GunthorpeQuoted 19 lines · Wed, Dec 02, 2026 at 09:11:30PM +0100, [email protected] wrote:
Documentation/ctlv/specs/ctlv-attestation-tdx.yaml line 19
Quoted 3 lines · Jiri Pirko
Documentation/ctlv/specs/ctlv-attestation-tdx.yaml new file +3
-0+records: + # Fills ctlv-attestation's device-info. + device-info:I feel like this should have some more syntax around it, this is not introducing a new record, but it is hooking an extension point set somewhere else. Without knowing about that there is no way to understand what is happening just from this text.
Maybe it should be in an 'extensions' section for more clarity?
I'm also wondering about the symbol namespaces, how does that work?
Like this is in the tdx yaml, so how does it know to look in the attestation yaml for this? Are the names system wide global or just global to all inheriting yamls?
Quoted 8 lines
It seems like this could be regreful down the road, maybe names should be fully qualified for extensions:
extensions:
attestation.device-info:
mrconfigid: binary(48)?
Yeah, I was thinking about marking the "extension" somehow as well. I just didn't find any need other than making it obvious to the reader, which may be enough reason at the end :)
Will think about that.
RFC PATCH v2 9/9 attestation: Add the TDX family implementation
In reply to Jiri PirkoFrom: Jiri Pirko <[email protected]>
Build the TDX attestation provider into tdx-guest when attestation is enabled. Expose the Quote, MRTD and RTMR operations through the same helpers as the native interfaces, which stay as they are, and label each Quote as a legacy or a DICE one by its first bytes [1]. Where ACPI describes a CCEL table, also return the firmware's event log as evidence, for a verifier replaying the RTMRs.
[1] https://lore.kernel.org/all/[email protected]/
---RFC->RFCv2:
- built the provider into tdx-guest in place of the attestation-tdx module
- embedded struct attestation_dev in the provider's state
- accounted the evidence buffer to its caller's memcg
- dropped the MR-journal boundary claim from the TDX documentation
- returned the CCEL event log as an event-log evidence object
- dropped the total output length
- documented the provider as part of tdx-guest
- reported the 64-byte challenge length as a list entry
- used the helpers generated for the rewritten spec
- wrote the evidence objects with attestation_evidence_write()
- dropped the RTMR read caps, as every MR can be read
- said record instead of nest, the root being one
- took the UAPI headers from include/uapi/ctlv/
- dropped the TDREPORT evidence object, which /dev/tdx_guest keeps, and labelled each Quote as a legacy or a DICE one
- described the provider for userspace in a document of its own
---
.../userspace-api/attestation-tdx.rst | 59 ++++
Documentation/userspace-api/attestation.rst | 10 +
Documentation/virt/coco/tdx-guest.rst | 8 +
drivers/attestation/Kconfig | 4 +
drivers/virt/coco/tdx-guest/Kconfig | 4 +-
drivers/virt/coco/tdx-guest/Makefile | 6 +
drivers/virt/coco/tdx-guest/attestation.c | 313 ++++++++++++++++++
drivers/virt/coco/tdx-guest/internal.h | 18 +
.../coco/tdx-guest/{tdx-guest.c => main.c} | 7 +
9 files changed, 428 insertions(+), 1 deletion(-)
create mode 100644 Documentation/userspace-api/attestation-tdx.rst
create mode 100644 drivers/virt/coco/tdx-guest/attestation.c
rename drivers/virt/coco/tdx-guest/{tdx-guest.c => main.c} (98%)Documentation/userspace-api/attestation-tdx.rst new file +59 -0
@@ -0,0 +1,59 @@ +.. SPDX-License-Identifier: GPL-2.0 + +=============== +TDX attestation +=============== + +With ``CONFIG_ATTESTATION``, the TDX guest driver registers an attestation +device of the ``ctlv-attestation-tdx`` family, whose specification is +``Documentation/ctlv/specs/ctlv-attestation-tdx.yaml``. Its ``device-info``, +the ``info`` of ``device-get``, carries ``mrconfigid``, ``mrowner`` and +``mrownerconfig``, 48 bytes each. + +Measurement registers +===================== + +== ===== ============== ======= ====== +ID Name Register index Bank Extend +== ===== ============== ======= ====== +0 mrtd none SHA-384 no +1 rtmr0 0 SHA-384 yes +2 rtmr1 1 SHA-384 yes +3 rtmr2 2 SHA-384 yes +4 rtmr3 3 SHA-384 yes +== ===== ============== ======= ====== + +Each ``mr-read`` takes a TDREPORT. + +The TSM-MR files, +``/sys/devices/virtual/misc/tdx_guest/measurements/rtmr[0123]:sha384``, extend +the same RTMRs as ``mr-extend``. Firmware and the boot loader usually extend +RTMR0 to RTMR2 before the kernel starts, which leaves RTMR3 to the running +system. + +Evidence +======== + +== ======== ========= ================= ========= ======== +ID Object Class Formats Challenge Binds +== ======== ========= ================= ========= ======== +0 Quote signed quote, quote-dice 64 bytes every MR +1 CCEL log event-log ccel none no MR +== ======== ========= ================= ========= ======== + +The challenge goes into the REPORTDATA the Quote carries. The host's quoting +service returns a DCAP Quote or a DICE-based one, and the device names it +``quote`` by its header's version and TEE type, or ``quote-dice`` by the CBOR +magic it starts with. Both are ``ctlv-attestation-tdx``'s vendor formats. A +Quote of neither fails ``evidence-get`` with ``EPROTO``. + +The log is there where the firmware describes its CC event log with an ACPI +CCEL table, and is the whole log area. It does not change after boot, and one +call returns it with the Quote. + +The TDREPORT is MAC'd for the platform, not signed, so it is no object; +``TDX_CMD_GET_REPORT0`` of ``/dev/tdx_guest`` returns it. + +A guest has one TDX device, which a udev rule can give a stable name:: + + ENV{CTLV_FAMILY}=="ctlv-attestation-tdx", SYMLINK+="attestation/tdx"
Documentation/userspace-api/attestation.rst +10 -0
@@ -282,3 +282,13 @@ The reply carries ``mr-generation``, the MR generation after the extension. have or repeats one, or a digest has the wrong length. Access is read-write. + +Providers +========= + +What each provider's family adds, and what its device produces: + +.. toctree:: + :maxdepth: 1 + + attestation-tdx
Documentation/virt/coco/tdx-guest.rst +8 -0
@@ -50,3 +50,11 @@ TDX reference material is collected here: https://www.intel.com/content/www/us/en/developer/articles/technical/intel-trust-domain-extensions.html The driver is based on TDX module specification v1.0 and TDX GHCI specification v1.0. + +Attestation device +================== + +With ``CONFIG_ATTESTATION``, the driver also registers an attestation device, +described in Documentation/userspace-api/attestation-tdx.rst. It shares the +TDREPORT, Quote and RTMR paths, and their locks, with the misc ioctl, the +TSM-report configfs interface and the TSM-MR sysfs attributes.
drivers/attestation/Kconfig +4 -0
@@ -10,3 +10,7 @@ menuconfig ATTESTATION translate the common operations to their native service. If you are unsure, say N. + +if ATTESTATION + +endif # ATTESTATION
drivers/virt/coco/tdx-guest/Kconfig +3 -1
@@ -1,12 +1,14 @@ config TDX_GUEST_DRIVER tristate "TDX Guest driver" depends on INTEL_TDX_GUEST + depends on ATTESTATION || !ATTESTATION select TSM_REPORTS select TSM_MEASUREMENTS help The driver provides userspace interface to communicate with the TDX module to request the TDX guest details like attestation - report. + report. With ATTESTATION, it also registers a TDX attestation + device. To compile this driver as module, choose M here. The module will be called tdx-guest.
drivers/virt/coco/tdx-guest/Makefile +6 -0
@@ -1,2 +1,8 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_TDX_GUEST_DRIVER) += tdx-guest.o + +tdx-guest-y := main.o +tdx-guest-$(CONFIG_ATTESTATION) += attestation.o ctlv_attestation_tdx_gen.o + +# The generated family header includes its parent's. +ccflags-y += -I $(srctree)/drivers/attestation/generated
drivers/virt/coco/tdx-guest/attestation.c new file +313 -0
313 lines not on this page · raw message
drivers/virt/coco/tdx-guest/internal.h +18 -0
@@ -5,6 +5,8 @@#include <crypto/sha2.h> #include <linux/types.h> +struct device ; +#define TDX_GUEST_QUOTE_MAX_LEN ((128 * 1024) - 24)struct tdx_guest_info {
@@ -27,4 +29,20 @@ int tdx_guest_mr_read(enum tdx_guest_mr mr, u8 value[SHA384_DIGEST_SIZE]);int tdx_guest_rtmr_extend (unsigned int rtmr,const u8 value[SHA384_DIGEST_SIZE ]); +#if IS_ENABLED (CONFIG_ATTESTATION ) +int tdx_attestation_register (struct device *parent, +const struct tdx_guest_info *info); +void tdx_attestation_unregister (void ); +#else +static inline int tdx_attestation_register (struct device *parent, +const struct tdx_guest_info *info) +{ +return 0 ; +} + +static inline void tdx_attestation_unregister (void ) +{ +} +#endif +#endif /* _TDX_GUEST_INTERNAL_H */
drivers/virt/coco/tdx-guest/main.c renamed from drivers/virt/coco/tdx-guest/tdx-guest.c +7 -0
@@ -522,6 +522,12 @@ static int __init tdx_guest_init(void)if (ret) goto free_quote; +/* The other interfaces stay up without the attestation device. */ + ret =tdx_attestation_register (tdx_misc_dev.this_device, + &tdx_guest_info); +if (ret) +pr_warn ("attestation device registration failed: %d\n" , ret); +return 0 ; free_quote:
@@ -537,6 +543,7 @@ module_init(tdx_guest_init); static void __exit tdx_guest_exit(void) { +tdx_attestation_unregister ();tsm_report_unregister (&tdx_tsm_ops);free_quote_buf (quote_buf);misc_deregister (&tdx_misc_dev);
Signature · 1 line
2.56.0
Re: [PATCH RFC v2 9/9] attestation: Add the TDX family implementation
Hi Jiri,
[...]
Quoted 10 lines
drivers/virt/coco/tdx-guest/attestation.c new file +10
-0+static void __iomem *tdx_attestation_log_map (size_t *length) +{ +struct acpi_table_header *header; +struct acpi_table_ccel *ccel; +void __iomem *log =NULL ; + +if (ACPI_FAILURE (acpi_get_table (ACPI_SIG_CCEL ,0 , &header))) +return NULL ; + ccel = container_of(header, struct acpi_table_ccel, header); + if (header->length >= sizeof(*ccel) && ccel->log_area_start_address &&
drivers/virt/coco/tdx-guest/attestation.c line 162
Quoted 10 lines
drivers/virt/coco/tdx-guest/attestation.c new file +10
-0+ ccel->log_area_minimum_length && + ccel->log_area_minimum_length <= UINT_MAX) + log =acpi_os_map_iomem (ccel->log_area_start_address, + ccel->log_area_minimum_length); +if (log) + *length = ccel->log_area_minimum_length; +acpi_put_table (header); +return log; +} +
I think we don't need to dump log area with the log_area_minimum_length since the area would include none-event otherwise, pre-exist tool (i.e. tpm2_eventlog) reports error for them like:
...
- EventNum: 21
PCRIndex: 2
EventType: EV_EFI_ACTION
DigestCount: 1
Digests:
- AlgorithmId: sha256
Digest: "b54f7542cbd872a81a9d9dea839b2b8d747c7ebd5ea6615c40f42f44a6dbeba0"
EventSize: 40
Event: |-
Exit Boot Services Returned with Success
ERROR: corrupted log, insufficient size for event header: 3
ERROR: failed to parse tpm2 eventlog
ERROR: Unable to run tpm2_eventlog
So, what about export *real size* of eventlog like tpm2_calc_event_log_size()?
Otherwise, look good to me.
[...]
Thanks!
Signature · 2 lines
Sincerely, Yeoreum Yun
Re: [PATCH RFC v2 9/9] attestation: Add the TDX family implementation
Quoted 45 lines · Yeoreum Yun
Hi Jiri,
[...]
Quoted 10 lines
drivers/virt/coco/tdx-guest/attestation.c new file +10
-0+static void __iomem *tdx_attestation_log_map (size_t *length) +{ +struct acpi_table_header *header; +struct acpi_table_ccel *ccel; +void __iomem *log =NULL ; + +if (ACPI_FAILURE (acpi_get_table (ACPI_SIG_CCEL ,0 , &header))) +return NULL ; + ccel = container_of(header, struct acpi_table_ccel, header); + if (header->length >= sizeof(*ccel) && ccel->log_area_start_address &&drivers/virt/coco/tdx-guest/attestation.c line 162
Quoted 10 lines
drivers/virt/coco/tdx-guest/attestation.c new file +10
-0+ ccel->log_area_minimum_length && + ccel->log_area_minimum_length <= UINT_MAX) + log =acpi_os_map_iomem (ccel->log_area_start_address, + ccel->log_area_minimum_length); +if (log) + *length = ccel->log_area_minimum_length; +acpi_put_table (header); +return log; +} +I think we don't need to dump log area with the
log_area_minimum_lengthsince the area would include none-event otherwise, pre-exist tool (i.e.tpm2_eventlog) reports error for them like:...
- EventNum: 21
PCRIndex: 2
EventType:EV_EFI_ACTION
DigestCount: 1
Digests:
- AlgorithmId: sha256
Digest: "b54f7542cbd872a81a9d9dea839b2b8d747c7ebd5ea6615c40f42f44a6dbeba0"
EventSize: 40
Event: |-
Exit Boot Services Returned with Success
ERROR: corrupted log, insufficient size for event header: 3
ERROR: failed to parse tpm2 eventlog
ERROR: Unable to runtpm2_eventlog
Quoted 2 lines
So, what about export *real size* of eventlog like
tpm2_calc_event_log_size()?
Nothing in the patch (neither commit message nor any comment in code) says that TDX attestion registers share the same format as TPM2 even log.
I was just trying to understand where does this derive from but since there is no reference, I'm confused.
As per the function, perhaps tpm2_calc_event_log_size() should be relocated to lib and have non-TPM name like firmware_event_log_size() or something.
Quoted 12 lines
Otherwise, look good to me.
[...]
Thanks!
Signature · 2 lines
Sincerely, Yeoreum Yun
Br, Jarkko
Re: [PATCH RFC v2 9/9] attestation: Add the TDX family implementation
Quoted 46 lines · Jarkko Sakkinen
Quoted 45 lines · Yeoreum Yun
Hi Jiri,
[...]
Quoted 10 lines
drivers/virt/coco/tdx-guest/attestation.c new file +10
-0+static void __iomem *tdx_attestation_log_map (size_t *length) +{ +struct acpi_table_header *header; +struct acpi_table_ccel *ccel; +void __iomem *log =NULL ; + +if (ACPI_FAILURE (acpi_get_table (ACPI_SIG_CCEL ,0 , &header))) +return NULL ; + ccel = container_of(header, struct acpi_table_ccel, header); + if (header->length >= sizeof(*ccel) && ccel->log_area_start_address &&drivers/virt/coco/tdx-guest/attestation.c line 162
Quoted 10 lines
drivers/virt/coco/tdx-guest/attestation.c new file +10
-0+ ccel->log_area_minimum_length && + ccel->log_area_minimum_length <= UINT_MAX) + log =acpi_os_map_iomem (ccel->log_area_start_address, + ccel->log_area_minimum_length); +if (log) + *length = ccel->log_area_minimum_length; +acpi_put_table (header); +return log; +} +I think we don't need to dump log area with the
log_area_minimum_lengthsince the area would include none-event otherwise, pre-exist tool (i.e.tpm2_eventlog) reports error for them like:...
- EventNum: 21
PCRIndex: 2
EventType:EV_EFI_ACTION
DigestCount: 1
Digests:
- AlgorithmId: sha256
Digest: "b54f7542cbd872a81a9d9dea839b2b8d747c7ebd5ea6615c40f42f44a6dbeba0"
EventSize: 40
Event: |-
Exit Boot Services Returned with Success
ERROR: corrupted log, insufficient size for event header: 3
ERROR: failed to parse tpm2 eventlog
ERROR: Unable to runtpm2_eventlog
Quoted 6 lines
Quoted 2 lines
So, what about export *real size* of eventlog like
tpm2_calc_event_log_size()?Nothing in the patch (neither commit message nor any comment in code) says that TDX attestion registers share the same format as TPM2 even log.
It comes from the UEFI spec's definition of CCEL:
38.1 Virtual Platform CC Event Log
If a virtual firmware with confidential computing (CC) capability supports measurement and an event is created, virtual firmware should report the event log with the same data structure in TCG Platform Firmware Profile (PFP) specification with EFI_TCG2_EVENT_LOG_FORMAT_TCG_2 format. The index created by the virtual firmware in the event log should be the index for the confidential computing (CC) measurement register. It is CC vendor specific.
It makes sense that the kernel would size it correctly.
Quoted 3 lines
As per the function, perhaps
tpm2_calc_event_log_size()should be relocated to lib and have non-TPM name likefirmware_event_log_size()or something.
Probably under drivers/attestation since that is where all the TCG formatted logs should end up. It should be 'tcg_event_log_size()' or something. Maybe a tiny module for it like we would have done in lib/
Jason
Re: [PATCH RFC v2 9/9] attestation: Add the TDX family implementation
Quoted 69 lines · Jason Gunthorpe
Quoted 46 lines · Jarkko Sakkinen
Quoted 45 lines · Yeoreum Yun
Hi Jiri,
[...]
Quoted 10 lines
drivers/virt/coco/tdx-guest/attestation.c new file +10
-0+static void __iomem *tdx_attestation_log_map (size_t *length) +{ +struct acpi_table_header *header; +struct acpi_table_ccel *ccel; +void __iomem *log =NULL ; + +if (ACPI_FAILURE (acpi_get_table (ACPI_SIG_CCEL ,0 , &header))) +return NULL ; + ccel = container_of(header, struct acpi_table_ccel, header); + if (header->length >= sizeof(*ccel) && ccel->log_area_start_address &&drivers/virt/coco/tdx-guest/attestation.c line 162
Quoted 10 lines
drivers/virt/coco/tdx-guest/attestation.c new file +10
-0+ ccel->log_area_minimum_length && + ccel->log_area_minimum_length <= UINT_MAX) + log =acpi_os_map_iomem (ccel->log_area_start_address, + ccel->log_area_minimum_length); +if (log) + *length = ccel->log_area_minimum_length; +acpi_put_table (header); +return log; +} +I think we don't need to dump log area with the
log_area_minimum_lengthsince the area would include none-event otherwise, pre-exist tool (i.e.tpm2_eventlog) reports error for them like:...
- EventNum: 21
PCRIndex: 2
EventType:EV_EFI_ACTION
DigestCount: 1
Digests:
- AlgorithmId: sha256
Digest: "b54f7542cbd872a81a9d9dea839b2b8d747c7ebd5ea6615c40f42f44a6dbeba0"
EventSize: 40
Event: |-
Exit Boot Services Returned with Success
ERROR: corrupted log, insufficient size for event header: 3
ERROR: failed to parse tpm2 eventlog
ERROR: Unable to runtpm2_eventlogQuoted 6 lines
Quoted 2 lines
So, what about export *real size* of eventlog like
tpm2_calc_event_log_size()?Nothing in the patch (neither commit message nor any comment in code) says that TDX attestion registers share the same format as TPM2 even log.
It comes from the UEFI spec's definition of CCEL:
38.1 Virtual Platform CC Event Log
If a virtual firmware with confidential computing (CC) capability supports measurement and an event is created, virtual firmware should report the event log with the same data structure in TCG Platform Firmware Profile (PFP) specification with
EFI_TCG2_EVENT_LOG_FORMAT_TCG_2format. The index created by the virtual firmware in the event log should be the index for the confidential computing (CC) measurement register. It is CC vendor specific.It makes sense that the kernel would size it correctly.
Quoted 7 lines
Quoted 3 lines
As per the function, perhaps
tpm2_calc_event_log_size()should be relocated to lib and have non-TPM name likefirmware_event_log_size()or something.Probably under
drivers/attestationsince that is where all the TCG formatted logs should end up. It should be 'tcg_event_log_size()' or something. Maybe a tiny module for it like we would have done inlib/
+1 for the name, as it is obviously more accurate prefix.
Quoted 2 lines
Jason
Br, Jarkko
Re: [PATCH RFC v2 9/9] attestation: Add the TDX family implementation
Quoted 74 lines · Jarkko Sakkinen
Quoted 73 lines · Jason Gunthorpe
Quoted 46 lines · Jarkko Sakkinen
Quoted 45 lines · Yeoreum Yun
Hi Jiri,
[...]
Quoted 10 lines
drivers/virt/coco/tdx-guest/attestation.c new file +10
-0+static void __iomem *tdx_attestation_log_map (size_t *length) +{ +struct acpi_table_header *header; +struct acpi_table_ccel *ccel; +void __iomem *log =NULL ; + +if (ACPI_FAILURE (acpi_get_table (ACPI_SIG_CCEL ,0 , &header))) +return NULL ; + ccel = container_of(header, struct acpi_table_ccel, header); + if (header->length >= sizeof(*ccel) && ccel->log_area_start_address &&drivers/virt/coco/tdx-guest/attestation.c line 162
Quoted 10 lines
drivers/virt/coco/tdx-guest/attestation.c new file +10
-0+ ccel->log_area_minimum_length && + ccel->log_area_minimum_length <= UINT_MAX) + log =acpi_os_map_iomem (ccel->log_area_start_address, + ccel->log_area_minimum_length); +if (log) + *length = ccel->log_area_minimum_length; +acpi_put_table (header); +return log; +} +I think we don't need to dump log area with the
log_area_minimum_lengthsince the area would include none-event otherwise, pre-exist tool (i.e.tpm2_eventlog) reports error for them like:...
- EventNum: 21
PCRIndex: 2
EventType:EV_EFI_ACTION
DigestCount: 1
Digests:
- AlgorithmId: sha256
Digest: "b54f7542cbd872a81a9d9dea839b2b8d747c7ebd5ea6615c40f42f44a6dbeba0"
EventSize: 40
Event: |-
Exit Boot Services Returned with Success
ERROR: corrupted log, insufficient size for event header: 3
ERROR: failed to parse tpm2 eventlog
ERROR: Unable to runtpm2_eventlogQuoted 6 lines
Quoted 2 lines
So, what about export *real size* of eventlog like
tpm2_calc_event_log_size()?Nothing in the patch (neither commit message nor any comment in code) says that TDX attestion registers share the same format as TPM2 even log.
It comes from the UEFI spec's definition of CCEL:
38.1 Virtual Platform CC Event Log
If a virtual firmware with confidential computing (CC) capability supports measurement and an event is created, virtual firmware should report the event log with the same data structure in TCG Platform Firmware Profile (PFP) specification with
EFI_TCG2_EVENT_LOG_FORMAT_TCG_2format. The index created by the virtual firmware in the event log should be the index for the confidential computing (CC) measurement register. It is CC vendor specific.It makes sense that the kernel would size it correctly.
Quoted 3 lines
As per the function, perhaps
tpm2_calc_event_log_size()should be relocated to lib and have non-TPM name likefirmware_event_log_size()or something.
Quoted 5 lines
Quoted 3 lines
Probably under
drivers/attestationsince that is where all the TCG formatted logs should end up. It should be 'tcg_event_log_size()' or something. Maybe a tiny module for it like we would have done inlib/+1 for the name, as it is obviously more accurate prefix.
Location, I don't know. I was thinking something like "lib/tcg.c" with routines that are plain calculations based on TCG/TPM data. And perhaps for tpm_buf (both stack/heap allocatable), if Trenchboot ever moves forward.
Br, Jarkko
Re: [PATCH RFC v2 9/9] attestation: Add the TDX family implementation
Quoted 4 lines · Jarkko Sakkinen
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
As per the function, perhaps
tpm2_calc_event_log_size()should be relocated to lib and have non-TPM name likefirmware_event_log_size()or something.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Probably under
drivers/attestationsince that is where all the TCG formatted logs should end up. It should be 'tcg_event_log_size()' or something. Maybe a tiny module for it like we would have done inlib/+1 for the name, as it is obviously more accurate prefix.
Location, I don't know. I was thinking something like "
lib/tcg.c" with routines that are plain calculations based on TCG/TPM data.
I think we should not have new users outside attestation subsystem, but the legacy onces will still exist obviously..
IDK either, but this is my guess..
Quoted 2 lines
And perhaps for
tpm_buf(both stack/heap allocatable), if Trenchboot ever moves forward.
DRTM users will route through attestation subsystem to do their extends so the tpm_buf user would be the TPM driver inside attestation. We definitely need this for ROT agility.
We should be able to build the attestation TPM driver without any trenchboot stuff to motivate it.
Jason
Re: [PATCH RFC v2 9/9] attestation: Add the TDX family implementation
Quoted 11 lines · Jason Gunthorpe
Quoted 10 lines · Jarkko Sakkinen
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines
As per the function, perhaps
tpm2_calc_event_log_size()should be relocated to lib and have non-TPM name likefirmware_event_log_size()or something.Probably under
drivers/attestationsince that is where all the TCG formatted logs should end up. It should be 'tcg_event_log_size()' or something. Maybe a tiny module for it like we would have done inlib/+1 for the name, as it is obviously more accurate prefix.
Quoted 7 lines
Quoted 2 lines
Location, I don't know. I was thinking something like "
lib/tcg.c" with routines that are plain calculations based on TCG/TPM data.I think we should not have new users outside attestation subsystem, but the legacy onces will still exist obviously..
IDK either, but this is my guess..
No strong opinions on this; just unpurging my thoughts.
Quoted 10 lines
Quoted 3 lines
And perhaps for
tpm_buf(both stack/heap allocatable), if Trenchboot ever moves forward.DRTM users will route through attestation subsystem to do their extends so the
tpm_bufuser would be the TPM driver inside attestation. We definitely need this for ROT agility.We should be able to build the attestation TPM driver without any trenchboot stuff to motivate it.
OK, this was my guess but did not know it by fact.
Quoted 2 lines
Jason
Br, Jarkko
Re: [PATCH RFC v2 9/9] attestation: Add the TDX family implementation
Quoted 15 lines · Mon, Nov 23, 2026 at 04:42:48PM +0100, [email protected] wrote:
Quoted 14 lines · Jason Gunthorpe
Quoted 12 lines · Jarkko Sakkinen
Quoted 9 lines
Quoted 7 lines
Quoted 3 lines
As per the function, perhaps
tpm2_calc_event_log_size()should be relocated to lib and have non-TPM name likefirmware_event_log_size()or something.Probably under
drivers/attestationsince that is where all the TCG formatted logs should end up. It should be 'tcg_event_log_size()' or something. Maybe a tiny module for it like we would have done inlib/+1 for the name, as it is obviously more accurate prefix.
Location, I don't know. I was thinking something like "
lib/tcg.c" with routines that are plain calculations based on TCG/TPM data.
Quoted 6 lines
Quoted 4 lines
I think we should not have new users outside attestation subsystem, but the legacy onces will still exist obviously..
IDK either, but this is my guess..
No strong opinions on this; just unpurging my thoughts.
Okay, will put have this in a helper lib.
Quoted 19 lines
Quoted 11 lines
Quoted 4 lines
And perhaps for
tpm_buf(both stack/heap allocatable), if Trenchboot ever moves forward.DRTM users will route through attestation subsystem to do their extends so the
tpm_bufuser would be the TPM driver inside attestation. We definitely need this for ROT agility.We should be able to build the attestation TPM driver without any trenchboot stuff to motivate it.
OK, this was my guess but did not know it by fact.
Quoted 2 lines
Jason
Br, Jarkko