From: "sunceping" <cepingx.sun@intel.com>
To: "Yamahata, Isaku" <isaku.yamahata@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Aktas, Erdem" <erdemaktas@google.com>,
James Bottomley <jejb@linux.ibm.com>,
"Yao, Jiewen" <jiewen.yao@intel.com>,
"Xu, Min M" <min.m.xu@intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
Michael Roth <michael.roth@amd.com>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [edk2-devel] [PATCH V1 3/3] OvmfPkg/TdxDxe: Clear the registers before tdcall
Date: Wed, 28 Feb 2024 08:27:55 +0000 [thread overview]
Message-ID: <IA0PR11MB8355291DC5689AB1BA6A525AE7582@IA0PR11MB8355.namprd11.prod.outlook.com> (raw)
In-Reply-To: <SA1PR11MB59217C93229D4C3475901A9C8C592@SA1PR11MB5921.namprd11.prod.outlook.com>
On Tuesday, February 27, 2024 8:26 PM Yamahata, Isaku wrote:
> > +%macro tdcall_regs_preamble 2
> > + mov rax, %1
> > +
> > + xor rcx, rcx
> > + mov ecx, %2
> > +
> > + ; R10 = 0 (standard TDVMCALL)
> > +
> > + xor r10d, r10d
> > +
> > + ; Zero out unused (for standard TDVMCALL) registers to avoid leaking
> > + ; secrets to the VMM.
> > +
> > + xor esi, esi
> > + xor edi, edi
> > +
> > + xor edx, edx
> > + xor ebp, ebp
> > + xor r8d, r8d
> > + xor r9d, r9d
> > + xor r14, r14
> > + xor r15, r15
>
> We can just clear the corresponding bit of TDVMCALL_EXPOSE_REGS_MASK in
> addition to RBP.
> Same to 1/3 and 3/3. We can eliminate tdcall_regs_postamble.
> Any reason to bother to zero those registers and pass them to VMM?
>
Zero out these registers to avoid leaking secrets to the VMM.
There are also some registers (e.g., r10, r14...... etc.) are output operands and should be cleared.
The tdcall_regs_preamble was already using in the TdVmcall.nasm and TdVmcallCpuid.nasm .
For the ApRunLoop.nasm , it is fixed now.
Thanks
Ceping
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#116096): https://edk2.groups.io/g/devel/message/116096
Mute This Topic: https://groups.io/mt/104577524/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2024-02-28 8:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-26 21:18 [edk2-devel] [PATCH V1 0/3] OvmfPkg: Update TDVMCALL to avoid leaking secrets to the VMM sunceping
2024-02-26 21:18 ` [edk2-devel] [PATCH V1 1/3] MdePkg/BaseLib: Update TDVMCALL_EXPOSE_REGS_MASK sunceping
2024-03-04 1:09 ` Min Xu
2024-03-04 3:22 ` sunceping
2024-03-13 7:32 ` sunceping
2024-03-14 14:33 ` 回复: " gaoliming via groups.io
2024-02-26 21:18 ` [edk2-devel] [PATCH V1 2/3] OvmfPkg/CcExitLib: " sunceping
2024-03-04 1:09 ` Min Xu
2024-02-26 21:18 ` [edk2-devel] [PATCH V1 3/3] OvmfPkg/TdxDxe: Clear the registers before tdcall sunceping
2024-02-27 12:25 ` Isaku Yamahata
2024-02-28 8:27 ` sunceping [this message]
2024-03-04 1:09 ` Min Xu
2024-02-27 6:48 ` [edk2-devel] [PATCH V1 0/3] OvmfPkg: Update TDVMCALL to avoid leaking secrets to the VMM Min Xu
2024-03-12 5:53 ` Yao, Jiewen
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=IA0PR11MB8355291DC5689AB1BA6A525AE7582@IA0PR11MB8355.namprd11.prod.outlook.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