]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: PPC: Book3S HV: Don't give the guest RW access to RO pages
authorPaul Mackerras <paulus@samba.org>
Wed, 21 Nov 2012 23:28:41 +0000 (23:28 +0000)
committerAlexander Graf <agraf@suse.de>
Thu, 6 Dec 2012 00:34:00 +0000 (01:34 +0100)
commit95356dba232cd3e2b63a7e4ab4e494eb1cd22195
treec3c6a12177806a4df19f8ec003c1a609d871707d
parentf4f8270036da43c9a588fc76d161954b021f12f1
KVM: PPC: Book3S HV: Don't give the guest RW access to RO pages

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: Paul Mackerras <paulus@samba.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
arch/powerpc/kvm/book3s_hv_rm_mmu.c