From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.24928.1656595714548448950 for ; Thu, 30 Jun 2022 06:28:34 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=dugZ8q8/; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1656595713; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=QgOokTx+OuOrcm0OedUMPyKTcPWzRAELIgmekiTKOCs=; b=dugZ8q8/9Ecrm4Kz0EcpgzU9iNv3n8Br30Tbe/51R/hMNfoKsLic31f86I4p1eu4ZbvJcn 5884HSZyXDHdD1QfwjcE8+IDVab0VNLQybkBWrSlqlQMEItuY2WRM87Yf9SWFv5GxfkG9x jn3xCAlo7mAdaYQvZIwZglXGzfRgXO8= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-636-Q1-m72sWNYmla_oCpnsHhQ-1; Thu, 30 Jun 2022 09:28:28 -0400 X-MC-Unique: Q1-m72sWNYmla_oCpnsHhQ-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9FAB21C0013B; Thu, 30 Jun 2022 13:28:27 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 57B321410F3B; Thu, 30 Jun 2022 13:28:26 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 7C209180060A; Thu, 30 Jun 2022 15:28:23 +0200 (CEST) Date: Thu, 30 Jun 2022 15:28:23 +0200 From: "Gerd Hoffmann" To: Min Xu Cc: devel@edk2.groups.io, Leif Lindholm , Ard Biesheuvel , Abner Chang , Daniel Schaefer , Erdem Aktas , James Bottomley , Jiewen Yao , Tom Lendacky Subject: Re: [PATCH V3 0/7] Enable secure-boot when lauch OVMF with -bios parameter Message-ID: <20220630132823.soam44jmopahv63y@sirius.home.kraxel.org> References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Jun 29, 2022 at 04:56:56PM +0800, Min Xu wrote: > Secure-Boot related variables include the PK/KEK/DB/DBX and they are > stored in NvVarStore (OVMF_VARS.fd). When lauching with -pflash, > QEMU/OVMF will use emulated flash, and fully support UEFI variables. > But when launching with -bios parameter, UEFI variables will be partially > emulated, and non-volatile variables may lose their contents after a > reboot. See OvmfPkg/README. > > Tdx guest is an example that -pflash is not supported. So this patch-set > is designed to initialize the NvVarStore with the content of in > OVMF_VARS.fd. > > patch 1: > Add a new function (AllocateRuntimePages) in PrePiMemoryAllocationLib. > This function will be used in PeilessStartupLib which will run > in SEC phase. > > patch 2: > Delete the TdxValidateCfv in PeilessStartupLib. Because it is going to > be renamed to PlatformValidateNvVarStore and be moved to PlatformInitLib. > > patch 3 - 7: > Then we add functions for EmuVariableNvStore in PlatformInitLib. This > lib will then be called in OvmfPkg/PlatformPei and PeilessStartupLib. > We also shortcut ConnectNvVarsToFileSystem in secure-boot. > > patch 8: > At last a build-flag (SECURE_BOOT_FEATURE_ENABLED) is introduced in > the dsc in OvmfPkg. Because the copy over of OVMR_VARS.fd to > EmuVariableNvStore is only required when secure-boot is enabled. > > Code: https://github.com/mxu9/edk2/tree/secure-boot.v3 /usr/bin/ld: /home/kraxel/projects/edk2/Build/IntelTdx/DEBUG_GCC5/X64/UefiCpuPkg/Library/CpuExceptionHandlerLib/SecPeiCpuExceptionHandlerLib/OUTPUT/SecPeiCpuExceptionHandlerLib.lib(ExceptionHandlerAsm.obj): warning: relocation in read-only section `.text' /usr/bin/ld: /tmp/ccCEPSuH.ltrans0.ltrans.o: in function `SecCoreStartupWithStack': /home/kraxel/projects/edk2/OvmfPkg/Library/PlatformInitLib/Platform.c:760: undefined reference to `AllocateRuntimePages' /usr/bin/ld: /tmp/ccCEPSuH.ltrans0.ltrans.o:/home/kraxel/projects/edk2/OvmfPkg/Library/PlatformInitLib/Platform.c:760: undefined reference to `AllocateRuntimePages' /usr/bin/ld: warning: creating DT_TEXTREL in a PIE collect2: error: ld returned 1 exit status make: *** [GNUmakefile:431: /home/kraxel/projects/edk2/Build/IntelTdx/DEBUG_GCC5/X64/OvmfPkg/IntelTdx/Sec/SecMain/DEBUG/SecMain.dll] Error 1 adding a build test for intel tdx to ci is probably a good idea ... take care, Gerd