• R
    KVM: load_pdptrs() cleanups · c820c2aa
    Rusty Russell 提交于
    load_pdptrs can be handed an invalid cr3, and it should not oops.
    This can happen because we injected #gp in set_cr3() after we set
    vcpu->cr3 to the invalid value, or from kvm_vcpu_ioctl_set_sregs(), or
    memory configuration changes after the guest did set_cr3().
    
    We should also copy the pdpte array once, before checking and
    assigning, otherwise an SMP guest can potentially alter the values
    between the check and the set.
    
    Finally one nitpick: ret = 1 should be done as late as possible: this
    allows GCC to check for unset "ret" should the function change in
    future.
    Signed-off-by: NRusty Russell <rusty@rustcorp.com.au>
    Signed-off-by: NAvi Kivity <avi@qumranet.com>
    c820c2aa
kvm_main.c 71.5 KB