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

Re: [Xen-devel] [PATCH v10] x86/emulate: Send vm_event from emulate


  • To: Tamas K Lengyel <tamas@xxxxxxxxxxxxx>, Razvan COJOCARU <rcojocaru@xxxxxxxxxxxxxxx>
  • From: Razvan COJOCARU <rcojocaru@xxxxxxxxxxxxxxx>
  • Date: Tue, 17 Sep 2019 16:21:56 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=bitdefender.com; dmarc=pass action=none header.from=bitdefender.com; dkim=pass header.d=bitdefender.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1Xq1i20s/+BvTEMRQlV1vLl2tvF97It3VHjhoy6GXsA=; b=EpE3TX4iufnJsnMotmJCpwjSIuLVz5iy89HT60jVOyZ9wEmf84PZoDt/rXludL4o5dGtsF0eprWgMX1A+m2TiNwhu/nxGEnuQ9e1hxuJ+prUtN/kuO/tBCMeIkr7cAm4BOW4/M/dMMtHXWe5Gnxm9EBKyWKwqf8iQTmAJshlaXIxwjqmaDoJXYFPaEjIGUsVommNFs95HpiQ6V1Q+bsMuVi+FR3YllQd6+PnBe/ke7sDILqofR9QAuXgCr0C4Qntr6jfA82+i37HpmivIaRXbqRpqnKwIJD2lcTjZClK/RluD21LCyusaf73uJMQtrmitLm1iYjs0FDvXVfBU2ZM5A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jhKycwkTybSUVIMtbENn/U638XM6b3jQFTGDgf/rpub2KmVYHGbzYSgvRmdiB2EYGcibeebgzJCrI++f5Lz+ICP6y6HkBVcsDIG9RkhU1V+fu9su73jsRLWlNFgc7PHfpI8sP6lp0am/GxU+ug/43ZGiedUQ0b4drLGcF1E44m3BHFq2A4Y7uYTY4b2kE7d2VpeSemwDo1uj+VdSTOrd0NE4lbg+o4WfZ73iFsO4WRGK8zLo+ABuvAQPCnXRIlKHmbvx3u1uEW8WtKpkxAhaGwD0VhMxzltpHQ41JJFqWplFajD+nE6t4teTqkj4/W7rQfS1p//lZFJtk/ZBh6Af+g==
  • Authentication-results: spf=none (sender IP is ) smtp.mailfrom=rcojocaru@xxxxxxxxxxxxxxx;
  • Cc: Petre Ovidiu PIRCALABU <ppircalabu@xxxxxxxxxxxxxxx>, "wl@xxxxxxx" <wl@xxxxxxx>, "george.dunlap@xxxxxxxxxxxxx" <george.dunlap@xxxxxxxxxxxxx>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>, "paul.durrant@xxxxxxxxxx" <paul.durrant@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Alexandru Stefan ISAILA <aisaila@xxxxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "roger.pau@xxxxxxxxxx" <roger.pau@xxxxxxxxxx>
  • Delivery-date: Tue, 17 Sep 2019 16:22:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHVbGY5LYraxeTPu06yM6Qe3Haip6cudlQAgAEKjgCAAATfAIAAZPcAgAA17oD//9pLAIAAE/MA
  • Thread-topic: [Xen-devel] [PATCH v10] x86/emulate: Send vm_event from emulate

On 9/17/19 6:09 PM, Tamas K Lengyel wrote:
> On Tue, Sep 17, 2019 at 8:24 AM Razvan Cojocaru
> <rcojocaru@xxxxxxxxxxxxxxxxxxx> wrote:
>>
>> On 9/17/19 5:11 PM, Alexandru Stefan ISAILA wrote:
>>>>>>> +bool hvm_monitor_check_p2m(unsigned long gla, gfn_t gfn, uint32_t pfec,
>>>>>>> +                           uint16_t kind)
>>>>>>> +{
>>>>>>> +    xenmem_access_t access;
>>>>>>> +    vm_event_request_t req = {};
>>>>>>> +    paddr_t gpa = (gfn_to_gaddr(gfn) | (gla & ~PAGE_MASK));
>>>>>>> +
>>>>>>> +    ASSERT(current->arch.vm_event->send_event);
>>>>>>> +
>>>>>>> +    current->arch.vm_event->send_event = false;
>>>>>>> +
>>>>>>> +    if ( p2m_get_mem_access(current->domain, gfn, &access,
>>>>>>> +                            altp2m_vcpu_idx(current)) != 0 )
>>>>>>> +        return false;
>>>>>> ... next to the call here (but the maintainers of the file would
>>>>>> have to judge in the end). That said, I continue to not understand
>>>>>> why a not found entry means unrestricted access. Isn't it
>>>>>> ->default_access which controls what such a "virtual" entry would
>>>>>> permit?
>>>>> I'm sorry for this misleading comment. The code states that if entry was
>>>>> not found the access will be default_access and return 0. So in this
>>>>> case the default_access will be checked.
>>>>>
>>>>> /* If request to get default access. */
>>>>> if ( gfn_eq(gfn, INVALID_GFN) )
>>>>> {
>>>>>        *access = memaccess[p2m->default_access];
>>>>>        return 0;
>>>>> }
>>>>>
>>>>> If this clears thing up I can remove the "NOTE" part if the comment.
>>>> I'm afraid it doesn't clear things up: I'm still lost as to why
>>>> "entry not found" implies "full access". And I'm further lost as
>>>> to what the code fragment above (dealing with INVALID_GFN, but
>>>> not really the "entry not found" case, which would be INVALID_MFN
>>>> coming back from a translation) is supposed to tell me.
>>>>
>>> It is safe enough to consider a invalid mfn from hostp2 to be a
>>> violation. There is still a small problem with having the altp2m view
>>> not having the page propagated from hostp2m. In this case we have to use
>>> altp2m_get_effective_entry().
>>
>> In the absence of clear guidance from the Intel SDM on what the hardware
>> default is for a page not present in the p2m, we should probably follow
>> Jan's advice and check violations against default_access for such pages.
> 
> The SDM is very clear that pages that are not present in the EPT are a
> violation:
> 
> 28.2.2
> An EPT paging-structure entry is present if any of bits 2:0 is 1;
> otherwise, the entry is not present. The processor
> ignores bits 62:3 and uses the entry neither to reference another EPT
> paging-structure entry nor to produce a
> physical address. A reference using a guest-physical address whose
> translation encounters an EPT paging-struc-
> ture that is not present causes an EPT violation (see Section 28.2.3.2).
> 
> 28.2.3.2
> EPT Violations
> An EPT violation may occur during an access using a guest-physical
> address whose translation does not cause an
> EPT misconfiguration. An EPT violation occurs in any of the following
> situations:
> • Translation of the guest-physical address encounters an EPT
> paging-structure entry that is not present (see
> Section 28.2.2).

Mystery solved. Thanks!
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.