Patch "KVM: SVM: Clear the CR4 register on reset" has been added to the 5.11-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    KVM: SVM: Clear the CR4 register on reset

to the 5.11-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     kvm-svm-clear-the-cr4-register-on-reset.patch
and it can be found in the queue-5.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 4303d0f9bdb60491e8588bfd2559b708313a8c6b
Author: Babu Moger <babu.moger@xxxxxxx>
Date:   Tue Mar 2 12:51:31 2021 -0600

    KVM: SVM: Clear the CR4 register on reset
    
    [ Upstream commit 9e46f6c6c959d9bb45445c2e8f04a75324a0dfd0 ]
    
    This problem was reported on a SVM guest while executing kexec.
    Kexec fails to load the new kernel when the PCID feature is enabled.
    
    When kexec starts loading the new kernel, it starts the process by
    resetting the vCPU's and then bringing each vCPU online one by one.
    The vCPU reset is supposed to reset all the register states before the
    vCPUs are brought online. However, the CR4 register is not reset during
    this process. If this register is already setup during the last boot,
    all the flags can remain intact. The X86_CR4_PCIDE bit can only be
    enabled in long mode. So, it must be enabled much later in SMP
    initialization.  Having the X86_CR4_PCIDE bit set during SMP boot can
    cause a boot failures.
    
    Fix the issue by resetting the CR4 register in init_vmcb().
    
    Signed-off-by: Babu Moger <babu.moger@xxxxxxx>
    Message-Id: <161471109108.30811.6392805173629704166.stgit@bmoger-ubuntu>
    Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 825ef6d281c9..6a0670548125 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -1205,6 +1205,7 @@ static void init_vmcb(struct vcpu_svm *svm)
 	init_sys_seg(&save->ldtr, SEG_TYPE_LDT);
 	init_sys_seg(&save->tr, SEG_TYPE_BUSY_TSS16);
 
+	svm_set_cr4(&svm->vcpu, 0);
 	svm_set_efer(&svm->vcpu, 0);
 	save->dr6 = 0xffff0ff0;
 	kvm_set_rflags(&svm->vcpu, 2);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux