On 28/03/16 19:55, Ben Sanda wrote:
Julien and George,
Hi Ben,
Sorry for the late answer.
Thank you for the comments. I had one question I wanted to ask.
A DOMID_XEN page could be read only too. For instance, the meta-data
of the trace buffer is read-only (see t_info), we don't want a domain
to be able to overwrite them.
However, all the foreign page are mapped read-write. You will need to
rework the code to map a foreign domain (see
XENMAPSPACE_gmfn_foreign) to allow read-only foreign page (maybe by
adding a new p2m_type_t?).
I understand what you are saying in general, but I'm not familiar
enough with the Xen memory mapping system to know how to actually
implement this. The p2m_type_t p2m_ram_ro exists, which I could assign
to read-only pages, but I'm unsure as to how to detect whether a
request is to a read only mapping or a read-write. The normal (non
DOMID_XEN) p2m_lookup function normally does this by reading the root-
level page tables and somehow extracting the mapping type from the
lpae_t structure. Given that we are not looking up the page tables for
non-translated addresses, I'm not sure where/how to find the correct
mapping type. Can I still lookup the page table entries for the MFN
address and extract the p2m_type_t the same way?
You can know if the page is writable by looking to the page field
u.inuse.type_info (PGT_writable_page means the page is writable).
Regards,
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel