From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id 534EA7803D0 for ; Thu, 18 Apr 2024 15:43:57 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=loOIzl7g1e5Wnuu5GzHnESxEdb++ESlCrulxZIkf4co=; c=relaxed/simple; d=groups.io; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject:To:Cc:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Transfer-Encoding; s=20240206; t=1713455036; v=1; b=B/uiqD2VtjDHtqbAV9o6giT/YzQr47NKVmqLPBwGQSAuyYWM3QzQI15kqi7cTbcrJlsVf+CB 4XWcaAMNmvsjP806mQQIaN6uG6nkV8rSt7pRKC3qPIvv4qfHl/76/EwdFcPZ6uZRWXlX/rTa3Ii zB8Tg5lwecfP1hY0aemNodS1exMGPPKGCs73TGJZ4sx+9kylmHeASwdeAN/yVtUjzEKp39cPAV9 lZm25eELXKRi3KKIxviLoaxJ9ba88qcXznv8D4EjQFjPJId0XLf5T4wqjN/5vCpDxdIRJLA1r2f 5eFit14QH+/QxxfgVwtJ+o00mBXaLeuSLptuO2gH0ZIgg== X-Received: by 127.0.0.2 with SMTP id FApjYY7687511xjnfSz8lD5l; Thu, 18 Apr 2024 08:43:56 -0700 X-Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by mx.groups.io with SMTP id smtpd.web11.1931.1713455029985346089 for ; Thu, 18 Apr 2024 08:43:50 -0700 X-Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-5188f5dd62dso2450e87.0 for ; Thu, 18 Apr 2024 08:43:49 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCVNUUgXeyEBRJuhnHqIYWpb/eNWoGoYdI/4z9Ghfm8r52E+dcM7cl1SHgv9A9bxVZ4ktfjmeNWeMnNM9CH0KVMjSBFlyw== X-Gm-Message-State: uoD0XIZLx3z7CLouGRM4rRh3x7686176AA= X-Google-Smtp-Source: AGHT+IHqV7WyEF5Uuz6JP9sFFY8ebZZ5WDf81scT+j7EG1Qmfox7Ej034Ffanll23Nhgs4QiRoLKIZmR8w6qd4swS3U= X-Received: by 2002:a05:6512:2826:b0:517:74e4:fa4a with SMTP id cf38-20020a056512282600b0051774e4fa4amr196140lfb.0.1713455027824; Thu, 18 Apr 2024 08:43:47 -0700 (PDT) MIME-Version: 1.0 References: <20240417165400.3615824-1-acdunlap@google.com> In-Reply-To: From: "Peter Gonda via groups.io" Date: Thu, 18 Apr 2024 09:43:32 -0600 Message-ID: Subject: Re: [edk2-devel] [PATCH] OvmfPkg: Harden #VC instruction emulation somewhat (CVE-2024-25742) To: Adam Dunlap Cc: Gerd Hoffmann , devel@edk2.groups.io, Borislav Petkov , Tom Lendacky Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Thu, 18 Apr 2024 08:43:50 -0700 Resent-From: pgonda@google.com Reply-To: devel@edk2.groups.io,pgonda@google.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240206 header.b="B/uiqD2V"; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io On Thu, Apr 18, 2024 at 9:39=E2=80=AFAM Adam Dunlap w= rote: > > On Thu, Apr 18, 2024 at 5:15=E2=80=AFAM Gerd Hoffmann = wrote: > > > > On Wed, Apr 17, 2024 at 09:54:00AM -0700, Adam Dunlap via groups.io wro= te: > > > + 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? > > Good question. This patch does check for two-byte opcodes with this snipp= et: > > + OpCode =3D *(InstructionData->OpCodes); > + if (OpCode =3D=3D TWO_BYTE_OPCODE_ESCAPE) { > + OpCode =3D *(InstructionData->OpCodes + 1); > + } > > This works because the first byte of two-byte opcodes is always 0x0f in t= he > cases that we're checking for. I was wary about blindly dereferencing two > bytes since that could cause a page fault if it was actually a 1 byte opc= ode > that was at the very end of an allocated region. This is also what is don= e in > the MmioExit function in this file. The linux kernel instruction decoder = is much > more extensive than what is done here and I didn't want to duplicate the > whole thing. > > > On the bigger picture: I'm wondering why SNP allows external #VC > > injections in the first place? > > Yup, I think it'd be better if it didn't. I think this is a small mitigation until linux + edk2 guest's support restricted or alternate interrupt injection. I suggested Adam send this just to have parity between edk2 and linux. -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#117996): https://edk2.groups.io/g/devel/message/117996 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] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-