public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Lendacky, Thomas via groups.io" <thomas.lendacky=amd.com@groups.io>
To: devel@edk2.groups.io, kraxel@redhat.com, acdunlap@google.com
Cc: Borislav Petkov <bp@alien8.de>, Peter Gonda <pgonda@google.com>
Subject: Re: [edk2-devel] [PATCH] OvmfPkg: Harden #VC instruction emulation somewhat (CVE-2024-25742)
Date: Fri, 19 Apr 2024 09:56:01 -0500	[thread overview]
Message-ID: <f9e74777-fd35-2067-239d-c46e3ffdb4c9@amd.com> (raw)
In-Reply-To: <daghpwou63yyswucaecnuubjxabx47ygbza7l7fnc4xxsnvju4@hvxr3vdo54xg>

On 4/18/24 07:15, Gerd Hoffmann via groups.io wrote:
> On Wed, Apr 17, 2024 at 09:54:00AM -0700, Adam Dunlap via groups.io wrote:
>> Ensure that when a #VC exception happens, the instruction at the
>> instruction pointer matches the instruction that is expected given the
>> error code. This is to mitigate the ahoi WeSee attack [1] that could
>> allow hypervisors to breach integrity and confidentiality of the
>> firmware by maliciously injecting interrupts. This change is a
>> translated version of a linux patch e3ef461af35a ("x86/sev: Harden #VC
>> instruction emulation somewhat")
> 
>> +**/
>> +STATIC
>> +UINT64
>> +VcCheckOpcodeBytes (
>> +  IN OUT GHCB                    *Ghcb,
>> +  IN OUT EFI_SYSTEM_CONTEXT_X64  *Regs,
>> +  IN OUT CC_INSTRUCTION_DATA     *InstructionData,
>> +  IN     UINT64                  ExitCode
>> +  )
>> +{
>> +  UINT8  OpCode;
> 
> The linux kernel patch uses "unsigned int opcode" and apparently
> checks more than just the first byte for multi-byte opcodes.  Why
> do it differently here?
> 
> On the bigger picture:  I'm wondering why SNP allows external #VC
> injections in the first place?

It does and it doesn't. It doesn't allow #VC when injected as an 
exception. But the case of #VC injected as an interrupt was missed (see 
the event injection type field). It will be fixed in hardware going 
forward, but for now...

Thanks,
Tom

> 
> take care,
>    Gerd
> 
> 
> 
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#118030): https://edk2.groups.io/g/devel/message/118030
Mute This Topic: https://groups.io/mt/105581633/7686176
Mute #vc:https://edk2.groups.io/g/devel/mutehashtag/vc
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



  parent reply	other threads:[~2024-04-19 14:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-17 16:54 [edk2-devel] [PATCH] OvmfPkg: Harden #VC instruction emulation somewhat (CVE-2024-25742) Adam Dunlap via groups.io
2024-04-17 17:08 ` Ard Biesheuvel
2024-04-17 17:45   ` Adam Dunlap via groups.io
2024-04-18  8:03     ` Yao, Jiewen
2024-04-18 12:15 ` Gerd Hoffmann
2024-04-18 15:39   ` Adam Dunlap via groups.io
2024-04-18 15:43     ` Peter Gonda via groups.io
2024-04-19 11:31     ` Gerd Hoffmann
2024-04-19 14:56   ` Lendacky, Thomas via groups.io [this message]
2024-04-19 15:12 ` Lendacky, Thomas via groups.io
2024-04-19 17:39   ` Adam Dunlap via groups.io
2024-04-19 18:21     ` [edk2-devel] [PATCH v2] " Adam Dunlap via groups.io
2024-04-22 14:12       ` Lendacky, Thomas via groups.io
2024-04-23  9:27       ` Gerd Hoffmann
2024-04-24 16:27         ` Ard Biesheuvel

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=f9e74777-fd35-2067-239d-c46e3ffdb4c9@amd.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