diff options
author | Jan Beulich <jbeulich@suse.com> | 2012-12-04 18:38:14 +0000 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2012-12-04 18:38:14 +0000 |
commit | d28573565f35c4b85ca25044e162745523176392 (patch) | |
tree | 636dc772955f4cb20dc972bc19d8419ed8bb0395 /xen/common/memory.c | |
parent | 24ff9723e0398e78355ea4b83df50eafb154d4dc (diff) | |
download | xen-d28573565f35c4b85ca25044e162745523176392.tar.gz xen-d28573565f35c4b85ca25044e162745523176392.tar.bz2 xen-d28573565f35c4b85ca25044e162745523176392.zip |
xen: add missing guest address range checks to XENMEM_exchange handlers
Ever since its existence (3.0.3 iirc) the handler for this has been
using non address range checking guest memory accessors (i.e.
the ones prefixed with two underscores) without first range
checking the accessed space (via guest_handle_okay()), allowing
a guest to access and overwrite hypervisor memory.
This is XSA-29 / CVE-2012-5513.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Committed-by: Ian Jackson <ian.jackson.citrix.com>
Diffstat (limited to 'xen/common/memory.c')
-rw-r--r-- | xen/common/memory.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/xen/common/memory.c b/xen/common/memory.c index 83e266646d..bdb6ed8f35 100644 --- a/xen/common/memory.c +++ b/xen/common/memory.c @@ -308,6 +308,13 @@ static long memory_exchange(XEN_GUEST_HANDLE_PARAM(xen_memory_exchange_t) arg) goto fail_early; } + if ( !guest_handle_okay(exch.in.extent_start, exch.in.nr_extents) || + !guest_handle_okay(exch.out.extent_start, exch.out.nr_extents) ) + { + rc = -EFAULT; + goto fail_early; + } + /* Only privileged guests can allocate multi-page contiguous extents. */ if ( !multipage_allocation_permitted(current->domain, exch.in.extent_order) || |