Received: by 2002:a17:505:a0c:b0:1be9:327d:8ee3 with SMTP id cg12csp2860345njb; Mon, 9 Dec 2024 12:22:57 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVJ73NVpLGDLKGLxC8gQS0VDxIISN5jnMnlUSs7RaQRQqi1DWAQw71XzDwniqyTIp1FEvIoUgLp6UIV6w==@linaro.org X-Google-Smtp-Source: AGHT+IHmyQiHab1bKwKHb/mwfeCrpX8wkRoz8hHUJI/J22fe6PNle2zqY6MapDSKDOTSJ94M9IN5 X-Received: by 2002:a05:6602:1511:b0:842:ff2d:c3bb with SMTP id ca18e2360f4ac-844b518a73dmr234686039f.6.1733775777682; Mon, 09 Dec 2024 12:22:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1733775777; cv=none; d=google.com; s=arc-20240605; b=NyUg40550izsTXyK5Xq6XGAq8U0cMoeHFWSNmJVnc9xF6e/7zN/2yiA/8LAbqMgmIr uQgr7t3NjkB8esLd0lWQPwyu8bKKWA8GCr8eiHsusyFfDedi/e00WkP1uux8m7tJfAJ+ C1jKQE5uLLoA55zdX5pBWm+qxGvZOrVUWmAzzKZbkvBd5Qxaf8EkjcUUz/F8Dnqv8V12 8c26gcZCs47SzO0n2foQqNH2dc+ME5OOTEsiNBSvQDbNKd3fYeqIdR1cwGoSapjA6nTs Ydla8Q1eICZyYnwiBKdXMw3UbMVbuKqZGVTq44UqdO1LBjjgrqvEfD41d1BeRXXNE4Eb X4zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=E4reyB7EhPMhkHL3N/FQihFhqvY1JY1m59R5yFJC75c=; fh=ZyK7jxNtZdErGcLj8c/jNWqJeWdHKR+su63XXqWvxeo=; b=NEZm8QbLT8K+KL2I9S2vp1g8q4SiUTPJpk+KgbDpwv4BWqHkf8wfG8Tjmo2yPMl1xs fx4Ib3Phefw2Yx5ONvyZuKMA3yB7JiZ2AkCUE6js+KaNZ2PULm/OxmoKghn+aeQYaAwD GcFRxH+u4igHMr06zp/84Y2k30Q2coFeg4lJj6fX1pYpci4d0iYKpi66FwXcmrqMYTN/ FEbYUitL1HCdSPEuY6477dhAvK8TGt6NNjkGpWR6kMWwPhiy8oX/FQm9SOhthKm1cCfU EkvHla1cyJF81uzH//qmZq+cKcl1CVINLKdsvS1IRiQuRDsI4QM6SnLy3oAK7BvL8sfQ PCIQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=TVo6+F8q; spf=pass (google.com: domain of stefanb@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=stefanb@linux.ibm.com; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com. [148.163.156.1]) by mx.google.com with ESMTPS id ca18e2360f4ac-84473a83f0asi571203839f.107.2024.12.09.12.22.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Dec 2024 12:22:57 -0800 (PST) Received-SPF: pass (google.com: domain of stefanb@linux.ibm.com designates 148.163.156.1 as permitted sender) client-ip=148.163.156.1; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=TVo6+F8q; spf=pass (google.com: domain of stefanb@linux.ibm.com designates 148.163.156.1 as permitted sender) smtp.mailfrom=stefanb@linux.ibm.com; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4B9JLUmo020932; Mon, 9 Dec 2024 20:22:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pp1; bh=E4reyB 7EhPMhkHL3N/FQihFhqvY1JY1m59R5yFJC75c=; b=TVo6+F8qEmF4+JNjnSC9uF rgqDc7gt4wuA/HZRj76N/22tFwWFrPprBOdNhomJPg0Hjh+8x1ZPT2oYGuPWWpcE usjRU6zq74rhjtnN082D7/9a8vT6bY8cWN3gJkbn1kVSmrsmzuOWrFw7RYcA2oLC V7rxZM7j5IEHvc8HoystPpqXmLt5S/EQaOKKJNipteiCkVuhX0Uj3nu9OIILWVhg Dsm3pfXq1i065lmQOyoDSOnF9S0pZO/RURIgMGdXyjFqMeaQWJR9Q4rC7m6rygEH cFjO/h07tl1n2ECn2O9j4OqDH1neIbbidV6HffzDbpnnGlMMsbj/xxhhLpBJdKWQ == Received: from ppma22.wdc07v.mail.ibm.com (5c.69.3da9.ip4.static.sl-reverse.com [169.61.105.92]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 43ce38kcv2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 09 Dec 2024 20:22:56 +0000 (GMT) Received: from pps.filterd (ppma22.wdc07v.mail.ibm.com [127.0.0.1]) by ppma22.wdc07v.mail.ibm.com (8.18.1.2/8.18.1.2) with ESMTP id 4B9HkQEL016911; Mon, 9 Dec 2024 20:22:55 GMT Received: from smtprelay05.dal12v.mail.ibm.com ([172.16.1.7]) by ppma22.wdc07v.mail.ibm.com (PPS) with ESMTPS id 43d12y0ef8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 09 Dec 2024 20:22:55 +0000 Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229]) by smtprelay05.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 4B9KMsoe25690700 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 9 Dec 2024 20:22:54 GMT Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 47B4158058; Mon, 9 Dec 2024 20:22:54 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8BD1E5805D; Mon, 9 Dec 2024 20:22:53 +0000 (GMT) Received: from [9.47.158.152] (unknown [9.47.158.152]) by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP; Mon, 9 Dec 2024 20:22:53 +0000 (GMT) Message-ID: <371a3e10-dfad-4289-aad0-d35e3d6f11a5@linux.ibm.com> Date: Mon, 9 Dec 2024 15:22:53 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [RFC PATCH v3 25/26] target/arm/kvm-rme: Add measurement log To: Jean-Philippe Brucker Cc: =?UTF-8?Q?Daniel_P=2E_Berrang=C3=A9?= , peter.maydell@linaro.org, richard.henderson@linaro.org, philmd@linaro.org, qemu-arm@nongnu.org, qemu-devel@nongnu.org, alex.bennee@linaro.org, Stefan Berger References: <20241125195626.856992-2-jean-philippe@linaro.org> <20241125195626.856992-27-jean-philippe@linaro.org> <02b90518-2996-4231-bee9-43ce313669b0@linux.ibm.com> <20241126162149.GC956991@myrica> <20241205123316.GA567753@myrica> Content-Language: en-US From: Stefan Berger In-Reply-To: <20241205123316.GA567753@myrica> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: v1EZjmhlz7Pbo3zKMS6c1WgMDmzH9DOA X-Proofpoint-ORIG-GUID: v1EZjmhlz7Pbo3zKMS6c1WgMDmzH9DOA X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-15_01,2024-10-11_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 suspectscore=0 spamscore=0 clxscore=1011 priorityscore=1501 lowpriorityscore=0 impostorscore=0 bulkscore=0 mlxscore=0 malwarescore=0 mlxlogscore=999 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2411120000 definitions=main-2412090155 X-TUID: 5QLG4ySuIdeT On 12/5/24 7:33 AM, Jean-Philippe Brucker wrote: > On Mon, Dec 02, 2024 at 10:58:01AM -0500, Stefan Berger wrote: >> >> >> On 11/26/24 11:21 AM, Jean-Philippe Brucker wrote: >>> On Tue, Nov 26, 2024 at 01:45:55PM +0000, Daniel P. Berrangé wrote: >>>> On Mon, Nov 25, 2024 at 05:23:44PM -0500, Stefan Berger wrote: >>>>> >>>>> >>>>> On 11/25/24 2:56 PM, Jean-Philippe Brucker wrote: >>>>>> Create an event log, in the format defined by Trusted Computing Group >>>>>> for TPM2. It contains information about the VMM, the Realm parameters, >>>>>> any data loaded into guest memory before boot and the initial vCPU >>>>>> state. >>>>>> >>>>>> The guest can access this log from RAM and send it to a verifier, to >>>>>> help the verifier independently compute the Realm Initial Measurement, >>>>>> and check that the data we load into guest RAM is known-good images. >>>>>> Without this log, the verifier has to guess where everything is loaded> >>>>> and in what order. >>>>> >>>>> Typically these logs are backed by extensions of TPM PCRs and when you send >>>>> a log to a verifier you send a TPM quote along with it for the verifer to >>>>> replay the log and check the TPM quote. Also, early code in the firmware is >>>>> typically serving as a root of trust that starts the chain of measurements >>>>> of code and data, first measuring itself and then other parts of the >>>>> firmware before it jumps into the other parts. Now here you seem to just >>>>> have a log and no PCR extensions and therefore no quote over PCRs can be >>>>> used. >>> >>> Indeed, in our case it's the trusted hypervisor (RMM) that provides the >>> equivalent to TPM quote and PCRs. In more details: >>> >>> 1. QEMU loads images into guest RAM by calling KVM, which calls RMM. >>> 2. RMM calculates a hash of the image content, adds it to a rolling hash >>> the "Realm Initial Measurement" (RIM), which I believe is equivalent to >>> a PCR. >> >> I am not familiar with RIM. A link to read more about it would be helpful. > > The "Learn the architecture" documentation might be a good introduction > https://developer.arm.com/documentation/den0127/0200/Overview > In particular the part about Realm creation: > https://developer.arm.com/documentation/den0127/0200/Realm-management/Realm-creation-and-attestation > > The RMM specification describes exactly how the RIM is calculated, but > is less palatable: > https://developer.arm.com/documentation/den0137/1-0rel0/?lang=en > A7.1.1 Realm Initial Measurement > > More specialized resource are the attestation token documentation: > [1] https://datatracker.ietf.org/doc/html/draft-ffm-rats-cca-token-00 > and CCA Security Model: > https://developer.arm.com/documentation/DEN0096/latest/ Thanks for the links. I will have a look at them when I have time. > >> >>> 3. During remote attestation, the guest sends evidence containing this RIM >>> signed by the root of trust, along with a signed token identifying the >>> platform (hardware, firmware, RMM). >> >> Is this a well known manufacturer key that one would expect for signature >> verification or is it locally created? > > It comes from a well known manufacturer key, although the signing can be > delegated in some models (like in the current demos): > > The hardware RoT creates a key pair for the RMM, which the RMM uses to > sign the RIM. The RoT then signs the RMM pubkey, using the well-known key > (see [1] 4.10 Token Binding). You should mention in the commit message that the log will be signed and user space can get the signature over the log from some filesystem or so. Stefan