ANDROID: KVM: arm64: Always check state from host_ack_unshare()
Similar to how we failed to cross-check the state from the completer's PoV on the hyp_ack_unshare() path, we fail to do so from host_ack_unshare(). This shouldn't cause problems in practice as this can only be called on the guest_unshare_host() path, and guest currently don't have the ability to share their pages with anybody other than the host. But this again is rather fragile, so let's simply do the proper check -- it isn't very costly thanks to the hyp_vmemmap optimisation. Bug: 381409114 Change-Id: I3770b7db55c579758863e41f50ab30f6a8bb4a0c Signed-off-by: Quentin Perret <qperret@google.com>
This commit is contained in:
@@ -1076,7 +1076,9 @@ static int host_ack_donation(u64 addr, const struct pkvm_mem_transition *tx)
|
||||
|
||||
static int host_ack_unshare(u64 addr, const struct pkvm_mem_transition *tx)
|
||||
{
|
||||
return __host_ack_transition(addr, tx, PKVM_PAGE_SHARED_BORROWED);
|
||||
u64 size = tx->nr_pages * PAGE_SIZE;
|
||||
|
||||
return __host_check_page_state_range(addr, size, PKVM_PAGE_SHARED_BORROWED);
|
||||
}
|
||||
|
||||
static int host_complete_share(u64 addr, const struct pkvm_mem_transition *tx,
|
||||
|
||||
Reference in New Issue
Block a user