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

Re: [Xen-devel] Issue policing writes from Xen to PV domain memory

>> This happens only when the access listener first attaches to a PV domain for
>> write events. It occurs in the window between mem_access has been
>enabled and
>> the listener is ready to handle events. I have not seen it happen once the
>> listener starts handling events. And I have not run in to this issue with
>> execute violations.
>Which is still only describing observations, not anything leading to an
>understanding of why this is happening.

>I can only repeat what I said above: You first need to understand
>why the ring is (or appears to be) full. But even with that clarified
>you still need to have a proper solution for the case where the ring
>might end up being full for valid reasons. And as also said earlier, I
>am of the opinion that the behavior regarding Xen accesses would
>ideally not differ between HVM, PVH, and PV.

I dug in further to figure out if there is any difference between HVM and PV 
domains with policing writes emanating from Xen. I started with how the 
runstate area in the guest is updated. It is done using __copy_to_guest(). Here 
is the flow for PV and HVM.

For PV:
__copy_to_guest -> __copy_to_guest_offset -> __raw_copy_to_guest 

I think in the above scenario, the page permissions that are present in the 
shadow are adhered to for PV domains running with shadow and hence faults can 

For HVM:
__copy_to_guest -> __copy_to_guest_offset -> __raw_copy_to_guest -> 
copy_to_user_hvm -> hvm_copy_to_guest_virt_nofault  -> __hvm_copy(flags = 
HVMCOPY_to_guest | HVMCOPY_no_fault | HVMCOPY_virt)

If I look in __hvm_copy(), I see that access permissions are not adhered to. 
Writes to guest memory will go through even if the p2m_access type for that 
page has it set as non-writable.  So it seems that we do not police writes to 
guest memory that emanate from Xen even for the HVM case. Is my reading of the 
code correct?


Xen-devel mailing list



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