]> xenbits.xensource.com Git - xen.git/commit
gnttab: deal with status frame mapping race
authorJan Beulich <jbeulich@suse.com>
Wed, 8 Sep 2021 12:57:31 +0000 (14:57 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 8 Sep 2021 12:57:31 +0000 (14:57 +0200)
commit9c4b19c110e1410e50a9f1dbd15d337b05e9cc9d
treea74c489ee96192c2c64bb78ef9d019b6b92adf18
parenta94d697376058c8043e7273c4d8d8e5cc86ebd3d
gnttab: deal with status frame mapping race

Once gnttab_map_frame() drops the grant table lock, the MFN it reports
back to its caller is free to other manipulation. In particular
gnttab_unpopulate_status_frames() might free it, by a racing request on
another CPU, thus resulting in a reference to a deallocated page getting
added to a domain's P2M.

Obtain a page reference in gnttab_map_frame() to prevent freeing of the
page until xenmem_add_to_physmap_one() has actually completed its acting
on the page. Do so uniformly, even if only strictly required for v2
status pages, to avoid extra conditionals (which then would all need to
be kept in sync going forward).

This is CVE-2021-28701 / XSA-384.

Reported-by: Julien Grall <jgrall@amazon.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Julien Grall <jgrall@amazon.com>
master commit: eb6bbf7b30da5bae87932514d54d0e3c68b23757
master date: 2021-09-08 14:37:45 +0200
xen/arch/arm/mm.c
xen/arch/x86/mm.c
xen/common/grant_table.c