Re: [PATCH v3 13/13] nEPT: Inject EPT violation/misconfigration

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

 



Il 09/05/2013 02:53, Jun Nakajima ha scritto:
> +#endif
>  	walker->fault.address = addr;
>  	walker->fault.nested_page_fault = mmu != vcpu->arch.walk_mmu;
>  
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index ca49e19..a44e7fd 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -5310,6 +5310,8 @@ static int handle_ept_violation(struct kvm_vcpu *vcpu)
>  	/* ept page table is present? */
>  	error_code |= (exit_qualification >> 3) & 0x1;
>  
> +	vcpu->arch.exit_qualification = exit_qualification;
> +
>  	return kvm_mmu_page_fault(vcpu, gpa, error_code, NULL, 0);
>  }
>  
> @@ -7426,7 +7428,7 @@ static unsigned long nested_ept_get_cr3(struct kvm_vcpu *vcpu)
>  }
>  
>  static void nested_ept_inject_page_fault(struct kvm_vcpu *vcpu,
> -	struct x86_exception *fault)
> +					struct x86_exception *fault)
>  {
>  	struct vmcs12 *vmcs12;
>  	nested_vmx_vmexit(vcpu);
> @@ -7435,10 +7437,81 @@ static void nested_ept_inject_page_fault(struct kvm_vcpu *vcpu,
>  	 * Note no need to set vmcs12->vm_exit_reason as it is already copied
>  	 * from vmcs02 in nested_vmx_vmexit() above, i.e., EPT_VIOLATION.
>  	 */
> -	vmcs12->exit_qualification = fault->error_code;
> +	if (fault->error_code & PFERR_RSVD_MASK)
> +		vmcs12->vm_exit_reason = EXIT_REASON_EPT_MISCONFIG;
> +	else
> +		vmcs12->vm_exit_reason = EXIT_REASON_EPT_VIOLATION;
> +
> +	vmcs12->exit_qualification = vcpu->arch.exit_qualification;

Not exactly pretty, but I cannot think of anything better.

Paolo
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux