public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Dov Murik" <dovmurik@linux.ibm.com>
To: Gerd Hoffmann <kraxel@redhat.com>,
	Tom Lendacky <thomas.lendacky@amd.com>
Cc: devel@edk2.groups.io, Ard Biesheuvel <ardb+tianocore@kernel.org>,
	Jiewen Yao <jiewen.yao@intel.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	Erdem Aktas <erdemaktas@google.com>,
	James Bottomley <jejb@linux.ibm.com>, Min Xu <min.m.xu@intel.com>,
	Michael Roth <michael.roth@amd.com>,
	Ashish Kalra <ashish.kalra@amd.com>,
	Mario Smarduch <mario.smarduch@amd.com>,
	Tobin Feldman-Fitzthum <tobin@linux.ibm.com>
Subject: Re: [RESEND] [PATCH v2 2/2] OvmfPkg/ResetVector: Exclude SEV launch secrets page from pre-validation
Date: Thu, 23 Feb 2023 16:58:23 +0200	[thread overview]
Message-ID: <c44eac36-d5f7-78bf-4c50-8b4b2cd93f0e@linux.ibm.com> (raw)
In-Reply-To: <20230221093820.amj4t2jhzrya7r5k@sirius.home.kraxel.org>



On 21/02/2023 11:38, Gerd Hoffmann wrote:
> On Mon, Feb 20, 2023 at 08:44:23AM -0600, Tom Lendacky wrote:
>> On 2/20/23 02:49, Dov Murik wrote:
>>> In order to allow the VMM (such as QEMU) to add a page with hashes of
>>> kernel/initrd/cmdline for measured direct boot on SNP, this page must
>>> not be part of the SNP metadata list reported to the VMM.
>>>
>>> Check if that page is defined; if it is, skip it in the metadata list.
>>> In such case, VMM should fill the page with the hashes content, or
>>> explicitly update it as a zero page (if kernel hashes are not used).
>>
>> Would it be better to define a new section type (similar to what I did in
>> the SVSM PoC)? This way, it remains listed in the metadata and allows the
>> VMM to detect it and decide how to handle it.
> 
> Explicitly describing things sounds better to me too.
> 

Thanks for the feedback Tom and Gerd.


I can define a new section type OVMF_SECTION_TYPE_KERNEL_HASHES. In the AmdSev
target it'll cover the single MEMFD page at 00F000 (after the CPUID page).  
Now there's a question for the QEMU side -- should QEMU then fill the page
and encrypt it (launch_update type=NORMAL)? (currently the whole hashes table
creation and encryption is done elsewhere there)

And on regular OvmfX64 builds - should that area should be with type
OVMF_SECTION_TYPE_SNP_SEC_MEM which is accepted as a type=ZERO page ?


Playing with this idea, the metadata list will add:


; Kernel hashes section for measured direct boot
%define OVMF_SECTION_TYPE_KERNEL_HASHES   0x5

...

; Kernel hashes for measured direct boot, or zero page if
; there are no kernel hashes / SEV secrets
SevSnpKernelHashes:
  DD  SEV_SNP_KERNEL_HASHES_BASE
  DD  SEV_SNP_KERNEL_HASHES_SIZE
  DD  SEV_SNP_KERNEL_HASHES_TYPE



and the base/size/type of that region are defined in an
%if statement in ResetVector.nasmb:


%if (FixedPcdGet32 (PcdSevLaunchSecretBase) > 0)
  ; There's a reserved page for SEV secrets and hashes; the VMM will fill and
  ; validate the page
  %define SEV_SNP_KERNEL_HASHES_TYPE    OVMF_SECTION_TYPE_KERNEL_HASHES
  %define SEV_SNP_KERNEL_HASHES_BASE    (FixedPcdGet32 (PcdSevLaunchSecretBase))
%else
  ; No SEV secrets and hashes page; the VMM will validate it as another zero page
  %define SEV_SNP_KERNEL_HASHES_TYPE    OVMF_SECTION_TYPE_SNP_SEC_MEM
  %define SEV_SNP_KERNEL_HASHES_BASE    (CPUID_BASE + CPUID_SIZE)
%endif
%define SEV_SNP_KERNEL_HASHES_SIZE    (FixedPcdGet32 (PcdOvmfSecPeiTempRamBase) - SEV_SNP_KERNEL_HASHES_BASE)


(I still need to figure out the point about QEMU above.)


Is that what you had in mind?

-Dov

  reply	other threads:[~2023-02-23 14:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-20  8:49 [RESEND] [PATCH v2 0/2] OvmfPkg: Enable measured direct boot on AMD SEV-SNP Dov Murik
2023-02-20  8:49 ` [RESEND] [PATCH v2 1/2] OvmfPkg/AmdSev: Reorder MEMFD pages to match the order in OvmfPkgX64.fdf Dov Murik
2023-02-20  8:49 ` [RESEND] [PATCH v2 2/2] OvmfPkg/ResetVector: Exclude SEV launch secrets page from pre-validation Dov Murik
2023-02-20 14:44   ` Lendacky, Thomas
2023-02-21  9:38     ` Gerd Hoffmann
2023-02-23 14:58       ` Dov Murik [this message]
2023-02-23 15:04         ` Dov Murik
2023-02-27 18:50           ` Lendacky, Thomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c44eac36-d5f7-78bf-4c50-8b4b2cd93f0e@linux.ibm.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox