[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191119050317.GF23085@linux.intel.com>
Date: Mon, 18 Nov 2019 21:03:17 -0800
From: Sean Christopherson <sean.j.christopherson@...el.com>
To: Kai Huang <kai.huang@...ux.intel.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
Peter Zijlstra <peterz@...radead.org>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Paolo Bonzini <pbonzini@...hat.com>,
Radim Krčmář <rkrcmar@...hat.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
Wanpeng Li <wanpengli@...cent.com>,
Jim Mattson <jmattson@...gle.com>,
Joerg Roedel <joro@...tes.org>,
Tony Luck <tony.luck@...el.com>,
Tony W Wang-oc <TonyWWang-oc@...oxin.com>,
Shuah Khan <shuah@...nel.org>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, linux-edac@...r.kernel.org,
linux-kselftest@...r.kernel.org, Borislav Petkov <bp@...e.de>,
Jarkko Sakkinen <jarkko.sakkinen@...ux.intel.com>
Subject: Re: [PATCH v3 04/19] x86/intel: Initialize IA32_FEATURE_CONTROL MSR
at boot
On Tue, Nov 19, 2019 at 05:41:49PM +1300, Kai Huang wrote:
> On Mon, 2019-11-18 at 19:12 -0800, Sean Christopherson wrote:
> > + /*
> > + * Enable VMX if and only if the kernel may do VMXON at some point,
> > + * i.e. KVM is enabled, to avoid unnecessarily adding an attack vector
> > + * for the kernel, e.g. using VMX to hide malicious code.
> > + */
> > + if (cpu_has(c, X86_FEATURE_VMX) && IS_ENABLED(CONFIG_KVM)) {
Hmm, this should more specifically be CONFIG_KVM_INTEL.
> > + msr |= FEAT_CTL_VMX_ENABLED_OUTSIDE_SMX;
> > + if (tboot_enabled())
> > + msr |= FEAT_CTL_VMX_ENABLED_INSIDE_SMX;
> > + }
>
> Why not also take this chance to enable SGX? Or it will come with SGX patch
> series?
The latter. Similar to the KVM check, this shouldn't opt in to SGX unless
the kernel is capable of using SGX.
> > + wrmsrl(MSR_IA32_FEATURE_CONTROL, msr);
> > +}
> > diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
> > index 4a900804a023..b7c6ed0b40b6 100644
> > --- a/arch/x86/kernel/cpu/intel.c
> > +++ b/arch/x86/kernel/cpu/intel.c
> > @@ -755,6 +755,8 @@ static void init_intel(struct cpuinfo_x86 *c)
> > /* Work around errata */
> > srat_detect_node(c);
> >
> > + init_feature_control_msr(c);
>
> Will this compile if you disable CONFIG_X86_FEATURE_CONTROL_MSR?
>
> Provide an empty one in cpu.h if the config is not enabled?
CONFIG_X86_FEATURE_CONTROL_MSR can't be disabled manually, it's selected
by CPU_SUP_INTEL (and by Zhaoxin/Centaur for their relevant patches).
Powered by blists - more mailing lists