mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Sean Christopherson <seanjc@google.com>
Subject: [GIT PULL] KVM: x86: VMX+TDX changes for 7.4
Date: Thu, 15 Oct 2026 21:44:13 -0700	[thread overview]
Message-ID: <20261016044415.958618-9-seanjc@google.com> (raw)
In-Reply-To: <20261016044415.958618-1-seanjc@google.com>

Tag says "vmx", but this is almost entirely TDX focused.

The INIT_MEM_REGION fixes will conflict with the "coco" branch due to in-place
conversion allowing a null/0 source address:

diff --cc arch/x86/kvm/vmx/tdx.c
index b816331fcc98,2a3acf493cb5..ee1d412b0ee6
--- arch/x86/kvm/vmx/tdx.c
+++ arch/x86/kvm/vmx/tdx.c
@@@ -3233,12 -3274,14 +3272,15 @@@ static int tdx_vcpu_init_mem_region(str
        if (copy_from_user(&region, u64_to_user_ptr(cmd->data), sizeof(region)))
                return -EFAULT;
  
 -      if (!PAGE_ALIGNED(region.source_addr) || !region.source_addr ||
 +      if (!PAGE_ALIGNED(region.source_addr) ||
 +          (!gmem_in_place_conversion && !region.source_addr) ||
-           !PAGE_ALIGNED(region.gpa) || !region.nr_pages ||
-           region.gpa + (region.nr_pages << PAGE_SHIFT) <= region.gpa ||
+           !PAGE_ALIGNED(region.gpa) || !region.nr_pages)
+               return -EINVAL;
+ 
+       if (check_shl_overflow(region.nr_pages, PAGE_SHIFT, &nr_bytes) ||
+           check_add_overflow(region.gpa, nr_bytes - 1, &end_gpa) ||
            !vt_is_tdx_private_gpa(kvm, region.gpa) ||
-           !vt_is_tdx_private_gpa(kvm, region.gpa + (region.nr_pages << PAGE_SHIFT) - 1))
+           !vt_is_tdx_private_gpa(kvm, end_gpa))
                return -EINVAL;
  
        ret = 0;

The vmx=>vt renames will conflict with the "misc" branch because of a collision
with the change to track kvm_vcpu_arch.pending_ioapic_eoi as a u8 (four lines
of code in a function that's been touched _once_ since it was added in 2013,
and somehow I manage to create a conflict in a single release cycle, *sigh*).

diff --cc arch/x86/kvm/vmx/vmx.c
index 686e586f3290,cf32aee0aab7..b341af4c6057
--- arch/x86/kvm/vmx/vmx.c
+++ arch/x86/kvm/vmx/vmx.c
@@@ -5898,10 -5881,11 +5892,10 @@@ static int handle_apic_access(struct kv
  
  static int handle_apic_eoi_induced(struct kvm_vcpu *vcpu)
  {
-       unsigned long exit_qualification = vmx_get_exit_qual(vcpu);
+       unsigned long exit_qualification = vt_get_exit_qual(vcpu);
 -      int vector = exit_qualification & 0xff;
  
        /* EOI-induced VM exit is trap-like and thus no need to adjust IP */
 -      kvm_apic_set_eoi_accelerated(vcpu, vector);
 +      kvm_apic_set_eoi_accelerated(vcpu, exit_qualification & 0xff);
        return 1;
  }
  
The following changes since commit d4b7fb647204f0c81dfeae2d1a708e4d858e0c94:

  Merge branch 'kvm-xen-longmode' into HEAD (2026-09-04 17:35:03 +0200)

are available in the Git repository at:

  https://github.com/kvm-x86/linux.git tags/kvm-x86-vmx-7.4

for you to fetch changes up to 883719f57f5d3898637b130d6db4742471cad618:

  KVM: x86: Clear hardware HLT state when userspace makes a vCPU not-halted (2026-09-28 16:20:35 -0700)

----------------------------------------------------------------
KVM VMX changes for 7.4

 - Enable Notify VM-Exits (now called Instruction Timeout in the SDM) and Bus
   Lock VM-Exits for TDX guests when they're enabled by userspace (KVM forgot
   to wire up the TDX Module knobs).

 - Move all common (between VMX and TDX) APIs/helpers to common.h/main.c, and
   change all namespace prefixes from "vmx" to "vt".

 - Fix a thankfully benign bug (due to other areas of KVM being hardened) where
   usersepace can bypass INIT_MEM_REGION's address wrap check by providing a
   nr_pages that will overflow a u64 when converted to bytes, and fix an also-
   benign off-by-one bug in the check (inclusive vs. exclusive).

 - Set the vmcs.GUEST_ACTIVITY_STATE back to ACTIVE when userspace sets KVM's
   mp_state to anything other than HALTED, e.g. so that a vCPU doesn't get
   stuck in HLT if userspace emulates RESET.

----------------------------------------------------------------
Haotian Jiang (1):
      KVM: TDX: Reject INIT_MEM_REGION if number of bytes would overflow a u64

Keqiang Duan (1):
      KVM: x86: Clear hardware HLT state when userspace makes a vCPU not-halted

Nikolay Borisov (1):
      KVM: TDX: Remove always true ifdef

Sean Christopherson (11):
      KVM: VMX: Formally define KVM's "0xdead" exit reason used for failed VM-Enter
      KVM: VMX: Disallow using to_vmx() in common VT code
      KVM: VMX: Move the shared "IRQs off" exit handler(s) to common code
      KVM: VMX: Move the shared NMI handler/trampoline to common code
      KVM: VMX: Rename posted interrupt prefixes from "vmx" to "vt"
      KVM: VMX: Rename EPT violation handler prefix from "vmx" to "vt"
      KVM: VMX: Use dummy pseudo-overlay struct for to_vt() and vt_to_vcpu()
      KVM: VMX: Move common VT getters/converters to common.h
      KVM: VMX: Rename common exit info getters prefixes from "vmx" to "vt"
      KVM: VMX: Move bus lock handler from main.c => common.h
      KVM: TDX: Fix a benign off-by-one bug on the end GPA for INIT_MEM_REGION

Xiaoyao Li (9):
      KVM: TDX: Enable Notify VM exit
      KVM: TDX: Check if there is valid exit infos based on vp_enter_ret
      KVM: TDX: Set bits 31:16 to 0 and use UNDEFINED when synthesizing exit reason
      KVM: TDX: Don't assume exit_reason[31:16] is all-0 in tdx_to_vmx_exit_reason()
      KVM: TDX: Stuff exit_reason with UNDEFINED on wait_for_sept_zap return
      KVM: VMX: Preserve negative return value in vmx_handle_exit() with bus lock detected
      KVM: VMX: Make handle_bus_lock_vmexit() a shared helper
      KVM: TDX: Enable Bus Lock VM exit
      KVM: VMX: Consolidate the exit handler for VMX and TDX

 arch/x86/include/asm/kvm-x86-ops.h |   1 +
 arch/x86/include/asm/kvm_host.h    |   7 ++
 arch/x86/include/asm/vmx.h         |   8 ++
 arch/x86/kvm/vmx/common.h          |  90 +++++++++++++++-
 arch/x86/kvm/vmx/main.c            | 145 +++++++++++++++++++++++---
 arch/x86/kvm/vmx/nested.c          |  36 +++----
 arch/x86/kvm/vmx/posted_intr.c     |  24 +++--
 arch/x86/kvm/vmx/posted_intr.h     |   8 +-
 arch/x86/kvm/vmx/tdx.c             | 112 +++++++++++++-------
 arch/x86/kvm/vmx/vmx.c             | 205 ++++++++-----------------------------
 arch/x86/kvm/vmx/vmx.h             |  37 -------
 arch/x86/kvm/vmx/x86_ops.h         |   2 +-
 arch/x86/kvm/x86.c                 |  13 +++
 13 files changed, 397 insertions(+), 291 deletions(-)

  parent reply	other threads:[~2026-10-16  4:44 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16  4:44 [GIT PULL] KVM: x86: Pull requests " Sean Christopherson
2026-10-16  4:44 ` [GIT PULL] KVM: x86: Timekeeping fixes+cleanups " Sean Christopherson
2026-10-16  4:44 ` [GIT PULL] KVM: guest_memfd and CoCo changes " Sean Christopherson
2026-10-16  4:44 ` [GIT PULL] KVM: x86: Misc " Sean Christopherson
2026-10-16  4:44 ` [GIT PULL] KVM: x86: MMU " Sean Christopherson
2026-10-16  4:44 ` [GIT PULL] KVM: selftests: Add PPC support Sean Christopherson
2026-10-16  4:44 ` [GIT PULL] KVM: Selftests changes for 7.4 Sean Christopherson
2026-10-16  4:44 ` [GIT PULL] KVM: x86: SVM " Sean Christopherson
2026-10-16  4:44 ` Sean Christopherson [this message]
2026-10-16  9:11 ` [GIT PULL] KVM: x86: Pull requests " Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261016044415.958618-9-seanjc@google.com \
    --to=seanjc@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®