[PATCH 0/3] KVM: nSVM: Fixes for SVM_EXIT_CR0_SEL_WRITE injection

Yosry Ahmed posted 3 patches 3 months, 2 weeks ago
arch/x86/kvm/svm/nested.c | 10 ----------
arch/x86/kvm/svm/svm.c    | 34 ++++++++++++++++++++++------------
2 files changed, 22 insertions(+), 22 deletions(-)
[PATCH 0/3] KVM: nSVM: Fixes for SVM_EXIT_CR0_SEL_WRITE injection
Posted by Yosry Ahmed 3 months, 2 weeks ago
A couple of fixes for injecting SVM_EXIT_CR0_SEL_WRITE to L1 when
emulating MOV-to-CR0 or LMSW. LMSW is handled by the emulator even in
some cases where decode assists are enabled, so it's a more important
fix. An example would be if L0 intercepts SVM_EXIT_WRITE_CR0 while L1
intercepts SVM_EXIT_CR0_SEL_WRITE.

Patch is an unrelated cleanup that can be dropped/merged separately.

Yosry Ahmed (3):
  KVM: nSVM: Remove redundant cases in nested_svm_intercept()
  KVM: nSVM: Propagate SVM_EXIT_CR0_SEL_WRITE correctly for LMSW
    emulation
  KVM: nSVM: Avoid incorrect injection of SVM_EXIT_CR0_SEL_WRITE

 arch/x86/kvm/svm/nested.c | 10 ----------
 arch/x86/kvm/svm/svm.c    | 34 ++++++++++++++++++++++------------
 2 files changed, 22 insertions(+), 22 deletions(-)

-- 
2.51.1.821.gb6fe4d2222-goog
Re: [PATCH 0/3] KVM: nSVM: Fixes for SVM_EXIT_CR0_SEL_WRITE injection
Posted by Sean Christopherson 2 months, 4 weeks ago
On Fri, 24 Oct 2025 19:29:15 +0000, Yosry Ahmed wrote:
> A couple of fixes for injecting SVM_EXIT_CR0_SEL_WRITE to L1 when
> emulating MOV-to-CR0 or LMSW. LMSW is handled by the emulator even in
> some cases where decode assists are enabled, so it's a more important
> fix. An example would be if L0 intercepts SVM_EXIT_WRITE_CR0 while L1
> intercepts SVM_EXIT_CR0_SEL_WRITE.
> 
> Patch is an unrelated cleanup that can be dropped/merged separately.
> 
> [...]

Applied to kvm-x86 svm, with the proper stable@ email and the tweaks to
svm_check_intercept().  Thanks!

[1/3] KVM: nSVM: Remove redundant cases in nested_svm_intercept()
      https://github.com/kvm-x86/linux/commit/3d31bdf9cc79
[2/3] KVM: nSVM: Propagate SVM_EXIT_CR0_SEL_WRITE correctly for LMSW emulation
      https://github.com/kvm-x86/linux/commit/5674a76db021
[3/3] KVM: nSVM: Avoid incorrect injection of SVM_EXIT_CR0_SEL_WRITE
      https://github.com/kvm-x86/linux/commit/3d80f4c93d3d

--
https://github.com/kvm-x86/linux/tree/next
Re: [PATCH 0/3] KVM: nSVM: Fixes for SVM_EXIT_CR0_SEL_WRITE injection
Posted by Yosry Ahmed 3 months, 2 weeks ago
On Fri, Oct 24, 2025 at 07:29:15PM +0000, Yosry Ahmed wrote:
> A couple of fixes for injecting SVM_EXIT_CR0_SEL_WRITE to L1 when
> emulating MOV-to-CR0 or LMSW. LMSW is handled by the emulator even in
> some cases where decode assists are enabled, so it's a more important
> fix. An example would be if L0 intercepts SVM_EXIT_WRITE_CR0 while L1
> intercepts SVM_EXIT_CR0_SEL_WRITE.
> 
> Patch is an unrelated cleanup that can be dropped/merged separately.

Patch 1*

Also, related tests:
https://lore.kernel.org/kvm/20251024194925.3201933-1-yosry.ahmed@linux.dev/

> 
> Yosry Ahmed (3):
>   KVM: nSVM: Remove redundant cases in nested_svm_intercept()
>   KVM: nSVM: Propagate SVM_EXIT_CR0_SEL_WRITE correctly for LMSW
>     emulation
>   KVM: nSVM: Avoid incorrect injection of SVM_EXIT_CR0_SEL_WRITE
> 
>  arch/x86/kvm/svm/nested.c | 10 ----------
>  arch/x86/kvm/svm/svm.c    | 34 ++++++++++++++++++++++------------
>  2 files changed, 22 insertions(+), 22 deletions(-)
> 
> -- 
> 2.51.1.821.gb6fe4d2222-goog
>