• Paul Mackerras's avatar
    KVM: PPC: Book3S HV: Handle non-present PTEs in page fault functions · ae49deda
    Paul Mackerras authored
    Since cd758a9b "KVM: PPC: Book3S HV: Use __gfn_to_pfn_memslot in HPT
    page fault handler", it's been possible in fairly rare circumstances to
    load a non-present PTE in kvmppc_book3s_hv_page_fault() when running a
    guest on a POWER8 host.
    
    Because that case wasn't checked for, we could misinterpret the non-present
    PTE as being a cache-inhibited PTE.  That could mismatch with the
    corresponding hash PTE, which would cause the function to fail with -EFAULT
    a little further down.  That would propagate up to the KVM_RUN ioctl()
    generally causing the KVM userspace (usually qemu) to fall over.
    
    This addresses the problem by catching that case and returning to the guest
    instead.
    
    For completeness, this fixes the radix page fault handler in the same
    way.  For radix this didn't cause any obvious misbehaviour, because we
    ended up putting the non-present PTE into the guest's partition-scoped
    page tables, leading immediately to another hypervisor data/instruction
    storage interrupt, which would go through the page fault path again
    and fix things up.
    
    Fixes: cd758a9b "KVM: PPC: Book3S HV: Use __gfn_to_pfn_memslot in HPT page fault handler"
    Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1820402Reported-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
    Tested-by: default avatarDavid Gibson <david@gibson.dropbear.id.au>
    Signed-off-by: default avatarPaul Mackerras <paulus@ozlabs.org>
    ae49deda
book3s_64_mmu_radix.c 34.3 KB