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 1fIbHm-0005os-Cg for speck@linutronix.de; Tue, 15 May 2018 16:50:42 +0200 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3E8AABB42F for ; Tue, 15 May 2018 14:50:36 +0000 (UTC) Received: from [10.36.117.239] (ovpn-117-239.ams2.redhat.com [10.36.117.239]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CF24B16791 for ; Tue, 15 May 2018 14:50:35 +0000 (UTC) Subject: [MODERATED] Re: Settings question References: <20180514175715.GL18407@pd.tnic> From: Paolo Bonzini Message-ID: <7dbfcac5-c32e-351b-7ae7-e40acf0decb9@redhat.com> Date: Tue, 15 May 2018 16:50:34 +0200 MIME-Version: 1.0 In-Reply-To: <20180514175715.GL18407@pd.tnic> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit To: speck@linutronix.de List-ID: On 14/05/2018 19:57, speck for Borislav Petkov wrote: > Hi folks, > > so we just had this question: > > Imagine you boot the *host* with > > spec_store_bypass_disable=3Don > > which means, you enable the mitigation system-wide. Now someone boots > a guest with > > spec_store_bypass_disable=3Doff > > because someone wants performance in the guest and doesn't care about > leaking sensitive info through the side channel. > > Right now the guest can't override the setting because the host has > disabled it system-wide. > > And both use cases have their merits - host-enforced mitigation on vs > guests are allowed to disable the mitigation so as not to pay the perf > penalty. > > What do we allow? We pretty much have to allow only the case where guests can disable SSBD. Having rdmsr/wrmsr vmexits on every context switch would be too expensive, and therefore KVM special cases SPEC_CTRL and lets the guest access it without vmexits. (Some gory and unrelated details, in case you look at the code: rdmsr/wrmsr is also expensive to have on every vmentry, so this is actually enabled lazily. As soon as the VM accesses SPEC_CTRL, it will have to pay the price forever. However, if it doesn't access SPEC_CTRL, there is no penalty. The idea is that once a VM that accesses SPEC_CTRL it is unlikely to stop doing so, especially since we don't have to deal with nasty firmware writers...). Paolo