• Paul Mackerras's avatar
    KVM: PPC: Book3S HV: Don't give the guest RW access to RO pages · 1cc8ed0b
    Paul Mackerras authored
    Currently, if the guest does an H_PROTECT hcall requesting that the
    permissions on a HPT entry be changed to allow writing, we make the
    requested change even if the page is marked read-only in the host
    Linux page tables.  This is a problem since it would for instance
    allow a guest to modify a page that KSM has decided can be shared
    between multiple guests.
    
    To fix this, if the new permissions for the page allow writing, we need
    to look up the memslot for the page, work out the host virtual address,
    and look up the Linux page tables to get the PTE for the page.  If that
    PTE is read-only, we reduce the HPTE permissions to read-only.
    Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
    Signed-off-by: default avatarAlexander Graf <agraf@suse.de>
    1cc8ed0b
book3s_hv_rm_mmu.c 23.8 KB