lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230830000633.3158416-3-seanjc@google.com>
Date:   Tue, 29 Aug 2023 17:06:28 -0700
From:   Sean Christopherson <seanjc@...gle.com>
To:     Paolo Bonzini <pbonzini@...hat.com>
Cc:     kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
        Sean Christopherson <seanjc@...gle.com>
Subject: [GIT PULL] KVM: x86: Misc changes for 6.6

Please pull common/misc x86 changes.  The two highlights are overhauling the
emergency reboot code and adding a framework to allow querying if the guest can
use a feature via guest_can_use(vcpu, X86_FEATURE_*) without having to search
through guest CPUID at runtime.

The guest_can_use() changes conflict with LBR virtualization cleanups from the
SVM pull request.  Below is the resolution I've been using.  FWIW, I've been
merging this "misc" branch last in all of my merges to kvm-x86/next, trying to
merge "svm" after "misc" yields a truly ugly conflict (IMO).

diff --cc arch/x86/kvm/svm/svm.c
index 5cf2380c89dd,226b3a780d0f..b21253c9ceb4
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@@ -1004,10 -1017,16 +1040,10 @@@ static struct vmcb *svm_get_lbr_vmcb(st
  void svm_update_lbrv(struct kvm_vcpu *vcpu)
  {
        struct vcpu_svm *svm = to_svm(vcpu);
 -
 -      bool enable_lbrv = svm_get_lbr_msr(svm, MSR_IA32_DEBUGCTLMSR) &
 -                                         DEBUGCTLMSR_LBR;
 -
 -      bool current_enable_lbrv = !!(svm->vmcb->control.virt_ext &
 -                                    LBR_CTL_ENABLE_MASK);
 -
 -      if (unlikely(is_guest_mode(vcpu) && guest_can_use(vcpu, X86_FEATURE_LBRV)))
 -              if (unlikely(svm->nested.ctl.virt_ext & LBR_CTL_ENABLE_MASK))
 -                      enable_lbrv = true;
 +      bool current_enable_lbrv = svm->vmcb->control.virt_ext & LBR_CTL_ENABLE_MASK;
 +      bool enable_lbrv = (svm_get_lbr_vmcb(svm)->save.dbgctl & DEBUGCTLMSR_LBR) ||
-                          (is_guest_mode(vcpu) && svm->lbrv_enabled &&
++                         (is_guest_mode(vcpu) && guest_can_use(vcpu, X86_FEATURE_LBRV) &&
 +                          (svm->nested.ctl.virt_ext & LBR_CTL_ENABLE_MASK));
  
        if (enable_lbrv == current_enable_lbrv)
                return;


The following changes since commit fdf0eaf11452d72945af31804e2a1048ee1b574c:

  Linux 6.5-rc2 (2023-07-16 15:10:37 -0700)

are available in the Git repository at:

  https://github.com/kvm-x86/linux.git tags/kvm-x86-misc-6.6

for you to fetch changes up to 9717efbe5ba3f52d4b3cc637c7f7f6149ea264bb:

  KVM: x86: Disallow guest CPUID lookups when IRQs are disabled (2023-08-17 11:43:32 -0700)

----------------------------------------------------------------
KVM x86 changes for 6.6:

 - Misc cleanups

 - Retry APIC optimized recalculation if a vCPU is added/enabled

 - Overhaul emergency reboot code to bring SVM up to par with VMX, tie the
   "emergency disabling" behavior to KVM actually being loaded, and move all of
   the logic within KVM

 - Fix user triggerable WARNs in SVM where KVM incorrectly assumes the TSC
   ratio MSR can diverge from the default iff TSC scaling is enabled, and clean
   up related code

 - Add a framework to allow "caching" feature flags so that KVM can check if
   the guest can use a feature without needing to search guest CPUID

----------------------------------------------------------------
Li zeming (1):
      x86: kvm: x86: Remove unnecessary initial values of variables

Like Xu (2):
      KVM: x86: Use sysfs_emit() instead of sprintf()
      KVM: x86: Remove break statements that will never be executed

Michal Luczaj (1):
      KVM: x86: Remove x86_emulate_ops::guest_has_long_mode

Sean Christopherson (44):
      KVM: x86: Snapshot host's MSR_IA32_ARCH_CAPABILITIES
      KVM: VMX: Drop unnecessary vmx_fb_clear_ctrl_available "cache"
      KVM: x86: Retry APIC optimized map recalc if vCPU is added/enabled
      x86/reboot: VMCLEAR active VMCSes before emergency reboot
      x86/reboot: Harden virtualization hooks for emergency reboot
      x86/reboot: KVM: Handle VMXOFF in KVM's reboot callback
      x86/reboot: KVM: Disable SVM during reboot via virt/KVM reboot callback
      x86/reboot: Assert that IRQs are disabled when turning off virtualization
      x86/reboot: Hoist "disable virt" helpers above "emergency reboot" path
      x86/reboot: Disable virtualization during reboot iff callback is registered
      x86/reboot: Expose VMCS crash hooks if and only if KVM_{INTEL,AMD} is enabled
      x86/virt: KVM: Open code cpu_has_vmx() in KVM VMX
      x86/virt: KVM: Move VMXOFF helpers into KVM VMX
      KVM: SVM: Make KVM_AMD depend on CPU_SUP_AMD or CPU_SUP_HYGON
      x86/virt: Drop unnecessary check on extended CPUID level in cpu_has_svm()
      x86/virt: KVM: Open code cpu_has_svm() into kvm_is_svm_supported()
      KVM: SVM: Check that the current CPU supports SVM in kvm_is_svm_supported()
      KVM: VMX: Ensure CPU is stable when probing basic VMX support
      x86/virt: KVM: Move "disable SVM" helper into KVM SVM
      KVM: x86: Force kvm_rebooting=true during emergency reboot/crash
      KVM: SVM: Use "standard" stgi() helper when disabling SVM
      KVM: VMX: Skip VMCLEAR logic during emergency reboots if CR4.VMXE=0
      KVM: nSVM: Check instead of asserting on nested TSC scaling support
      KVM: nSVM: Load L1's TSC multiplier based on L1 state, not L2 state
      KVM: nSVM: Use the "outer" helper for writing multiplier to MSR_AMD64_TSC_RATIO
      KVM: SVM: Clean up preemption toggling related to MSR_AMD64_TSC_RATIO
      KVM: x86: Always write vCPU's current TSC offset/ratio in vendor hooks
      KVM: nSVM: Skip writes to MSR_AMD64_TSC_RATIO if guest state isn't loaded
      KVM: x86: Remove WARN sanity check on hypervisor timer vs. UNINITIALIZED vCPU
      KVM: x86: Add a framework for enabling KVM-governed x86 features
      KVM: x86/mmu: Use KVM-governed feature framework to track "GBPAGES enabled"
      KVM: VMX: Recompute "XSAVES enabled" only after CPUID update
      KVM: VMX: Check KVM CPU caps, not just VMX MSR support, for XSAVE enabling
      KVM: VMX: Rename XSAVES control to follow KVM's preferred "ENABLE_XYZ"
      KVM: x86: Use KVM-governed feature framework to track "XSAVES enabled"
      KVM: nVMX: Use KVM-governed feature framework to track "nested VMX enabled"
      KVM: nSVM: Use KVM-governed feature framework to track "NRIPS enabled"
      KVM: nSVM: Use KVM-governed feature framework to track "TSC scaling enabled"
      KVM: nSVM: Use KVM-governed feature framework to track "vVM{SAVE,LOAD} enabled"
      KVM: nSVM: Use KVM-governed feature framework to track "LBRv enabled"
      KVM: nSVM: Use KVM-governed feature framework to track "Pause Filter enabled"
      KVM: nSVM: Use KVM-governed feature framework to track "vGIF enabled"
      KVM: nSVM: Use KVM-governed feature framework to track "vNMI enabled"
      KVM: x86: Disallow guest CPUID lookups when IRQs are disabled

Takahiro Itazuri (1):
      KVM: x86: Advertise host CPUID 0x80000005 in KVM_GET_SUPPORTED_CPUID

Tao Su (1):
      KVM: x86: Advertise AMX-COMPLEX CPUID to userspace

 arch/x86/include/asm/kexec.h     |   2 -
 arch/x86/include/asm/kvm_host.h  |  24 ++++-
 arch/x86/include/asm/reboot.h    |   7 ++
 arch/x86/include/asm/virtext.h   | 154 -------------------------------
 arch/x86/include/asm/vmx.h       |   2 +-
 arch/x86/kernel/crash.c          |  31 -------
 arch/x86/kernel/reboot.c         |  66 ++++++++++----
 arch/x86/kvm/Kconfig             |   2 +-
 arch/x86/kvm/cpuid.c             |  40 ++++++++-
 arch/x86/kvm/cpuid.h             |  46 ++++++++++
 arch/x86/kvm/emulate.c           |   2 -
 arch/x86/kvm/governed_features.h |  21 +++++
 arch/x86/kvm/hyperv.c            |   1 -
 arch/x86/kvm/kvm_emulate.h       |   1 -
 arch/x86/kvm/lapic.c             |  29 +++++-
 arch/x86/kvm/mmu/mmu.c           |  22 +----
 arch/x86/kvm/reverse_cpuid.h     |   1 +
 arch/x86/kvm/svm/nested.c        |  57 +++++++-----
 arch/x86/kvm/svm/svm.c           | 150 +++++++++++++++++++++----------
 arch/x86/kvm/svm/svm.h           |  18 ++--
 arch/x86/kvm/vmx/capabilities.h  |   2 +-
 arch/x86/kvm/vmx/hyperv.c        |   2 +-
 arch/x86/kvm/vmx/nested.c        |  13 +--
 arch/x86/kvm/vmx/nested.h        |   2 +-
 arch/x86/kvm/vmx/vmx.c           | 190 ++++++++++++++++++++-------------------
 arch/x86/kvm/vmx/vmx.h           |   3 +-
 arch/x86/kvm/x86.c               |  46 +++++-----
 arch/x86/kvm/x86.h               |   1 +
 28 files changed, 490 insertions(+), 445 deletions(-)
 delete mode 100644 arch/x86/include/asm/virtext.h
 create mode 100644 arch/x86/kvm/governed_features.h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ