From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: 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 1f8p9B-0004XZ-9P for speck@linutronix.de; Wed, 18 Apr 2018 17:37:27 +0200 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 54DE5AC3B for ; Wed, 18 Apr 2018 15:37:18 +0000 (UTC) Date: Wed, 18 Apr 2018 17:37:13 +0200 From: Borislav Petkov Subject: [MODERATED] Re: ***UNCHECKED*** [patch 3/8] [PATCH v1.3.1 3/7] Linux Patch 3 Message-ID: <20180418153712.GD4290@pd.tnic> References: <20180418141551.07CBB6111A@crypto-ml.lab.linutronix.de> MIME-Version: 1.0 In-Reply-To: <20180418141551.07CBB6111A@crypto-ml.lab.linutronix.de> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable To: speck@linutronix.de List-ID: On Thu, Apr 12, 2018 at 10:26:52PM -0400, speck for konrad.wilk_at_oracle.com= wrote: > diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c > index 561cb228605a..73f76d0f5181 100644 > --- a/arch/x86/kernel/cpu/bugs.c > +++ b/arch/x86/kernel/cpu/bugs.c > @@ -72,6 +72,9 @@ void __init check_bugs(void) > */ > if (!direct_gbpages) > set_memory_4k((unsigned long)__va(0), 1); > + > + if (mdd_at_boot()) > + wrmsrl(MSR_IA32_SPEC_CTRL, SPEC_CTRL_MDD); You can't do this on the common path as that would explode on !Intel. Instead, move that check to init_intel(). And add to init_amd_zn() code reading MSR 0xc0011020, setting bit 10 to 1b and then writing it back in the mdd_at_boot() case. We have a define for that MSR already - MSR_AMD64_LS_CFG. > =20 > @@ -317,7 +320,14 @@ static void __init spectre_v2_select_mitigation(void) > #undef pr_fmt > #define pr_fmt(fmt) "MDD: " fmt > =20 > -static enum md_mitigation md_mode =3D MD_NONE; > +enum md_mitigation md_mode =3D MD_NONE; > +/* When switching from lower privilege level (cpl3) to higher (cpl0). */ > +u64 spec_ctrl_priv; > +EXPORT_SYMBOL_GPL(spec_ctrl_priv); > + > +/* When switching from higher to lower privilege level. */ > +u64 spec_ctrl_unpriv; > +EXPORT_SYMBOL_GPL(spec_ctrl_unpriv); I don't like exporting some arbitrary variables to the rest of the kernel. Do accessors instead pls. --=20 Regards/Gruss, Boris. SUSE Linux GmbH, GF: Felix Imend=C3=B6rffer, Jane Smithard, Graham Norton, HR= B 21284 (AG N=C3=BCrnberg) --=20