Return-Path: Received: from mx3-rdu2.redhat.com ([66.187.233.73] helo=mx1.redhat.com) by Galois.linutronix.de with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fPquY-0008LB-4n for speck@linutronix.de; Mon, 04 Jun 2018 16:56:42 +0200 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C467818BAF6 for ; Mon, 4 Jun 2018 14:56:35 +0000 (UTC) Received: from [10.36.118.26] (unknown [10.36.118.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B1F7E1002943 for ; Mon, 4 Jun 2018 14:56:34 +0000 (UTC) Subject: [MODERATED] Re: [PATCH 1/2] L1TF KVM 1 References: <20180529194214.2600-1-pbonzini@redhat.com> <20180529194239.768D561107@crypto-ml.lab.linutronix.de> <20180601164840.GT24373@char.us.oracle.com> From: Paolo Bonzini Message-ID: <05f11917-932f-c805-629d-518d01a4aa1b@redhat.com> Date: Mon, 4 Jun 2018 16:56:28 +0200 MIME-Version: 1.0 In-Reply-To: <20180601164840.GT24373@char.us.oracle.com> Content-Type: multipart/mixed; boundary="9VIy84eqDNwk2gH9YdgLIryRh5A8VUMu7"; protected-headers="v1" To: speck@linutronix.de List-ID: This is an OpenPGP/MIME encrypted message (RFC 4880 and 3156) --9VIy84eqDNwk2gH9YdgLIryRh5A8VUMu7 Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 01/06/2018 18:48, speck for Konrad Rzeszutek Wilk wrote: > On Tue, May 29, 2018 at 09:42:13PM +0200, speck for Paolo Bonzini wrote= : >> From: Paolo Bonzini >> Subject: [PATCH 1/2] kvm: x86: mitigation for L1 cache terminal fault = vulnerabilities >> >> This patch adds two mitigation modes for CVE-2018-3620, aka L1 termina= l >> fault. The two modes are "vmexit_l1d_flush=3D1" and "vmexit_l1d_flush= =3D2". >> >> "vmexit_l1d_flush=3D2" is simply doing an L1 cache flush on every vmex= it. >> "vmexit_l1d_flush=3D1" is trying to avoid so on vmexits that are "conf= ined" >> in the kind of code that they execute. The idea is based on Intel's >> patches, but the final list of "confined" vmexits isn't quite. >=20 > s/quite/quite fleshed out/ No, not quite based on Intel's patches. :) >> >> Notably, L1 cache flushes are performed on EPT violations (which are >> basically KVM-level page faults), vmexits that involve the emulator, >> and on every KVM_RUN invocation (so each userspace exit). However, >> most vmexits are considered safe. I singled out the emulator because >> it may be a good target for other speculative execution-based threats,= >> and the MMU because it can bring host page tables in the L1 cache. >> >> The mitigation does not in any way try to do anything about hyperthrea= ding; >> it is possible for a sibling thread to read data from the cache during= a >> vmexit, before the host completes the flush, or to read data from the = cache >> while a sibling runs. This part of the work is not ready yet. >> >> For now I'm leaving the default to "vmexit_l1d_flush=3D2", in case we = need >> to push out the patches in an emergency embargo break, but I don't thi= nk >> it's the best setting. The cost is up to 2.5x more expensive vmexits >> on Haswell processors, and 30% on Coffee Lake (for the latter, this is= >> independent of whether microcode or the generic flush code are used). >> >=20 > This looks very much like what Jun had. If this was based off Intel cod= e would > it make sense to give credit to him by saying something along: >=20 > "Ideas and some code based off from Jun .." ? I was not sure who the author of Intel's code was, so I left in the references above. Really the only thing I lifted from there was the L1 flush; the "confined" moniker got stuck in my brain, but all the other code was rewritten from scratch. I'll resend a new version with review comments applied tomorrow or Wednesday. Paolo --9VIy84eqDNwk2gH9YdgLIryRh5A8VUMu7--