Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.180 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795799245; b=TvP+zJ5ugESc60o7XbBtic+G13xoPr0QTgMEW3bG1HuyCWiRyIeg58xrXJ4/nLdf3s1l w++8ZNdZ9ZTei7QN+g1OhTaVB0nUSxbUCh08wf/r5TKcO9VbW0s2rqE/RY2Ox+5KOdwO6 /uJzTVpp3d3KBfNhHwV82hPPdtghmg6jTvxNfkOREFNX2vUtuH9kfGjeNFVLKY53MohKz dT+MyDUYUN804WEfdUnkCwbABbfxXD7M1KDkOUuHq2OZ8i1AewjCI8L4KY+6C7I3Nymcy T+S6zh1tMw14S9vMWbl7zOh6Iz+/XbAaUXgvTWtefgn7H2miv7UNQqW/V6qvnK2DmPg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795799245; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Received:Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=iIDdrX9Im0YtrcnZJ8KtkgD4n/tK93wVoTEyhvvYAHU=; b=NXz7eP2chs4vpriJj/656fXJCA3hWvALxFQ2UDC9zMTj609qZT4hJrNao9/pi1071p8S fo+hmkjj5NNeBdXhxKDPn4JzdmP2E7XR2qkdGD5o5ApdGeloOXZc+pieQVIQ9wu9ZdRcs A2sukrwOgZYUJ5xGX4eX9CYBIpeT3yfTF/1595zNevi19lzQTY2912ilk7jPAs12SI0b/ jjgORTctexMzXULnLPLa0T7ba32ewV+p7HJryVVauDaGaLC90UfrUcT5mW1HopH+VR/BR dqTMDGFNPwwlyYhLw1kFpdFu3TXlTjJxO3LjZX3omTvvw5ZSmf/+jWuaXTabluJu3tw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass header.d=ziepe.ca header.i=@ziepe.ca header.a=rsa-sha256 header.s=google header.b=Nc94OCF6; arc=none smtp.remote-ip=209.85.160.180 Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B3F9E606A32D for ; Fri, 27 Nov 2026 17:07:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B3F9E606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.a=rsa-sha256 header.s=google header.b=Nc94OCF6 Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-53639b8903bso99128611cf.0 for ; Fri, 27 Nov 2026 09:07:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1795799243; x=1796404043; darn=lists.linux.dev; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=iIDdrX9Im0YtrcnZJ8KtkgD4n/tK93wVoTEyhvvYAHU=; b=Nc94OCF6IzXQx71MEx39xDK9fcbQvIUeG35l1ofEFko/Wdr0P9OOmmX5GW2Kb4vRCi Kj+gWGbg06kSr83tG2XHyfkj7vdTcc7VbhKugWKOeDx7yMFWDlQbjIXlOq9kqievuQ6v 4yFVMO78SeT+K4s02B6N8rwyx9UeQ9ikqF2ErfVQkZIB4HFIuxSyKvrU2kOUm2s5YSkz vbf5vY0RG5QArxkXBiCtsUuxn2Cr6hL+Wu19NKN9Et8hiUwyimiRSIQO0nUYNLA0tQY/ 4MR8NI6xBy45mTAi9glA/9W3w/s1gJ82QZ4UH/9asSBGRNzcCnS8lCG5fGwOAi1rNwTJ 7/2g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1795799243; x=1796404043; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=iIDdrX9Im0YtrcnZJ8KtkgD4n/tK93wVoTEyhvvYAHU=; b=VEQobpTtln0w4TbVpO9qB9JYm6+ixVvWlBOZjf190f66UKdYOeEyQyj2+XrIOxdVr4 Mx9q3DyOG11doxHzXP1tj6DxCwUQY0alC5PjD+GJuwWf4hGnvHKc3FlXHksQgdIMPOBT tZ7XRAPGyItM+HW4Bp1YUmLr6r4bngONlIShvsGd66iubOUKUkelsdHtEEPisBVIhWq3 zyZ8KzFSWcmu09DpCnaUR3a46GP1xD3UhP4lrGOvnjXhsK5A83H64z3ptGwR9rFBtw+g BxCzwm1YLukxxFFllcLUE8wxbCRI/vcniRJa7ks6DF/QpbIXXz7NYiEmMK+JeyTvKG2D zn/A== X-Forwarded-Encrypted: i=1; AL+hErHR0xwhDvyKMxW7igwvXmRi254YwNoPThpwdjOQPDL1CB1FfMapbgAkXSRfrY6KJwBRJxoueykLHcDlFZ0=@lists.linux.dev X-Gm-Message-State: APuU4Z/D1Z+ZWsQ+dFtf1Vr+KXnV3q/6mWc1W6ETUzlqdo6MdUGNDM+L xuKfYbaqhf29oobxAo/vVbCRLU7+KTBsSIDyO0eMiCDS+urVOGizifRebdWKwNl8cUk= X-Gm-Gg: AZFdTZcysMV2f+H2OsFN52jbj/0+qhZfaU527sSc1dzoT5PuDMD5Vv7ARO72wmnMduy jgcUh9Yyc4/QkZ6CbZBQ0x63zAApJ77xoVy+cruEkEd/lzIw11DMsI/EGbDwlZNwET40tpNozEu Joc3Sk8xXeEj8oT4g4i7mbTZfhLc2e+yXi5bM4H4Rx3Yxx9aEgWu5Ai+icQMwO73dg1X+24Un1h 4/FB7EVC+BaKSjMhfi+p3IvxIXKYY2DrV2m66PyD54j96GburhyDQkXTrqqRKVEn/JNJfOTCEzV t7Cw6Ul5Zc4aL39jdxHyL9dugAoCEOHKczEMNaOeWvOr4V79JDYQ5wf8TzsyBaCa+024jjV1eer aEuPHgmN/59lI3DQXGExBPuJUpCaqYiOjVjPuWWnR3OcxKa06uj5T0+KgMG+bG/2iVBqNCFan8J pXkG0CWcfkr87nqUIYQpt5A9MVV5eoLrqYgvcTG7MUleER6KuQdBBX4w8tbiLQvR4bv6N0eTHD3 Wuh8we6hhbsRGxjl9wYsU0yUtXB7B8oywm5hhTwYS1po6Tw+wK9VZ+weYaCKfq7e8Pw3WiDrSXE sZnTlw== X-Received: by 2002:a05:622a:400d:b0:536:7f96:915c with SMTP id d75a77b69052e-55d6fbfc5f7mr441942441cf.5.1795799243423; Fri, 27 Nov 2026 09:07:23 -0800 (PST) Received: from ziepe.ca ([142.177.118.84]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-55d7882e32dsm214830511cf.13.2026.11.27.09.07.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Nov 2026 09:07:22 -0800 (PST) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1xWzPu-000000079Rg-05Sr; Fri, 27 Nov 2026 13:07:22 -0400 Date: Fri, 27 Nov 2026 13:07:22 -0400 From: Jason Gunthorpe To: Yeoreum Yun Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-security-module@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-acpi@vger.kernel.org, acpica-devel@lists.linux.dev, Catalin Marinas , Will Deacon , Suzuki Poulose , Steven Price , Sami Mujawar , thuth@redhat.com, "Rafael J. Wysocki" , Maciej Wieczor-Retman , Pawel Chmielewski , Jiri Pirko , Jonathan Corbet , Shuah Khan , Len Brown , Shuah Khan , Randy Dunlap , Mark Brown Subject: Re: [PATCH RFC v3 7/8] attestation: providers: introduce CCA Guest attestation provider Message-ID: <20261127170722.GT246011@ziepe.ca> References: <20261127-arm_cca_mr-v3-0-df3230afce8f@arm.com> <20261127-arm_cca_mr-v3-7-df3230afce8f@arm.com> X-Mailing-List: acpica-devel@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261127-arm_cca_mr-v3-7-df3230afce8f@arm.com> On Fri, Nov 27, 2026 at 03:33:02PM +0000, Yeoreum Yun wrote: > Introduce CCA Realm Guest attestation provider for retrieving: > > - RIM, REM0-REM3 measurement registers. > - CCA attestation token > - CCEL event log > > used for CCA Realm Guest attestation. This is great to see positive proof that the API fits CCA! > Signed-off-by: Yeoreum Yun > --- > drivers/attestation/Kconfig | 10 + > drivers/attestation/Makefile | 5 + > drivers/attestation/providers/cca_guest.c | 582 ++++++++++++++++++++++++++++++ > 3 files changed, 597 insertions(+) But we need to do alot more work on this to make the drivers slimmer. First, we need to pull drivers/virt/coco/arm-cca-guest/main.c which is the evidence part of this driver into drivers/attestation and build the MR stuff on top of that. Second, things like CCEL need to be handled by core code. The driver should only indicate it "claims" the CCEL if the core code happens to find one. TDX and ARM shouldn't have any direct CCEL stuff beyond that. Similarly the TCG log should work the same way. I'm also wondering if too much code is leaking into to drivers to implement the uAPI. We should take a look at this vs the TDX one and make sure we have the right level of helpers and abstraction. I also can't help but notice there isn't a single comment in any of this, it should be a bit more descriptive why some of these things are in here. > +static enum hash_algo cca_guest_attestation_algorithms[] = { > + HASH_ALGO_SHA512, > +}; static const > + > +static const struct attestation_mr_props cca_guest_attestation_mrs[] = { > + { > + .id = 0, > + .name = "rim", > + .algorithms = cca_guest_attestation_algorithms, > + .algorithms_count = ARRAY_SIZE(cca_guest_attestation_algorithms), > + }, > + { > + .id = 1, > + .name = "rem0", > + .algorithms = cca_guest_attestation_algorithms, > + .algorithms_count = ARRAY_SIZE(cca_guest_attestation_algorithms), > + .has_register_index = true, > + .register_index = 0, > + .extendable = true, > + }, > + { > + .id = 2, > + .name = "rem1", > + .algorithms = cca_guest_attestation_algorithms, > + .algorithms_count = ARRAY_SIZE(cca_guest_attestation_algorithms), > + .has_register_index = true, > + .register_index = 1, > + .extendable = true, > + }, > + { > + .id = 3, > + .name = "rem2", > + .algorithms = cca_guest_attestation_algorithms, > + .algorithms_count = ARRAY_SIZE(cca_guest_attestation_algorithms), > + .has_register_index = true, > + .register_index = 2, > + .extendable = true, > + }, > + { > + .id = 4, > + .name = "rem3", > + .algorithms = cca_guest_attestation_algorithms, > + .algorithms_count = ARRAY_SIZE(cca_guest_attestation_algorithms), > + .has_register_index = true, > + .register_index = 3, > + .extendable = true, > + }, > +}; Jiri this probably isn't going to scale when we get to 32 PCRs on a TPM. > + > +static const struct attestation_evidence_format cca_attestation_token_formats[] = { > + { .vendor = true, .value = CTLV_ATTESTATION_CCA_GUEST_EVIDENCE_VENDOR_FORMAT_CCA_ATTESTATION_TOKEN }, > +}; should be the generic EAT token type > + > +static const struct attestation_evidence_format cca_guest_attestation_log_formats[] = { > + { .value = CTLV_ATTESTATION_EVIDENCE_FORMAT_CCEL }, > +}; > + > +static const struct attestation_evidence_challenge_length > +cca_guest_attestation_challenge_lengths[] = { > + { .min = RSI_ATTEST_CHALLENGE_MIN_SIZE, .max = RSI_ATTEST_CHALLENGE_MAX_SIZE }, > +}; > + > +static struct attestation_evidence_supported_object > +cca_guest_attestation_evidence_objects[] = { > + { > + .evidence_class = ATTESTATION_EVIDENCE_SIGNED, > + .formats = cca_attestation_token_formats, > + .formats_count = ARRAY_SIZE(cca_attestation_token_formats), > + .challenge_lengths = cca_guest_attestation_challenge_lengths, > + .challenge_lengths_count = > + ARRAY_SIZE(cca_guest_attestation_challenge_lengths), > + .max_length = 0, > + .binds_mrs = true, > + }, > +#ifdef CONFIG_ACPI > + { > + .evidence_class = ATTESTATION_EVIDENCE_EVENT_LOG, > + .formats = cca_guest_attestation_log_formats, > + .formats_count = ARRAY_SIZE(cca_guest_attestation_log_formats), > + .max_length = 0, > + }, > +#endif Jiri, same scaling issue, CCEL should be handled by core code so it needs to be inserted dynamically into the evidence list. > +static long cca_guest_get_max_token_size(void) > +{ > + u8 dummy[RSI_ATTEST_CHALLENGE_MAX_SIZE] = { 0x00, }; > + > + return rsi_attestation_token_init(dummy, RSI_ATTEST_CHALLENGE_MAX_SIZE); > +} > + > +static int cca_guest_get_attest_tokens(const struct cca_guest_attestation *cca_guest_att, > + const void *challenge, size_t challenge_size, > + u8 *token, size_t *token_size) > +{ > + int ret; > + long max_token_size; > + void *buf; > + unsigned long granule, offset, len, rsi_ret; > + > + guard(migrate)(); > + > + max_token_size = rsi_attestation_token_init(challenge, challenge_size); > + if (max_token_size <= 0) > + return -EINVAL; > + > + if (max_token_size != cca_guest_att->max_token_size) > + return -ESTALE; What is this and the related work? That isn't making sense to me. If the token size is not absolutely fixed when the driver starts then it should be fully dynamic and this just streams the variable sized token. Ideally directly into user memory so we don't need to allocate a kvmalloc. > +static int > +cca_guest_attestation_evidence_get(struct attestation_dev *att, > + const struct attestation_evidence_request *request, > + struct attestation_evidence_result *result) > +{ > + struct cca_guest_attestation *cca_guest_att = to_cca_guest_attestation(att); > + size_t i, length; > + void *buffer; > + int ret = 0, ccel_obj_idx; > + > + ccel_obj_idx = cca_guest_att->ccel_obj_idx; > + > + for (i = 0; !ret && i < request->objects_count; i++) { > + const struct attestation_evidence_object_request *object = > + &request->objects[i]; > + struct attestation_evidence_object_result *produced = > + &result->objects[i]; I feel like the core code should be doing more of this for the drivers... Drivers should have an op to return a single evidence, for an ID that they control. ie the core code should be returning the CCEL for its id, and when we get to SPDM other common code will handle ids too. Maybe the evidence itself needs an ops? > +static const struct arm_smccc_device_id cca_guest_attest_id_table[] = { > + { .func_id = SMC_RSI_ABI_VERSION, }, > + { }, > +}; > +MODULE_DEVICE_TABLE(arm_smccc, cca_guest_attest_id_table); This isn't OK.. We only get one struct device per RSI and it gets to bind to only one driver. Given there are other drivers that will need to use the RSI, like the TSM and others, this needs some other solution? Jason