Re: [PATCH 4/4] X86: Use KVM CR pin MSRs

From: Andersen, John
Date: Thu Jun 18 2020 - 11:53:01 EST


On Thu, Jun 18, 2020 at 08:38:06AM -0700, Dave Hansen wrote:
> On 6/18/20 8:26 AM, Andersen, John wrote:
> > On Thu, Jun 18, 2020 at 07:41:04AM -0700, Dave Hansen wrote:
> >>> +config PARAVIRT_CR_PIN
> >>> + bool "Paravirtual bit pinning for CR0 and CR4"
> >>> + depends on KVM_GUEST
> >>> + help
> >>> + Select this option to have the virtualised guest request that the
> >>> + hypervisor disallow it from disabling protections set in control
> >>> + registers. The hypervisor will prevent exploits from disabling
> >>> + features such as SMEP, SMAP, UMIP, and WP.
> >>
> >> I'm confused. Does this add support for ""Paravirtual bit pinning", or
> >> actually tell the guest to request pinning by default?
> >>
> >> It says "Select this option to have the virtualised guest request...",
> >> which makes it sound like it affects the default rather than the
> >> availability of the option.
> >
> > How about this
> >
> > Select this option to request protection of SMEP, SMAP, UMIP, and WP
> > control register bits when running paravirtualized under KVM. Protection will
> > be active provided the feature is available host side and kexec is disabled via
> > kconfig or the command line for the guest requesting protection.
>
> It still isn't very clear to me.
>
> Let's pull the config option out of this patch. Enable the feature by
> default and do the command-line processing in this patch.
>
> If you still think a Kconfig option is helpful, add it in a separate
> patch calling out the deficiencies with the boot-time options.

That's right we're going to pull it out anyway and just disable if the
disable_pv_cr_pin command line option is set. Oops. That solves that.

Thank you very much for your review Dave