[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] read-only pagetable entries
Hi, At 12:54 -0500 on 28 Jun (1309265682), Srujan Kotikela wrote: > I am trying to see the working of "p2m_change_type". For this I am > passing the PFN of a variable (computed using virt_to_pfn(&variable)) in a > kernel module. Then this PFN is being passed to VMM through a hypercall > (from a HVM guest). In the hypercall handler, I have the following code > (where PFN == GFN) : > > struct vcpu *v = current; > > struct domain *d = v->domain; > > > > p2m_type_t ot; > > mfn_t mfn; > > > > > mfn = gfn_to_mfn(d, gfn , &ot); //find the old type of the gfn > > printk("MFN : %lx\n", mfn); > > printk("OT : %d\n", ot); > > > > p2m_change_type(d, gfn, ot, p2m_ram_ro); You might want to check the return value of p2m_change_type; it does an atomic compare-exchange so it might not have changed the type if another CPU changed the p2m entry under your feet. > After this I tried to assign a new value to variable (to test if the > write request is being dropped). But, the DomU hangs within the kernel > module (insmod command is never being completed). > > I assume this is because I am doing it within a kernel module. Now I am > going to try passing a user process' variable's address to kernel module and > pass it further to hypervisor and repeat the above process. Before that, I > just want to make sure that I am going in the right direction. Yes, that looks basically OK to me. I don't think there's any reason why being in the kernel would make a difference. Did you make sure that no other variables are on the same page as the one you're protecting? Tim. -- Tim Deegan <Tim.Deegan@xxxxxxxxxx> Principal Software Engineer, Xen Platform Team Citrix Systems UK Ltd. (Company #02937203, SL9 0BG) _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |