Return-Path: Received: from mail.linutronix.de (146.0.238.70:993) by crypto-ml.lab.linutronix.de with IMAP4-SSL for ; 27 Jun 2018 14:47:17 -0000 Received: from mx2.suse.de ([195.135.220.15]) by Galois.linutronix.de with esmtps (TLS1.0:DHE_RSA_CAMELLIA_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1fYBfm-0006sC-Cx for speck@linutronix.de; Wed, 27 Jun 2018 16:43:55 +0200 Received: from relay1.suse.de (charybdis-ext-too.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 7B102AE6C for ; Wed, 27 Jun 2018 14:43:48 +0000 (UTC) Date: Wed, 27 Jun 2018 16:43:42 +0200 From: Borislav Petkov Subject: [MODERATED] Re: [PATCH v4 1/8] [PATCH v4 1/8] Linux Patch #1 Message-ID: <20180627144342.GE24227@zn.tnic> References: <20180623135445.509403070@localhost.localdomain> MIME-Version: 1.0 In-Reply-To: <20180623135445.509403070@localhost.localdomain> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable To: speck@linutronix.de List-ID: On Sat, Jun 23, 2018 at 09:54:15AM -0400, speck for konrad.wilk_at_oracle.com= wrote: > x86/KVM: Warn user if KVM is loaded SMT and L1TF CPU bug being present. That commit name needs massaging. > If the L1TF CPU bug is present we allow the KVM module to be loaded > as the major of users that use Linux and KVM have trusted guests > and do not want a broken setup. >=20 > Cloud vendors are the ones that are uncomfortable with CVE 2018-3615 > and as such they are the ones that should set disallow_smt to one. >=20 > Setting disallow_smt to means that the system administrator also needs > to disable SMT (Hyper-threading) in the BIOS, or via the 'nosmt' command > line parameter, or via the /sys/devices/system/cpu/smt/control > (see commit 05736e4ac13c cpu/hotplug: Provide knobs to control SMT). >=20 > Other mitigations are to use task affinity, cpu sets, interrupt binding, > etc - anything to make sure that _only_ the same guests vCPUs are running > on sibling threads. >=20 > Signed-off-by: Konrad Rzeszutek Wilk > --- > v3:-Move it to vmx_vcpu_init (could also do it in kvm_vcpu_init but it seem= ed > more prudent to do it in VMX handler. > -Made it WARN if disallow_smt=3D0 > -Made it ERR if disallow_smt=3D1 > -Fixed the CVE number > --- > Documentation/admin-guide/kernel-parameters.txt | 6 ++++++ > arch/x86/kvm/vmx.c | 13 +++++++++++++ > kernel/cpu.c | 1 + > 3 files changed, 20 insertions(+) >=20 > diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentatio= n/admin-guide/kernel-parameters.txt > index 8e29c4b6756f..d59b34d4e62a 100644 > --- a/Documentation/admin-guide/kernel-parameters.txt > +++ b/Documentation/admin-guide/kernel-parameters.txt > @@ -1946,6 +1946,12 @@ > [KVM,ARM] Allow use of GICv4 for direct injection of > LPIs. > =20 > + kvm-intel.disallow_smt=3D[KVM] If the L1TF CPU bug is present and the Why isn't this matching the "nosmt" baremetal parameter so that there's no confusion for the user? > + system has SMT (aka Hyper-Threading) enabled then > + don't allow guests to be created. > + > + Default is 0 (allow guests to be created). > + > kvm-intel.ept=3D [KVM,Intel] Disable extended page tables > (virtualized MMU) support on capable Intel chips. > Default is 1 (enabled) > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > index 559a12b6184d..f08e33fc28ac 100644 > --- a/arch/x86/kvm/vmx.c > +++ b/arch/x86/kvm/vmx.c > @@ -71,6 +71,9 @@ static const struct x86_cpu_id vmx_cpu_id[] =3D { > }; > MODULE_DEVICE_TABLE(x86cpu, vmx_cpu_id); > =20 > +static bool __read_mostly disallow_smt =3D false; > +module_param(disallow_smt, bool, S_IRUGO); ERROR: do not initialise statics to false #69: FILE: arch/x86/kvm/vmx.c:74: +static bool __read_mostly disallow_smt =3D false; > static bool __read_mostly enable_vpid =3D 1; > module_param_named(vpid, enable_vpid, bool, 0444); > =20 --=20 Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imend=C3=B6rffer, Jane Smithard, Graham Norton, HR= B 21284 (AG N=C3=BCrnberg) --=20