[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200320221923.GL5122@8bytes.org>
Date: Fri, 20 Mar 2020 23:19:23 +0100
From: Joerg Roedel <joro@...tes.org>
To: David Rientjes <rientjes@...gle.com>
Cc: erdemaktas@...gle.com, x86@...nel.org, hpa@...or.com,
Andy Lutomirski <luto@...nel.org>,
Dave Hansen <dave.hansen@...ux.intel.com>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Hellstrom <thellstrom@...are.com>,
Jiri Slaby <jslaby@...e.cz>,
Dan Williams <dan.j.williams@...el.com>,
Tom Lendacky <thomas.lendacky@....com>,
Juergen Gross <jgross@...e.com>,
Kees Cook <keescook@...omium.org>,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org,
virtualization@...ts.linux-foundation.org,
Joerg Roedel <jroedel@...e.de>
Subject: Re: [PATCH 18/70] x86/boot/compressed/64: Add stage1 #VC handler
On Fri, Mar 20, 2020 at 02:16:39PM -0700, David Rientjes wrote:
> On Thu, 19 Mar 2020, Joerg Roedel wrote:
> > +#define GHCB_SEV_GHCB_RESP_CODE(v) ((v) & 0xfff)
> > +#define VMGEXIT() { asm volatile("rep; vmmcall\n\r"); }
>
> Since preemption and irqs should be disabled before updating the GHCB and
> its MSR and until the contents have been accessed following VMGEXIT,
> should there be checks in place to ensure that's always the case?
Good point, some checking is certainly helpful. Currently it is the
case, because the GHCB is accessed and used only:
1) At boot when only the boot CPU is running
2) In the #VC handler, which does not enable interrupts
3) In the NMI handler, which is also not preemptible
I can also add code to sev_es_get/put_ghcb to make sure these conditions
are met. All this does not prevent the preemption by NMIs, which could
cause another nested #VC exception, but that is handled separatly.
Regards,
Joerg
Powered by blists - more mailing lists