Return-Path: Received: from smtp.ctxuk.citrix.com ([185.25.65.24] helo=SMTP.EU.CITRIX.COM) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fO4Pa-0007YN-Ch for speck@linutronix.de; Wed, 30 May 2018 18:57:22 +0200 Subject: [MODERATED] Re: [PATCH 2/2] L1TF KVM 2 References: <20180529194214.2600-1-pbonzini@redhat.com> <20180529194322.8B56F610F8@crypto-ml.lab.linutronix.de> <5f5ee0f8-ac8f-fdee-900c-7a2fed532053@citrix.com> From: Andrew Cooper Message-ID: Date: Wed, 30 May 2018 17:57:13 +0100 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-GB To: speck@linutronix.de List-ID: Content-Transfer-Encoding: 8bit On 30/05/18 09:38, speck for Thomas Gleixner wrote: > On Wed, 30 May 2018, speck for Andrew Cooper wrote: >> On 29/05/2018 20:42, speck for Paolo Bonzini wrote: >> In Xen, I've come to the conclusion that the only viable option here is >> for a guest load-only MSR entry.  Without this, the GPRs at the most >> recent vmentry are still available in the cache (as there is no way for >> the hypervisor to rationally zero them), which results in a guest kenrel >> => guest user leak if a vmentry occurs late in the guest kernels >> return-to-userspace path. >> >> A guest kernel which is implementing the PTE mitigation is immune to >> this attack, but the hypervisor does not know a priori whether this is >> the case or not. > And why would you care about some outdated guest kernel, which is > vulnerable against lots of other stuff as well? That's a very good point.  It need not matter for the guest kernel => user leak. However, to avoid leaking other hypervisor data into guest context, you need to account for the possibility of interrupts/exceptions late in the vmentry path, which includes an NMI hitting on the instruction boundary before vmresume.  Failure to account for this case will, most easily, leak hypervisor GPRs into guest context. Unlike MSR_SPEC_CTRL (which can be written "shortly before the iret/vmentry"), issuing the flush before restoring GPRs is ineffective at preventing leakage, and a write to MSR_FLUSH_CMD cannot be performed after restoring GPRs, other than with a MSR guest load list entry. ~Andrew