mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
gnttab: check values against active entry when copying an already-pinned one
acquire_grant_for_copy() passes to its caller both an MFN and a struct
page_info *. The two really need to be in sync for the get_page()
underlying get_paged_frame() and get_page_type() (both acting on the
passed back struct page_info *) and the map_domain_page() (acting on the
passed back MFN) to achieve the intended effect.
Go further and also check other properties: GTF_transitive / GTF_sub_page
may have been flipped in the shared entry, so respective fields / values
also may not match.
The one field which we can be sure does match (as it was checked earlier
in the function) is ->domid. Add an assertion nevertheless.
This is CVE-2026-62428 / XSA-500.
Fixes: d8cbecb1ee ("grant-tables: Use get_page_from_gfn() instead of get_gfn()/put_gfn")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
This commit is contained in:
1 parent
299de2aeda
commit
61b0a59ce2
1 file changed
+15
@@ -2804,6 +2804,21 @@ acquire_grant_for_copy(
|
||||
act->trans_gref = trans_gref;
|
||||
act->mfn = grant_mfn;
|
||||
}
|
||||
else if ( !mfn_eq(act->mfn, grant_mfn) ||
|
||||
act->src_domid != td->domain_id ||
|
||||
act->trans_gref != trans_gref ||
|
||||
(act->is_sub_page &&
|
||||
(!is_sub_page ||
|
||||
act->start != trans_page_off ||
|
||||
act->length != trans_length)) )
|
||||
{
|
||||
put_page(*page);
|
||||
*page = NULL;
|
||||
rc = GNTST_general_error;
|
||||
goto unlock_out_clear;
|
||||
}
|
||||
else
|
||||
ASSERT(act->domid == ldom);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||