On 24/08/18 15:11, Alexandru Isaila wrote:
> diff --git a/xen/arch/x86/mm/mem_access.c b/xen/arch/x86/mm/mem_access.c
> index 03a864156..b01194d 100644
> --- a/xen/arch/x86/mm/mem_access.c
> +++ b/xen/arch/x86/mm/mem_access.c
> @@ -212,7 +212,20 @@ bool p2m_mem_access_check(paddr_t gpa, unsigned long gla,
>           d->arch.monitor.inguest_pagefault_disabled &&
>           npfec.kind != npfec_kind_with_gla ) /* don't send a mem_event */
>      {
> -        hvm_emulate_one_vm_event(EMUL_KIND_NORMAL, TRAP_invalid_op, 
> X86_EVENT_NO_EC);
> +        struct hvm_hw_cpu ctxt;
> +        uint32_t pfec = PFEC_page_present;
> +        unsigned long gfn;
> +        uint32_t gflags;
> +
> +        hvm_funcs.save_cpu_ctxt(v, &ctxt);
> +        paging_get_hostmode(v)->pte_flags(v, p2m, gla, 0, ctxt.cr3, &gflags);
> +        if ( gflags & _PAGE_RW )
> +            pfec |= PFEC_write_access;
> +
> +        if ( gflags & _PAGE_USER )
> +            pfec |= PFEC_user_mode;

As I've tried to explain before, this is architecturally incorrect. 
Both need to be derived from the EPT violation, because they are
properties of instruction which caused the fault, not the mapping which
faulted.

~Andrew

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to