reverse-24757-use-grant-references.patch - fate#313222 - xenstore-chmod should support 256 permissions 26189-xenstore-chmod.patch - bnc#789945 - VUL-0: CVE-2012-5510: xen: Grant table version switch list corruption vulnerability (XSA-26) CVE-2012-5510-xsa26.patch - bnc#789944 - VUL-0: CVE-2012-5511: xen: Several HVM operations do not validate the range of their inputs (XSA-27) CVE-2012-5511-xsa27.patch - bnc#789951 - VUL-0: CVE-2012-5513: xen: XENMEM_exchange may overwrite hypervisor memory (XSA-29) CVE-2012-5513-xsa29.patch - bnc#789948 - VUL-0: CVE-2012-5514: xen: Missing unlock in guest_physmap_mark_populate_on_demand() (XSA-30) CVE-2012-5514-xsa30.patch - bnc#789950 - VUL-0: CVE-2012-5515: xen: Several memory hypercall operations allow invalid extent order values (XSA-31) CVE-2012-5515-xsa31.patch - bnc#789952 - VUL-0: CVE-2012-5525: xen: Several hypercalls do not validate input GFNs (XSA-32) CVE-2012-5525-xsa32.patch - Upstream patches from Jan 26129-ACPI-BGRT-invalidate.patch 26132-tmem-save-NULL-check.patch 26134-x86-shadow-invlpg-check.patch 26139-cpumap-masking.patch 26148-vcpu-timer-overflow.patch (Replaces CVE-2012-4535-xsa20.patch) OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=219
106 lines
3.6 KiB
Diff
106 lines
3.6 KiB
Diff
References: CVE-2012-5510 XSA-26 bnc#789945
|
|
|
|
gnttab: fix releasing of memory upon switches between versions
|
|
|
|
gnttab_unpopulate_status_frames() incompletely freed the pages
|
|
previously used as status frame in that they did not get removed from
|
|
the domain's xenpage_list, thus causing subsequent list corruption
|
|
when those pages did get allocated again for the same or another purpose.
|
|
|
|
Similarly, grant_table_create() and gnttab_grow_table() both improperly
|
|
clean up in the event of an error - pages already shared with the guest
|
|
can't be freed by just passing them to free_xenheap_page(). Fix this by
|
|
sharing the pages only after all allocations succeeded.
|
|
|
|
This is CVE-2012-5510 / XSA-26.
|
|
|
|
Signed-off-by: Jan Beulich <jbeulich@suse.com>
|
|
Acked-by: Ian Campbell <ian.campbell@citrix.com>
|
|
|
|
--- a/xen/common/grant_table.c
|
|
+++ b/xen/common/grant_table.c
|
|
@@ -1170,12 +1170,13 @@ fault:
|
|
}
|
|
|
|
static int
|
|
-gnttab_populate_status_frames(struct domain *d, struct grant_table *gt)
|
|
+gnttab_populate_status_frames(struct domain *d, struct grant_table *gt,
|
|
+ unsigned int req_nr_frames)
|
|
{
|
|
unsigned i;
|
|
unsigned req_status_frames;
|
|
|
|
- req_status_frames = grant_to_status_frames(gt->nr_grant_frames);
|
|
+ req_status_frames = grant_to_status_frames(req_nr_frames);
|
|
for ( i = nr_status_frames(gt); i < req_status_frames; i++ )
|
|
{
|
|
if ( (gt->status[i] = alloc_xenheap_page()) == NULL )
|
|
@@ -1206,7 +1207,12 @@ gnttab_unpopulate_status_frames(struct d
|
|
|
|
for ( i = 0; i < nr_status_frames(gt); i++ )
|
|
{
|
|
- page_set_owner(virt_to_page(gt->status[i]), dom_xen);
|
|
+ struct page_info *pg = virt_to_page(gt->status[i]);
|
|
+
|
|
+ BUG_ON(page_get_owner(pg) != d);
|
|
+ if ( test_and_clear_bit(_PGC_allocated, &pg->count_info) )
|
|
+ put_page(pg);
|
|
+ BUG_ON(pg->count_info & ~PGC_xen_heap);
|
|
free_xenheap_page(gt->status[i]);
|
|
gt->status[i] = NULL;
|
|
}
|
|
@@ -1244,19 +1250,18 @@ gnttab_grow_table(struct domain *d, unsi
|
|
clear_page(gt->shared_raw[i]);
|
|
}
|
|
|
|
- /* Share the new shared frames with the recipient domain */
|
|
- for ( i = nr_grant_frames(gt); i < req_nr_frames; i++ )
|
|
- gnttab_create_shared_page(d, gt, i);
|
|
-
|
|
- gt->nr_grant_frames = req_nr_frames;
|
|
-
|
|
/* Status pages - version 2 */
|
|
if (gt->gt_version > 1)
|
|
{
|
|
- if ( gnttab_populate_status_frames(d, gt) )
|
|
+ if ( gnttab_populate_status_frames(d, gt, req_nr_frames) )
|
|
goto shared_alloc_failed;
|
|
}
|
|
|
|
+ /* Share the new shared frames with the recipient domain */
|
|
+ for ( i = nr_grant_frames(gt); i < req_nr_frames; i++ )
|
|
+ gnttab_create_shared_page(d, gt, i);
|
|
+ gt->nr_grant_frames = req_nr_frames;
|
|
+
|
|
return 1;
|
|
|
|
shared_alloc_failed:
|
|
@@ -2154,7 +2159,7 @@ gnttab_set_version(XEN_GUEST_HANDLE(gntt
|
|
|
|
if ( op.version == 2 && gt->gt_version < 2 )
|
|
{
|
|
- res = gnttab_populate_status_frames(d, gt);
|
|
+ res = gnttab_populate_status_frames(d, gt, nr_grant_frames(gt));
|
|
if ( res < 0)
|
|
goto out_unlock;
|
|
}
|
|
@@ -2597,14 +2602,15 @@ grant_table_create(
|
|
clear_page(t->shared_raw[i]);
|
|
}
|
|
|
|
- for ( i = 0; i < INITIAL_NR_GRANT_FRAMES; i++ )
|
|
- gnttab_create_shared_page(d, t, i);
|
|
-
|
|
/* Status pages for grant table - for version 2 */
|
|
t->status = xzalloc_array(grant_status_t *,
|
|
grant_to_status_frames(max_nr_grant_frames));
|
|
if ( t->status == NULL )
|
|
goto no_mem_4;
|
|
+
|
|
+ for ( i = 0; i < INITIAL_NR_GRANT_FRAMES; i++ )
|
|
+ gnttab_create_shared_page(d, t, i);
|
|
+
|
|
t->nr_status_frames = 0;
|
|
|
|
/* Okay, install the structure. */
|