]> Git Repo - linux.git/commitdiff
Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm
authorLinus Torvalds <[email protected]>
Wed, 4 Dec 2019 19:08:30 +0000 (11:08 -0800)
committerLinus Torvalds <[email protected]>
Wed, 4 Dec 2019 19:08:30 +0000 (11:08 -0800)
Pull more KVM updates from Paolo Bonzini:

 - PPC secure guest support

 - small x86 cleanup

 - fix for an x86-specific out-of-bounds write on a ioctl (not guest
   triggerable, data not attacker-controlled)

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  kvm: vmx: Stop wasting a page for guest_msrs
  KVM: x86: fix out-of-bounds write in KVM_GET_EMULATED_CPUID (CVE-2019-19332)
  Documentation: kvm: Fix mention to number of ioctls classes
  powerpc: Ultravisor: Add PPC_UV config option
  KVM: PPC: Book3S HV: Support reset of secure guest
  KVM: PPC: Book3S HV: Handle memory plug/unplug to secure VM
  KVM: PPC: Book3S HV: Radix changes for secure guest
  KVM: PPC: Book3S HV: Shared pages support for secure guests
  KVM: PPC: Book3S HV: Support for running secure guests
  mm: ksm: Export ksm_madvise()
  KVM x86: Move kvm cpuid support out of svm

1  2 
arch/powerpc/Kconfig
arch/x86/kvm/vmx/vmx.c
mm/ksm.c

diff --combined arch/powerpc/Kconfig
index e446bb5b3f8d7783f9a22eb140706908df539dbf,d7fef29b47c95ce6d7212c9be486a48f92c6c349..1ec34e16ed65d38c1e7a7d0c44e11c01a1fa7a71
@@@ -161,7 -161,6 +161,7 @@@ config PP
        select GENERIC_CMOS_UPDATE
        select GENERIC_CPU_AUTOPROBE
        select GENERIC_CPU_VULNERABILITIES      if PPC_BARRIER_NOSPEC
 +      select GENERIC_EARLY_IOREMAP
        select GENERIC_IRQ_SHOW
        select GENERIC_IRQ_SHOW_LEVEL
        select GENERIC_PCI_IOMAP                if PCI
@@@ -452,6 -451,23 +452,23 @@@ config PPC_TRANSACTIONAL_ME
        help
          Support user-mode Transactional Memory on POWERPC.
  
+ config PPC_UV
+       bool "Ultravisor support"
+       depends on KVM_BOOK3S_HV_POSSIBLE
+       select ZONE_DEVICE
+       select DEV_PAGEMAP_OPS
+       select DEVICE_PRIVATE
+       select MEMORY_HOTPLUG
+       select MEMORY_HOTREMOVE
+       default n
+       help
+         This option paravirtualizes the kernel to run in POWER platforms that
+         supports the Protected Execution Facility (PEF). On such platforms,
+         the ultravisor firmware runs at a privilege level above the
+         hypervisor.
+         If unsure, say "N".
  config LD_HEAD_STUB_CATCH
        bool "Reserve 256 bytes to cope with linker stubs in HEAD text" if EXPERT
        depends on PPC64
@@@ -552,17 -568,6 +569,17 @@@ config RELOCATABL
          setting can still be useful to bootwrappers that need to know the
          load address of the kernel (eg. u-boot/mkimage).
  
 +config RANDOMIZE_BASE
 +      bool "Randomize the address of the kernel image"
 +      depends on (FSL_BOOKE && FLATMEM && PPC32)
 +      depends on RELOCATABLE
 +      help
 +        Randomizes the virtual address at which the kernel image is
 +        loaded, as a security feature that deters exploit attempts
 +        relying on knowledge of the location of kernel internals.
 +
 +        If unsure, say Y.
 +
  config RELOCATABLE_TEST
        bool "Test relocatable kernel"
        depends on (PPC64 && RELOCATABLE)
@@@ -886,33 -891,15 +903,33 @@@ config CMDLIN
          some command-line options at build time by entering them here.  In
          most cases you will need to specify the root device here.
  
 +choice
 +      prompt "Kernel command line type" if CMDLINE != ""
 +      default CMDLINE_FROM_BOOTLOADER
 +
 +config CMDLINE_FROM_BOOTLOADER
 +      bool "Use bootloader kernel arguments if available"
 +      help
 +        Uses the command-line options passed by the boot loader. If
 +        the boot loader doesn't provide any, the default kernel command
 +        string provided in CMDLINE will be used.
 +
 +config CMDLINE_EXTEND
 +      bool "Extend bootloader kernel arguments"
 +      help
 +        The command-line arguments provided by the boot loader will be
 +        appended to the default kernel command string.
 +
  config CMDLINE_FORCE
        bool "Always use the default kernel command string"
 -      depends on CMDLINE_BOOL
        help
          Always use the default kernel command string, even if the boot
          loader passes other arguments to the kernel.
          This is useful if you cannot or don't want to change the
          command-line options your boot loader passes to the kernel.
  
 +endchoice
 +
  config EXTRA_TARGETS
        string "Additional default image types"
        help
@@@ -964,28 -951,6 +981,28 @@@ config PPC_MEM_KEY
  
          If unsure, say y.
  
 +config PPC_SECURE_BOOT
 +      prompt "Enable secure boot support"
 +      bool
 +      depends on PPC_POWERNV
 +      depends on IMA_ARCH_POLICY
 +      help
 +        Systems with firmware secure boot enabled need to define security
 +        policies to extend secure boot to the OS. This config allows a user
 +        to enable OS secure boot on systems that have firmware support for
 +        it. If in doubt say N.
 +
 +config PPC_SECVAR_SYSFS
 +      bool "Enable sysfs interface for POWER secure variables"
 +      default y
 +      depends on PPC_SECURE_BOOT
 +      depends on SYSFS
 +      help
 +        POWER secure variables are managed and controlled by firmware.
 +        These variables are exposed to userspace via sysfs to enable
 +        read/write operations on these variables. Say Y if you have
 +        secure boot enabled and want to expose variables to userspace.
 +
  endmenu
  
  config ISA_DMA_API
diff --combined arch/x86/kvm/vmx/vmx.c
index 1b9ab4166397d49a775365b68cc62da3b2c165a6,e7ea332ad1e8149ac788a5fabaceda1954d763ed..e3394c839dea60a13254e666c446a1237fe8e245
@@@ -1368,6 -1368,14 +1368,6 @@@ void vmx_vcpu_load_vmcs(struct kvm_vcp
                            (unsigned long)&get_cpu_entry_area(cpu)->tss.x86_tss);
                vmcs_writel(HOST_GDTR_BASE, (unsigned long)gdt);   /* 22.2.4 */
  
 -              /*
 -               * VM exits change the host TR limit to 0x67 after a VM
 -               * exit.  This is okay, since 0x67 covers everything except
 -               * the IO bitmap and have have code to handle the IO bitmap
 -               * being lost after a VM exit.
 -               */
 -              BUILD_BUG_ON(IO_BITMAP_OFFSET - 1 != 0x67);
 -
                rdmsrl(MSR_IA32_SYSENTER_ESP, sysenter_esp);
                vmcs_writel(HOST_IA32_SYSENTER_ESP, sysenter_esp); /* 22.2.3 */
  
@@@ -6666,7 -6674,6 +6666,6 @@@ static void vmx_free_vcpu(struct kvm_vc
        free_vpid(vmx->vpid);
        nested_vmx_free_vcpu(vcpu);
        free_loaded_vmcs(vmx->loaded_vmcs);
-       kfree(vmx->guest_msrs);
        kvm_vcpu_uninit(vcpu);
        kmem_cache_free(x86_fpu_cache, vmx->vcpu.arch.user_fpu);
        kmem_cache_free(x86_fpu_cache, vmx->vcpu.arch.guest_fpu);
@@@ -6723,12 -6730,7 +6722,7 @@@ static struct kvm_vcpu *vmx_create_vcpu
                        goto uninit_vcpu;
        }
  
-       vmx->guest_msrs = kmalloc(PAGE_SIZE, GFP_KERNEL_ACCOUNT);
-       BUILD_BUG_ON(ARRAY_SIZE(vmx_msr_index) * sizeof(vmx->guest_msrs[0])
-                    > PAGE_SIZE);
-       if (!vmx->guest_msrs)
-               goto free_pml;
+       BUILD_BUG_ON(ARRAY_SIZE(vmx_msr_index) != NR_SHARED_MSRS);
  
        for (i = 0; i < ARRAY_SIZE(vmx_msr_index); ++i) {
                u32 index = vmx_msr_index[i];
  
        err = alloc_loaded_vmcs(&vmx->vmcs01);
        if (err < 0)
-               goto free_msrs;
+               goto free_pml;
  
        msr_bitmap = vmx->vmcs01.msr_bitmap;
        vmx_disable_intercept_for_msr(msr_bitmap, MSR_IA32_TSC, MSR_TYPE_R);
  
  free_vmcs:
        free_loaded_vmcs(vmx->loaded_vmcs);
- free_msrs:
-       kfree(vmx->guest_msrs);
  free_pml:
        vmx_destroy_pml_buffer(vmx);
  uninit_vcpu:
diff --combined mm/ksm.c
index 7905934cd3ad4c722b96ecd045b0f8e9f42cb4cb,e45b02ad3f0ba1c3af36e84bdacce23c9d1159bf..d17c7d57d0d85648738ed9d38bcb38a72ceceec1
+++ b/mm/ksm.c
@@@ -885,13 -885,13 +885,13 @@@ static int remove_stable_node(struct st
                return 0;
        }
  
 -      if (WARN_ON_ONCE(page_mapped(page))) {
 -              /*
 -               * This should not happen: but if it does, just refuse to let
 -               * merge_across_nodes be switched - there is no need to panic.
 -               */
 -              err = -EBUSY;
 -      } else {
 +      /*
 +       * Page could be still mapped if this races with __mmput() running in
 +       * between ksm_exit() and exit_mmap(). Just refuse to let
 +       * merge_across_nodes/max_page_sharing be switched.
 +       */
 +      err = -EBUSY;
 +      if (!page_mapped(page)) {
                /*
                 * The stable node did not yet appear stale to get_ksm_page(),
                 * since that allows for an unmapped ksm page to be recognized
@@@ -2478,6 -2478,7 +2478,7 @@@ int ksm_madvise(struct vm_area_struct *
  
        return 0;
  }
+ EXPORT_SYMBOL_GPL(ksm_madvise);
  
  int __ksm_enter(struct mm_struct *mm)
  {
This page took 0.075317 seconds and 4 git commands to generate.