[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-4.1-testing] xen: fix error handling of guest_physmap_mark_populate_on_demand()
# HG changeset patch # User Jan Beulich <jbeulich@xxxxxxxx> # Date 1354647001 0 # Node ID cadc212c8ef30a2bd16c064a08a7bc2121bf3c6a # Parent f81286b3be32cc1292d279013ce61e8636dd8cdb xen: fix error handling of guest_physmap_mark_populate_on_demand() The only user of the "out" label bypasses a necessary unlock, thus enabling the caller to lock up Xen. Also, the function was never meant to be called by a guest for itself, so rather than inspecting the code paths in depth for potential other problems this might cause, and adjusting e.g. the non-guest printk() in the above error path, just disallow the guest access to it. Finally, the printk() (considering its potential of spamming the log, the more that it's not using XENLOG_GUEST), is being converted to P2M_DEBUG(), as debugging is what it apparently was added for in the first place. This is XSA-30 / CVE-2012-5514. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Acked-by: George Dunlap <george.dunlap@xxxxxxxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Committed-by: Ian Jackson <ian.jackson.citrix.com> --- diff -r f81286b3be32 -r cadc212c8ef3 xen/arch/x86/mm/p2m.c --- a/xen/arch/x86/mm/p2m.c Tue Dec 04 18:49:56 2012 +0000 +++ b/xen/arch/x86/mm/p2m.c Tue Dec 04 18:50:01 2012 +0000 @@ -2412,6 +2412,9 @@ guest_physmap_mark_populate_on_demand(st mfn_t omfn; int rc = 0; + if ( !IS_PRIV_FOR(current->domain, d) ) + return -EPERM; + if ( !paging_mode_translate(d) ) return -EINVAL; @@ -2430,8 +2433,7 @@ guest_physmap_mark_populate_on_demand(st omfn = gfn_to_mfn_query(p2m, gfn + i, &ot); if ( p2m_is_ram(ot) ) { - printk("%s: gfn_to_mfn returned type %d!\n", - __func__, ot); + P2M_DEBUG("gfn_to_mfn returned type %d!\n", ot); rc = -EBUSY; goto out; } @@ -2453,10 +2455,10 @@ guest_physmap_mark_populate_on_demand(st BUG_ON(p2m->pod.entry_count < 0); } +out: audit_p2m(p2m, 1); p2m_unlock(p2m); -out: return rc; } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |