From 75d85afb1df07fc9aca00ae0ca48cdc3fcbb5f87 Mon Sep 17 00:00:00 2001 From: Will Deacon Date: Thu, 7 Jul 2022 15:49:00 +0100 Subject: [PATCH] Revert "ANDROID: KVM: arm64: Only map swap-backed pages into the guest" This reverts commit 14ad77dd00228de25a6fe0bc35d3521e6403373d. Bug: 233587962 Signed-off-by: Will Deacon Change-Id: I42a107a75ec09cd6a721ada5df0aed18a939172a --- arch/arm64/kvm/mmu.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 14b822a187d0..c5855bf53446 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1189,22 +1189,7 @@ 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); - /* - * 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) { + if (ret == -EHWPOISON) { kvm_send_hwpoison_signal(hva, PAGE_SHIFT); ret = 0; goto dec_account;