From: "Aneesh Kumar K.V (Arm)" <aneesh.kumar@kernel.org>
To: linux-coco@lists.linux.dev
Cc: "Aneesh Kumar K.V (Arm)" <aneesh.kumar@kernel.org>,
Jiri Pirko <jiri@resnulli.us>, Kevin Tian <kevin.tian@intel.com>,
Alexey Kardashevskiy <aik@amd.com>,
Xu Yilun <yilun.xu@linux.intel.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Steven Price <steven.price@arm.com>,
Kiryl Shutsemau <kas@kernel.org>,
Rick Edgecombe <rick.p.edgecombe@intel.com>,
Dave Hansen <dave.hansen@linux.intel.com>,
Jonathan Cameron <jic23@kernel.org>,
Jason Gunthorpe <jgg@nvidia.com>,
Bjorn Helgaas <bhelgaas@google.com>,
Ashish Kalra <ashish.kalra@amd.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
John Allen <john.allen@amd.com>, Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
patches@lists.linux.dev
Subject: [RFC PATCH v1 02/11] attestation: Filter evidence objects per instance
Date: Wed, 28 Oct 2026 20:56:09 +0530 [thread overview]
Message-ID: <20261028152618.1356860-3-aneesh.kumar@kernel.org> (raw)
In-Reply-To: <20261028152618.1356860-1-aneesh.kumar@kernel.org>
Allow an attestation instance to expose only the evidence objects its
device supports. Add an optional evidence_object_supported() callback
and use it both when building DEVICE_GET capabilities and when checking
EVIDENCE_GET requests.
The following PCI/TSM patch uses one attestation implementation for
devices that support different evidence objects. Its list includes
certificate slots 0-7, SPDM VCA, measurements, and a TDISP interface
report. Each device must expose only the objects it supports, for
example:
Instance Supported evidence objects
------------------------ ------------------------------------------
Host link using slot zero Certificate slot 0
CCA guest device Certificate slot 0, VCA, measurements,
TDISP interface report
Host PF0 after discovery Certificate slots reported populated by SPDM
PCI/TSM checks the TSM driver's evidence_types bitmap or, after SPDM
discovery on a host PF0, the populated-slot bitmap. The preceding patch
controls whether EVIDENCE_GET is enabled; this patch controls which
objects that operation can retrieve.
Cc: Jiri Pirko <jiri@resnulli.us>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Aneesh Kumar K.V (Arm) <aneesh.kumar@kernel.org>
---
drivers/attestation/core/core.c | 8 ++++++--
drivers/attestation/core/ctlv.c | 13 +++++++++++--
include/linux/attestation.h | 4 ++++
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/drivers/attestation/core/core.c b/drivers/attestation/core/core.c
index 41fe1084c989..37d5d3233cf0 100644
--- a/drivers/attestation/core/core.c
+++ b/drivers/attestation/core/core.c
@@ -54,8 +54,12 @@ static int attestation_evidence_caps_validate(const struct attestation_provider
const struct attestation_evidence_caps *caps = provider->evidence_caps;
size_t object_index;
- if (!caps)
- return provider->evidence_get ? -EINVAL : 0;
+ if (!caps) {
+ if (provider->evidence_get || provider->evidence_object_supported)
+ return -EINVAL;
+ return 0;
+ }
+
if (!provider->evidence_get || !caps->objects || !caps->objects_count ||
caps->objects_count > 16 || caps->min_challenge_length > caps->max_challenge_length ||
caps->max_challenge_length > 4096 || !caps->max_total_output_length)
diff --git a/drivers/attestation/core/ctlv.c b/drivers/attestation/core/ctlv.c
index 8f4fa48ffdc5..baf9c39f2658 100644
--- a/drivers/attestation/core/ctlv.c
+++ b/drivers/attestation/core/ctlv.c
@@ -33,15 +33,20 @@ attestation_representation_in(const struct attestation_evidence_supported_object
}
static const struct attestation_evidence_supported_object *
-attestation_evidence_object_find(const struct attestation_evidence_caps *caps,
+attestation_evidence_object_find(struct attestation *att,
enum attestation_evidence_blob_class blob_class, bool has_instance,
unsigned int instance, const char *format)
{
+ const struct attestation_evidence_caps *caps = att->provider->evidence_caps;
size_t index;
for (index = 0; index < caps->objects_count; index++) {
const struct attestation_evidence_supported_object *object = &caps->objects[index];
+ if (att->provider->evidence_object_supported &&
+ !att->provider->evidence_object_supported(att, object))
+ continue;
+
if (object->blob_class == blob_class && object->has_blob_instance == has_instance &&
(!has_instance || object->blob_instance == instance) &&
!strcmp(object->format, format))
@@ -85,6 +90,10 @@ static int attestation_device_caps_put(struct attestation *att, struct ctlv_curs
const struct attestation_evidence_supported_object *cap =
&caps->objects[index];
+ if (provider->evidence_object_supported &&
+ !provider->evidence_object_supported(att, cap))
+ continue;
+
if (!ctlv_attestation_cap_object_start(&group, &object)) {
ok = false;
break;
@@ -184,7 +193,7 @@ attestation_evidence_decode_objects(struct attestation *att, struct ctlv_op_ctx
if (has_instance)
instance = ctlv_attestation_evidence_get_object_evidence_blob_instance_get(
&object);
- supported = attestation_evidence_object_find(caps, blob_class, has_instance,
+ supported = attestation_evidence_object_find(att, blob_class, has_instance,
instance, format);
if (!supported || !attestation_representation_in(supported, representation)) {
kfree(objects);
diff --git a/include/linux/attestation.h b/include/linux/attestation.h
index dede1b53f67a..364ab5029277 100644
--- a/include/linux/attestation.h
+++ b/include/linux/attestation.h
@@ -233,6 +233,8 @@ struct attestation_evidence_result {
/**
* struct attestation_provider - Immutable provider operations and properties.
+ * @evidence_object_supported: optionally restrict advertised and requested
+ * evidence objects per instance; called under the instance lock
* @evidence_get: produce requested evidence
* @evidence_accept: record acceptance of the current evidence
* @evidence_accept_clear: clear a recorded acceptance
@@ -247,6 +249,8 @@ struct attestation_evidence_result {
* @mrs_count: number of fixed MRs
*/
struct attestation_provider {
+ bool (*evidence_object_supported)(struct attestation *att,
+ const struct attestation_evidence_supported_object *object);
int (*evidence_get)(struct attestation *att,
const struct attestation_evidence_request *request,
struct attestation_evidence_result *result);
--
2.43.0
next prev parent reply other threads:[~2026-10-28 15:26 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 15:26 [RFC PATCH v1 00/11] PCI/TSM: Add CTLV attestation Aneesh Kumar K.V (Arm)
2026-10-28 15:26 ` [RFC PATCH v1 01/11] attestation: Restrict inherited operations per instance Aneesh Kumar K.V (Arm)
2026-10-28 15:26 ` Aneesh Kumar K.V (Arm) [this message]
2026-10-28 15:26 ` [RFC PATCH v1 03/11] attestation: Enter secure operation when evidence is accepted Aneesh Kumar K.V (Arm)
2026-10-28 15:26 ` [RFC PATCH v1 04/11] attestation: Bind object selection to accepted evidence snapshots Aneesh Kumar K.V (Arm)
2026-10-28 15:26 ` [RFC PATCH v1 05/11] attestation: Make the evidence-get challenge attribute optional Aneesh Kumar K.V (Arm)
2026-10-28 15:26 ` [RFC PATCH v1 06/11] PCI/TSM: Describe the PCI attestation control family Aneesh Kumar K.V (Arm)
2026-10-28 15:26 ` [RFC PATCH v1 07/11] attestation: Add attestation helpers for PCI/TSM integration Aneesh Kumar K.V (Arm)
2026-10-28 15:26 ` [RFC PATCH v1 08/11] PCI/TSM: Bind CTLV attestation to connected and locked contexts Aneesh Kumar K.V (Arm)
2026-10-28 22:56 ` Dave Jiang
2026-10-28 15:26 ` [RFC PATCH v1 09/11] crypto/ccp: Defer SEV-TIO link setup until evidence acceptance Aneesh Kumar K.V (Arm)
2026-10-28 15:26 ` [RFC PATCH v1 10/11] virt: coco: arm-cca-host: Publish slot zero and establish streams after acceptance Aneesh Kumar K.V (Arm)
2026-10-28 15:26 ` [RFC PATCH v1 11/11] virt: coco: arm-cca-guest: Refresh selected evidence against trusted digests Aneesh Kumar K.V (Arm)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261028152618.1356860-3-aneesh.kumar@kernel.org \
--to=aneesh.kumar@kernel.org \
--cc=aik@amd.com \
--cc=ashish.kalra@amd.com \
--cc=bhelgaas@google.com \
--cc=catalin.marinas@arm.com \
--cc=dave.hansen@linux.intel.com \
--cc=jgg@nvidia.com \
--cc=jic23@kernel.org \
--cc=jiri@resnulli.us \
--cc=john.allen@amd.com \
--cc=kas@kernel.org \
--cc=kevin.tian@intel.com \
--cc=linux-coco@lists.linux.dev \
--cc=mark.rutland@arm.com \
--cc=patches@lists.linux.dev \
--cc=rick.p.edgecombe@intel.com \
--cc=steven.price@arm.com \
--cc=suzuki.poulose@arm.com \
--cc=thomas.lendacky@amd.com \
--cc=will@kernel.org \
--cc=yilun.xu@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox