linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yosry Ahmed <yosry.ahmed@linux.dev>
To: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
	Jim Mattson <jmattson@google.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Yosry Ahmed <yosry.ahmed@linux.dev>
Subject: [PATCH 00/11] Nested SVM fixes, cleanups, and hardening
Date: Tue,  4 Nov 2025 19:59:38 +0000	[thread overview]
Message-ID: <20251104195949.3528411-1-yosry.ahmed@linux.dev> (raw)

A group of semi-related fixes, cleanups, and hardening patches for nSVM.

Patches 1-3 fix or add missing consistency checks.

Patches 4-5 are renames to clarify some VMCB fields.

Patches 6-10 add hardening to reading the VMCB12, caching all used
fields in the save area to prevent theoritical TOC-TOU bugs, sanitizing
used fields in the control area, and restricting accesses to the VMCB12
through guest memory.

Patch 11 further restricts fields copied from VMCB01 to VMCB12.

Yosry Ahmed (11):
  KVM: nSVM: Fix consistency checks for NP_ENABLE
  KVM: nSVM: Add missing consistency check for EFER, CR0, CR4, and CS
  KVM: nSVM: Add missing consistency check for event_inj
  KVM: SVM: Rename vmcb->nested_ctl to vmcb->misc_ctl
  KVM: SVM: Rename vmcb->virt_ext to vmcb->misc_ctl2
  KVM: SVM: switch svm_copy_lbrs() to a macro
  KVM: nSVM: Cache all used fields from VMCB12
  KVM: nSVM: Restrict mapping VMCB12 on nested VMRUN
  KVM: nSVM: Simplify nested_svm_vmrun()
  KVM: nSVM: Sanitize control fields copied from VMCB12
  KVM: nSVM: Only copy NP_ENABLE from VMCB01's nested_ctl

 arch/x86/include/asm/svm.h                    |  31 +-
 arch/x86/kvm/svm/nested.c                     | 335 +++++++++++-------
 arch/x86/kvm/svm/sev.c                        |   4 +-
 arch/x86/kvm/svm/svm.c                        |  51 ++-
 arch/x86/kvm/svm/svm.h                        |  46 ++-
 tools/testing/selftests/kvm/include/x86/svm.h |  14 +-
 6 files changed, 302 insertions(+), 179 deletions(-)

-- 
2.51.2.1026.g39e6a42477-goog


             reply	other threads:[~2025-11-04 20:00 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-04 19:59 Yosry Ahmed [this message]
2025-11-04 19:59 ` [PATCH 01/11] KVM: nSVM: Fix consistency checks for NP_ENABLE Yosry Ahmed
2025-11-05 18:52   ` Yosry Ahmed
2025-11-04 19:59 ` [PATCH 02/11] KVM: nSVM: Add missing consistency check for EFER, CR0, CR4, and CS Yosry Ahmed
2025-11-04 19:59 ` [PATCH 03/11] KVM: nSVM: Add missing consistency check for event_inj Yosry Ahmed
2025-11-05 18:48   ` Sean Christopherson
2025-11-05 19:29     ` Yosry Ahmed
2025-11-06  1:17       ` Sean Christopherson
2025-11-08  2:29         ` Yosry Ahmed
2025-11-04 19:59 ` [PATCH 04/11] KVM: SVM: Rename vmcb->nested_ctl to vmcb->misc_ctl Yosry Ahmed
2025-11-04 19:59 ` [PATCH 05/11] KVM: SVM: Rename vmcb->virt_ext to vmcb->misc_ctl2 Yosry Ahmed
2025-11-04 19:59 ` [PATCH 06/11] KVM: SVM: switch svm_copy_lbrs() to a macro Yosry Ahmed
2025-11-04 19:59 ` [PATCH 07/11] KVM: nSVM: Cache all used fields from VMCB12 Yosry Ahmed
2025-11-04 19:59 ` [PATCH 08/11] KVM: nSVM: Restrict mapping VMCB12 on nested VMRUN Yosry Ahmed
2025-11-04 19:59 ` [PATCH 09/11] KVM: nSVM: Simplify nested_svm_vmrun() Yosry Ahmed
2025-11-04 19:59 ` [PATCH 10/11] KVM: nSVM: Sanitize control fields copied from VMCB12 Yosry Ahmed
2025-11-04 19:59 ` [PATCH 11/11] KVM: nSVM: Only copy NP_ENABLE from VMCB01's nested_ctl Yosry Ahmed

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=20251104195949.3528411-1-yosry.ahmed@linux.dev \
    --to=yosry.ahmed@linux.dev \
    --cc=jmattson@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=seanjc@google.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;
as well as URLs for NNTP newsgroup(s).