From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by mx.groups.io with SMTP id smtpd.web09.117.1626723026270190023 for ; Mon, 19 Jul 2021 12:30:26 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@ibm.com header.s=pp1 header.b=LS/zeM5A; spf=pass (domain: linux.ibm.com, ip: 148.163.156.1, mailfrom: dovmurik@linux.ibm.com) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 16JJ8sWK080452; Mon, 19 Jul 2021 15:30:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=subject : to : cc : references : from : message-id : date : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pp1; bh=XCp8k5CTGtl9c2Tm2m9/W4imLI64V5DxFUpr6msOE6o=; b=LS/zeM5AlsRJpTcZJzlDCdB7CoDYvlUUIDFZY3980XEzPsSamE5LU4EzQhiF/7amUEPf isPOfmcfM4pko1vPGRp4JK2RjnZkybagH8tWPPoj5Vv7fW2bRComnI75S8PoB5owH6/5 GoGkPwlPucfx8YkD/dvxDVfh9cOZpn9bTVjMcvkSOgFVwzkAPV8UP+wnRpfAkPOmB6nY 2soaITYa+Z2NtfFa4IzPc6QMIf23WRlYqrf56HVPwtyWTVlBPVi2vtK0VJ0rCJ7lJIAd J/TvhBTG059Uo3mOHydGgjDNx6rfjSOGNSKAadU6ySC74+JCXUKsjOQIjZ8bjkaRHpDT SA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com with ESMTP id 39wdkyutbc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Jul 2021 15:30:24 -0400 Received: from m0098393.ppops.net (m0098393.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 16JJQIau009460; Mon, 19 Jul 2021 15:30:23 -0400 Received: from ppma01wdc.us.ibm.com (fd.55.37a9.ip4.static.sl-reverse.com [169.55.85.253]) by mx0a-001b2d01.pphosted.com with ESMTP id 39wdkyut9w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Jul 2021 15:30:23 -0400 Received: from pps.filterd (ppma01wdc.us.ibm.com [127.0.0.1]) by ppma01wdc.us.ibm.com (8.16.1.2/8.16.1.2) with SMTP id 16JJSdRi007595; Mon, 19 Jul 2021 19:30:22 GMT Received: from b01cxnp23034.gho.pok.ibm.com (b01cxnp23034.gho.pok.ibm.com [9.57.198.29]) by ppma01wdc.us.ibm.com with ESMTP id 39upub26kj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 19 Jul 2021 19:30:22 +0000 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp23034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 16JJUKCg39452962 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 19 Jul 2021 19:30:20 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 625E2124053; Mon, 19 Jul 2021 19:30:20 +0000 (GMT) Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7B21412405A; Mon, 19 Jul 2021 19:30:17 +0000 (GMT) Received: from [9.65.195.237] (unknown [9.65.195.237]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 19 Jul 2021 19:30:17 +0000 (GMT) Subject: Re: [PATCH v2 07/11] OvmfPkg/QemuKernelLoaderFsDxe: call VerifyBlob after fetch from fw_cfg To: Tom Lendacky , devel@edk2.groups.io Cc: Tobin Feldman-Fitzthum , Tobin Feldman-Fitzthum , Jim Cadden , James Bottomley , Hubertus Franke , Laszlo Ersek , Ard Biesheuvel , Jordan Justen , Ashish Kalra , Brijesh Singh , Erdem Aktas , Jiewen Yao , Min Xu , Dov Murik References: <20210706085501.1260662-1-dovmurik@linux.ibm.com> <20210706085501.1260662-8-dovmurik@linux.ibm.com> From: "Dov Murik" Message-ID: <68a957a8-fca6-f925-8415-6c178d57d1ca@linux.ibm.com> Date: Mon, 19 Jul 2021 22:30:16 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 In-Reply-To: X-TM-AS-GCONF: 00 X-Proofpoint-GUID: ADNIEUTSi0fvJx7YVx8-6QoVMGj0cWtd X-Proofpoint-ORIG-GUID: E08VAuXngaGRxD1tnN0V5bsVQhFszF4n X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.790 definitions=2021-07-19_09:2021-07-19,2021-07-19 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 priorityscore=1501 suspectscore=0 mlxlogscore=999 lowpriorityscore=0 spamscore=0 phishscore=0 adultscore=0 impostorscore=0 mlxscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104190000 definitions=main-2107190109 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit On 19/07/2021 18:57, Tom Lendacky wrote: > On 7/6/21 3:54 AM, Dov Murik wrote: >> In QemuKernelLoaderFsDxeEntrypoint we use FetchBlob to read the content >> of the kernel/initrd/cmdline from the QEMU fw_cfg interface. Insert a >> call to VerifyBlob after fetching to allow BlobVerifierLib >> implementations to add a verification step for these blobs. >> >> This will allow confidential computing OVMF builds to add verification >> mechanisms for these blobs that originate from an untrusted source >> (QEMU). >> >> The null implementation of BlobVerifierLib does nothing in VerifyBlob, >> and therefore no functional change is expected. >> >> Cc: Laszlo Ersek >> Cc: Ard Biesheuvel >> Cc: Jordan Justen >> Cc: Ashish Kalra >> Cc: Brijesh Singh >> Cc: Erdem Aktas >> Cc: James Bottomley >> Cc: Jiewen Yao >> Cc: Min Xu >> Cc: Tom Lendacky >> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3457 >> Co-developed-by: James Bottomley >> Signed-off-by: James Bottomley >> Signed-off-by: Dov Murik >> --- >> OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c b/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c >> index c7ddd86f5c75..b43330d23b80 100644 >> --- a/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c >> +++ b/OvmfPkg/QemuKernelLoaderFsDxe/QemuKernelLoaderFsDxe.c >> @@ -17,6 +17,7 @@ >> #include >> #include >> #include >> +#include >> #include >> #include >> #include >> @@ -1039,6 +1040,14 @@ QemuKernelLoaderFsDxeEntrypoint ( >> if (EFI_ERROR (Status)) { >> goto FreeBlobs; >> } >> + Status = VerifyBlob ( >> + CurrentBlob->Name, >> + CurrentBlob->Data, >> + CurrentBlob->Size >> + ); > > Just a nit, but the ");" should be under the "C" in CurrentBlob. It's a sad winking face... I'll fix. Thanks, -Dov > > Thanks, > Tom > >> + if (EFI_ERROR (Status)) { >> + goto FreeBlobs; >> + } >> mTotalBlobBytes += CurrentBlob->Size; >> } >> KernelBlob = &mKernelBlob[KernelBlobTypeKernel]; >>