[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] arch/arm: add consistency check to REMOVE p2m changes
commit 2add6eaf5b66f558d711d28c9cb5761eae2d1368 Author: Arianna Avanzini <avanzini.arianna@xxxxxxxxx> AuthorDate: Sat Aug 30 18:29:36 2014 +0200 Commit: Ian Campbell <ian.campbell@xxxxxxxxxx> CommitDate: Wed Sep 3 12:49:37 2014 +0100 arch/arm: add consistency check to REMOVE p2m changes Currently, the REMOVE case of the switch in apply_p2m_changes() does not perform any consistency check on the mapping to be removed. More in detail, the code does not check if the guest address to be unmapped is actually mapped to the machine address given as a parameter. This commit adds the above-described consistency check to the REMOVE path of apply_p2m_changes() and lets a warning be emitted when trying to remove a non-existent mapping. This is instrumental to one of the following commits, which implements the possibility to trigger the removal of p2m ranges via the memory_mapping DOMCTL for ARM. Signed-off-by: Arianna Avanzini <avanzini.arianna@xxxxxxxxx> Acked-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> Reviewed-by: Julien Grall <julien.grall@xxxxxxxxxx> Cc: Dario Faggioli <dario.faggioli@xxxxxxxxxx> Cc: Paolo Valente <paolo.valente@xxxxxxxxxx> Cc: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx> Cc: Jan Beulich <JBeulich@xxxxxxxx> Cc: Keir Fraser <keir@xxxxxxx> Cc: Tim Deegan <tim@xxxxxxx> Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Cc: Eric Trudeau <etrudeau@xxxxxxxxxxxx> Cc: Viktor Kleinik <viktor.kleinik@xxxxxxxxxxxxxxx> Cc: Andrii Tseglytskyi <andrii.tseglytskyi@xxxxxxxxxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> --- xen/arch/arm/p2m.c | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 143199b..8f83d17 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -601,6 +601,7 @@ static int apply_one_level(struct domain *d, { /* Progress up to next boundary */ *addr = (*addr + level_size) & level_mask; + *maddr = (*maddr + level_size) & level_mask; return P2M_ONE_PROGRESS_NOP; } @@ -632,12 +633,29 @@ static int apply_one_level(struct domain *d, } } + /* + * Ensure that the guest address addr currently being + * handled (that is in the range given as argument to + * this function) is actually mapped to the corresponding + * machine address in the specified range. maddr here is + * the machine address given to the function, while + * orig_pte.p2m.base is the machine frame number actually + * mapped to the guest address: check if the two correspond. + */ + if ( op == REMOVE && + pfn_to_paddr(orig_pte.p2m.base) != *maddr ) + printk(XENLOG_G_WARNING + "p2m_remove dom%d: mapping at %"PRIpaddr" is of maddr %"PRIpaddr" not %"PRIpaddr" as expected\n", + d->domain_id, *addr, pfn_to_paddr(orig_pte.p2m.base), + *maddr); + *flush = true; memset(&pte, 0x00, sizeof(pte)); p2m_write_pte(entry, pte, flush_cache); *addr += level_size; + *maddr += level_size; p2m->stats.mappings[level]--; -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |