From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C00E24749C0 for ; Fri, 14 Aug 2026 16:11:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.70 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786723899; cv=none; b=D+u7+gHDZ4AVlemqgFVyKSjBHb7tovSxT29C18mh/CrLBrS6GuPDO1Fh4IUcgE1MJYtAMfwOnEglpwmlyN5f+vTi5jvWEYWkvyTDRQUDQo1wCHiMQu64M0vUpvwICS93l1krTsw6Na8Phcloi56Yio49sXNvj6Yofk1sFkNtk5A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786723899; c=relaxed/simple; bh=Yjwp5sXg8hA+IFzilFQC+IgVznGjRjghxOVmLb6eHpE=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=BHuP8HcQM8DwPKGKptiEDy0ZFCwenAwTZFOKYLJ5mNxGpEXUkBh5naMqCFG04h0l8R9WwxZEw/zZhUgdEaOhO1Qm8C+0QYpT5c5k3rdSI7OLLDzTiE7s9Eqx6kkVxwmikQ60fO5K1IcSDsbQYctDgx5PDY7Y2TJURg7Y7IP1APA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=Qltv+PQx; arc=none smtp.client-ip=209.85.216.70 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="Qltv+PQx" Received: by mail-pj1-f70.google.com with SMTP id 98e67ed59e1d1-392cf18db8eso2047340a91.3 for ; Fri, 14 Aug 2026 09:11:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1786723891; x=1787328691; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:mime-version:date :reply-to:from:to:cc:subject:date:message-id:reply-to:content-type; bh=G1QOpGA/mOfm9r1jqGgG0mT+xGoxs+eURoQ2xm4eLKI=; b=Qltv+PQxSyw0/tlKWfSDW9CAJCpkSRpSUo72cg0XhSi457U0yVVJtSsz3d3BoP3Srg N+6re9DFRj44WFJgMLmqYC1FW1278fOHxmrikTUTlW0r8F8G8AXbQxCMPq27f9zzR4M/ Hbh9SMDHJfesFkRRNqE9xQQAirX85OdReILNlLQ6/fO1t95OY6QrA60t0fXvEyUOXQgL CAc/QXvU2+EueqaywAvO6lGCaT47Lx2KKiY9WuAyPoL4vWQAByyxU/qAedR4uzte0UWN IL3zJIQj+YhTb7TrMXyjRbib65mmVELh9dC1AoIi1xIuUV+WU57pFMbVZ+0N5Uvx2bQH AyMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786723891; x=1787328691; h=content-type:cc:to:from:subject:message-id:mime-version:date :reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=G1QOpGA/mOfm9r1jqGgG0mT+xGoxs+eURoQ2xm4eLKI=; b=ST7Iilpa8ONMfJbDoymW8QmxFv0Q0jIl8NyYllnD0TEw9YNeGrVKg9FG9IkSeGSdOZ w78WRzZ6tQ6YGtTEVI4jCHilzr6ZrLEUaBQzPyJR/8lgiILhxIPzIQAw22bcPtBXdVKx nvDo92dU5Jo8CAxLCvlQc4oGuuuUcTOmwboQbBfajPYqQ4dteqOZh5KHR5kjBjmJOs35 QYr9ugn+070Ao0kQTfUhmK6eq3BXIN+3gno7qlf1zJRU2rIUzgHz4rQsCXpvWl7m2Tat WBcyG4NpKqcuKP0M9UQmzTsxi5q7+KV8I/tk3qcKjjxzGLbtLc2ABkJsSWVwjxS1+/0K Fh7w== X-Forwarded-Encrypted: i=1; AHgh+Rrx7UE5YYF1FocHASB4RTLH21lW8D11+RxQZG3NpjI9Z18eKiZ1M/AAfw7mnnt+yK4euIbqaDzawIlmWNU=@vger.kernel.org X-Gm-Message-State: AOJu0YwpOSUU7nTSfyEOfTCcXxCgfWiECzzVkM5YSDniKITJR1czZTdc M1flQHVFr5FrFXFEaXVs09uWmmZ2ORCXsQDPYEJsA2uq2W3APOw/ybumVcVlP1cvqnlNK3KCh8z y5pKuFg== X-Received: from pjte4.prod.google.com ([2002:a17:90a:c204:b0:38f:749d:db46]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a17:90b:384b:b0:37f:e1af:df22 with SMTP id 98e67ed59e1d1-3933ba90e38mr7162627a91.17.1786723891326; Fri, 14 Aug 2026 09:11:31 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 14 Aug 2026 09:11:26 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.55.0.691.gc56d675ccc-goog Message-ID: <20260814161129.2177118-1-seanjc@google.com> Subject: [PATCH 0/3] KVM: VMX: Harden against interpreting TDX vCPU as vcpu_vmx From: Sean Christopherson To: Sean Christopherson , Paolo Bonzini , Kiryl Shutsemau , Rick Edgecombe Cc: Dave Hansen , kvm@vger.kernel.org, x86@kernel.org, linux-coco@lists.linux.dev, linux-kernel@vger.kernel.org, Xiaoyao Li , Binbin Wu , Kai Huang , Yan Zhao Content-Type: text/plain; charset="UTF-8" Move vmx_handle_exit_irqoff() and all its helpers to main.c, and then poison to_vmx() for the common .c files to harden KVM against misinterpreting a TDX vCPU as a VMX vCPU, i.e. consuming to_vmx() on a TDX vCPU. Spotted when working through the bus lock series. TDX changes are compile-tested only (one of these days I'll track down a host that's fully TDX-capable). Sean Christopherson (3): KVM: VMX: Move the shared "IRQs off" exit handler(s) to common code KVM: VMX: Disallowing using to_vmx() in common VT code KVM: VMX: Rename posted interrupt prefixes from "vmx" to "vt" arch/x86/kvm/vmx/common.h | 6 +++ arch/x86/kvm/vmx/main.c | 75 +++++++++++++++++++++++++++++++- arch/x86/kvm/vmx/posted_intr.c | 18 ++++---- arch/x86/kvm/vmx/posted_intr.h | 8 ++-- arch/x86/kvm/vmx/tdx.c | 4 +- arch/x86/kvm/vmx/vmx.c | 78 +--------------------------------- arch/x86/kvm/vmx/x86_ops.h | 1 - 7 files changed, 97 insertions(+), 93 deletions(-) base-commit: 1b731e5ded480bd1e5546aed35584238661ce72e -- 2.55.0.691.gc56d675ccc-goog