From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.45 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796043401; b=GATwLBgNTZGrocXVFY9flCEllabz5kAGQX7NPJG+Fk1cxAfcK/0er27XTI/ZcbX5snsC Yom4DJQGCy8+kN8ppWRpnIES7XSIhvg8jM95Hk2R6IJ6cGMhp08n+AoBv/5pLLp3EIf+/ +fgfg0hFRLdrT5cxzExTmgbjNx+rGDojLvvSB1lF30wN5k1mBPjyH3lIN+G5JuPHpCERu Y0Nj9f+k6OpXT3yjTNtX0xRcCnNeOsRyiD8+b0uPKZDBcY4kqP/qDL756c0qgi01TT+de 8dXhRT4y2YoTbZ8eEk610xLQ9fhVudk7bwnNF7UtguhIxIGt4/Pr4ZkzWFx9WvIvQPw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796043401; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=J8Y7dF7CU+Md0iwchOU8iZZ8YOPt8mgWc97wQzSr2iY=; b=UcOGQ0lyjxH1OleWIixex3jjFDKCZlS2zMK9F3JlyXw42jlX/ALAOcZgLPp+noFDAwAG jrhbbJtNW5K3tSQYPxZUTLSIZPi0ROtG2xsYKhDiuoqhk78PJoRzqVWaUMhP3uM1oDwLI H4w48iplbVZmQ+q7SmaGtqgmE4HVQG321AvF/Mws8iQ83Aqo8ES5gJOTo2/nnIX2R3hKK s/oACG8pczV99AylGvP2IGi27cRO+4VN1q5xVJ3tkseg4gwf5B8QJUJ5k8Adpq7ercKFR h9kK5rJ9Qt5Qrpn96m7jQyXxpUwUA+cmSrWP2SG2EG6Wf6PQMDRzPHgq3HTzQft06Vg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=resnulli.us; spf=pass smtp.mailfrom=resnulli.us; dkim=pass header.d=resnulli.us header.i=@resnulli.us header.a=rsa-sha256 header.s=google header.b=IKBEf880; arc=none smtp.remote-ip=209.85.221.45 Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45]) (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 799E3606A32C for ; Mon, 30 Nov 2026 12:56:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 799E3606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=resnulli.us Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=resnulli.us Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=resnulli.us header.i=@resnulli.us header.a=rsa-sha256 header.s=google header.b=IKBEf880 Received: by mail-wr1-f45.google.com with SMTP id ffacd0b85a97d-4b52fcb410dso4560404f8f.1 for ; Mon, 30 Nov 2026 04:56:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli.us; s=google; t=1796043399; x=1796648199; darn=vger.kernel.org; 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=J8Y7dF7CU+Md0iwchOU8iZZ8YOPt8mgWc97wQzSr2iY=; b=IKBEf880I7BUZxkDlzLi6e1JwN1V8sugVUJT8A2P7bNRuyWxVuuicdMcEMFw/6qRfF vCYdiRGDuFDLK4m7rSWJ99WsgsJcf2jEP/IQYeHqTNaiv3EgOcwmHtYrHH4wxgm7Xb0E MXePbXXXr1OXiKJH3J44aB5fTEh8D0q4Z5vi9gEQb+cwmDaqH8v2CJDszhBX8jwDlWz+ a1atZGfe9w5v+b5+81VN1mnyfCefI18rpGdxH8mTvXLpI8phCtza6/wlnPUl8zmxdXcf 29HyAGmYF9P+Cw+NovCf9S56/sJycz897STQGcbc5whnGoOrJhPpWsI42+REH8u6Tsvk NxCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796043399; x=1796648199; 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=J8Y7dF7CU+Md0iwchOU8iZZ8YOPt8mgWc97wQzSr2iY=; b=G95EmOlvR5XEFPHq1Hp48yDot9Uw/Qw9gNSImEJIcuzh98gDyW9BTWUMrVr2BtjSHH z0PquQ9CnvfCP0GCoUWVYw3Nnn/Hj4rROmj5eqAAukmL6YQhMDnMa6CeCew8Fap07ZMz b/EupLYFmiMko0ix+nS6YyLgSjjV18DRl0VTwzc50pP6B5UPyaK3ZuDhxywiBCvQ2v4a 4aZfDsUyg8bXfkrZefqo0J06YrCoaZesV09yXiy+USpWKn7JG9E1PN8f3i80Nu3xi0xM u+tQKXqG04NREcv0uBzR5ENdXGqj+7KEhzYKxEKn1AE1kiae2ePx44tdtDVBidzWANEf aSDg== X-Forwarded-Encrypted: i=1; AL+hErEz58mHjbbSenlCDTuVEOHoPxX52LwV+75apoQoNjxX9OsakrRjqhL5IoRKIH6QAuHHKKLWxm7fELA=@vger.kernel.org X-Gm-Message-State: APuU4Z+bwNGmTcHb0JSl9aNWrskZdAc0BhULfy9J+8VKu0VI8CoeoibB OEgLBz0kB0QMLyifS6bN5b2kuy6XSxD2QPXlbG2Uy+m9Uv+FZi3hvW/dRklbBs3+9a8= X-Gm-Gg: AZFdTZcxTtW8qZTB1PtekhYevbn4S6hvUVh76ELMqRmsnjGCL5xvLNwzMG3Q9xIIvYc DYb+hIFgoHBzIB163uI0VsR3QyWiVkUazNL+HGhk8c+SOsIUO33DYSA06yXY5Eb4ilJu+11l7Kb gTo63mZiM+m6PgEXJDss5SqIVhcZd/AB1GjAcx8hG/1xWbNgj1jZVdXTavvamM/lb3IxhSOqBU0 o39pBN7jBm7H23OKjBySaVQi75iS+KHTmKLdbNseMV1BZYdiOAmcmpl2UL1bZR6lscABj43zkhv U/OmnJPboDlXFMko6/JQ6ZuOAcOYK5vQnfj400vaUNddvTgAUjtlu0sVPyueRv1H0+AnUodOlTs i5OxVXLgvqAUo7Iq50RyP1Vpc5B2uIzQd/HdmcYtDifw0KgZ0JfL9Tc9r8roa24GjaPhJ87pEgY 7EmtXLiiJLMKRH0U1pltb9lMMluAb/Qvm8ex8ERkeY9BzB4wLNWRske+/scr3jGz5rPbSPVox2D EzlI93Uf+J0ESF3Qd3o8v1aJ7pbb5+BHkRV7COSV9Cv+WKIgtjIcRyjp+gCqSA2XNzA5PNejEgd fNqlMdA51zKGLTZPV4GkH8Hsk8bz6wnbauIIl5tg X-Received: by 2002:adf:f192:0:b0:491:e477:6820 with SMTP id ffacd0b85a97d-4abb3a4d388mr49508853f8f.20.1796043398552; Mon, 30 Nov 2026 04:56:38 -0800 (PST) Received: from localhost ([140.209.217.212]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab6bb989eesm64145566f8f.50.2026.11.30.04.56.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 04:56:38 -0800 (PST) Date: Mon, 30 Nov 2026 13:56:33 +0100 From: Jiri Pirko To: Jason Gunthorpe Cc: Yeoreum Yun , 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 , 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: References: <20261127-arm_cca_mr-v3-0-df3230afce8f@arm.com> <20261127-arm_cca_mr-v3-7-df3230afce8f@arm.com> <20261127170722.GT246011@ziepe.ca> X-Mailing-List: linux-doc@vger.kernel.org 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: <20261127170722.GT246011@ziepe.ca> Fri, Nov 27, 2026 at 06:07:22PM +0100, jgg@ziepe.ca wrote: >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. Perhaps we can have some groups, like: static const struct attestation_mr_props cca_guest_attestation_mrs[] = { { .first_id = 0, .mrs_count = 1, .name = "rim", .algorithms = cca_guest_attestation_algorithms, .algorithms_count = ARRAY_SIZE(cca_guest_attestation_algorithms), }, { .first_id = 1, .mrs_count = 4, .name = "rem%u", .algorithms = cca_guest_attestation_algorithms, .algorithms_count = ARRAY_SIZE(cca_guest_attestation_algorithms), .has_register_index = true, .first_register_index = 0, .extendable = true, }, }; ? > >> + >> +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. Yeah, I was thingking about it. We can build the evidence-object list during initialization, rather than treating the provider's array as the final list. Also. I think each object should have own callback. > >> +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? Okay, makes sense the core may help a bit more. Perhaps just a simple change of evidence_get (or per object callback) being called per-object and core doing the iteration? > >> +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