mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
Revert "ANDROID: KVM: arm64: Check pin_user_pages() return value"
This reverts commit 935f60b120.
Bug: 233587962
Signed-off-by: Will Deacon <willdeacon@google.com>
Change-Id: I9f6beae8ee08a04feb33a6d69a2b5ea197579329
This commit is contained in:
@@ -1189,28 +1189,28 @@ static int pkvm_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
|
||||
ret = pin_user_pages(hva, 1, flags, &page, NULL);
|
||||
mmap_read_unlock(mm);
|
||||
|
||||
if (ret == -EHWPOISON) {
|
||||
/*
|
||||
* We really can't deal with page-cache pages returned by GUP
|
||||
* because (a) we may trigger writeback of a page for which we
|
||||
* no longer have access and (b) page_mkclean() won't find the
|
||||
* stage-2 mapping in the rmap so we can get out-of-whack with
|
||||
* the filesystem when marking the page dirty during unpinning.
|
||||
*
|
||||
* Ideally we'd just restrict ourselves to anonymous pages, but
|
||||
* we also want to allow memfd (i.e. shmem) pages, so check for
|
||||
* pages backed by swap in the knowledge that the GUP pin will
|
||||
* prevent try_to_unmap() from succeeding.
|
||||
*/
|
||||
if (!PageSwapBacked(page)) {
|
||||
ret = -EIO;
|
||||
goto dec_account;
|
||||
} else if (ret == -EHWPOISON) {
|
||||
kvm_send_hwpoison_signal(hva, PAGE_SHIFT);
|
||||
ret = 0;
|
||||
goto dec_account;
|
||||
} else if (ret != 1) {
|
||||
ret = -EFAULT;
|
||||
goto dec_account;
|
||||
} else if (!PageSwapBacked(page)) {
|
||||
/*
|
||||
* We really can't deal with page-cache pages returned by GUP
|
||||
* because (a) we may trigger writeback of a page for which we
|
||||
* no longer have access and (b) page_mkclean() won't find the
|
||||
* stage-2 mapping in the rmap so we can get out-of-whack with
|
||||
* the filesystem when marking the page dirty during unpinning.
|
||||
*
|
||||
* Ideally we'd just restrict ourselves to anonymous pages, but
|
||||
* we also want to allow memfd (i.e. shmem) pages, so check for
|
||||
* pages backed by swap in the knowledge that the GUP pin will
|
||||
* prevent try_to_unmap() from succeeding.
|
||||
*/
|
||||
ret = -EIO;
|
||||
goto dec_account;
|
||||
}
|
||||
|
||||
spin_lock(&kvm->mmu_lock);
|
||||
|
||||
Reference in New Issue
Block a user