[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen stable-4.6] xen/arm: p2m: Restrict usage of get_page_from_gva to the current vCPU
commit 625c3e47e077129b0bc903e8db03bdf1cbbeb413 Author: Julien Grall <julien.grall@xxxxxxx> AuthorDate: Wed Jul 20 17:10:45 2016 +0100 Commit: Stefano Stabellini <sstabellini@xxxxxxxxxx> CommitDate: Mon Aug 1 18:32:28 2016 -0700 xen/arm: p2m: Restrict usage of get_page_from_gva to the current vCPU The function get_page_from_gva translates a guest virtual address to a machine address. The translation involves the register VTTBR_EL2, TTBR0_EL1, TTBR1_EL1 and SCTLR_EL1. Currently, only the first register is context switch is the current domain is not the same. This will result to use the wrong TTBR*_EL1 and SCTLR_EL1 for the translation. To fix the code properly, we would have to context switch all the registers mentioned above when the vCPU in parameter is not the current one. Similar things would need to be done in the callee p2m_mem_check_and_get_page. Given that the only caller of this function with the vCPU that may not be current is a guest debugging function (show_guest_stack), restrict the usage to the current vCPU for the time being. Signed-off-by: Julien Grall <julien.grall@xxxxxxx> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx> --- xen/arch/arm/p2m.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index d08ecc6..f9fa57d 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -1465,24 +1465,16 @@ struct page_info *get_page_from_gva(struct vcpu *v, vaddr_t va, paddr_t maddr = 0; int rc; - spin_lock(&p2m->lock); - - if ( unlikely(d != current->domain) ) - { - unsigned long irq_flags; - - local_irq_save(irq_flags); - p2m_load_VTTBR(d); + /* + * XXX: To support a different vCPU, we would need to load the + * VTTBR_EL2, TTBR0_EL1, TTBR1_EL1 and SCTLR_EL1 + */ + if ( v != current ) + return NULL; - rc = gvirt_to_maddr(va, &maddr, flags); + spin_lock(&p2m->lock); - p2m_load_VTTBR(current->domain); - local_irq_restore(irq_flags); - } - else - { - rc = gvirt_to_maddr(va, &maddr, flags); - } + rc = gvirt_to_maddr(va, &maddr, flags); if ( rc ) goto err; -- generated by git-patchbot for /home/xen/git/xen.git#stable-4.6 _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |