kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] KVM: do not assume PTE is writable after follow_pfn
@ 2021-02-05 10:32 Paolo Bonzini
  2021-02-05 10:32 ` [PATCH 1/2] mm: provide a sane PTE walking API for modules Paolo Bonzini
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Paolo Bonzini @ 2021-02-05 10:32 UTC (permalink / raw)
  To: linux-kernel, kvm; +Cc: jgg, linux-mm, Andrew Morton, dan.j.williams

This series is the first step towards fixing KVM's usage of follow_pfn.
The immediate fix here is that KVM is not checking the writability of
the PFN, which actually dates back to way before the introduction of
follow_pfn in commit add6a0cd1c5b ("KVM: MMU: try to fix up page faults
before giving up", 2016-07-05).  There are more changes needed to
invalidate gfn-to-pfn caches from MMU notifiers, but this issue will
be tackled later.

A more fundamental issue however is that the follow_pfn function is
basically impossible to use correctly.  Almost all users for example
are assuming that the page is writable; KVM was not alone in this
mistake.  follow_pte, despite not being exported for modules, is a
far saner API.  Therefore, patch 1 simplifies follow_pte a bit and
makes it available to modules.

Please review and possibly ack for inclusion in the KVM tree,
thanks!

Paolo


Paolo Bonzini (2):
  mm: provide a sane PTE walking API for modules
  KVM: do not assume PTE is writable after follow_pfn

 arch/s390/pci/pci_mmio.c |  2 +-
 fs/dax.c                 |  5 +++--
 include/linux/mm.h       |  6 ++++--
 mm/memory.c              | 35 ++++++++++++++++++++++++++++++-----
 virt/kvm/kvm_main.c      | 15 ++++++++++++---
 5 files changed, 50 insertions(+), 13 deletions(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2021-02-09 10:06 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-05 10:32 [PATCH 0/2] KVM: do not assume PTE is writable after follow_pfn Paolo Bonzini
2021-02-05 10:32 ` [PATCH 1/2] mm: provide a sane PTE walking API for modules Paolo Bonzini
2021-02-05 13:49   ` Jason Gunthorpe
2021-02-08 17:39   ` Christoph Hellwig
2021-02-08 18:18     ` Paolo Bonzini
2021-02-09  8:14       ` Christoph Hellwig
2021-02-09  9:19         ` Paolo Bonzini
2021-02-05 10:32 ` [PATCH 2/2] KVM: do not assume PTE is writable after follow_pfn Paolo Bonzini
2021-02-05 15:43   ` kernel test robot
2021-02-05 17:41   ` kernel test robot
2021-02-05 18:14 ` [PATCH 0/2] " Peter Xu
2021-02-08 18:51   ` Jason Gunthorpe
2021-02-08 22:02     ` Peter Xu
2021-02-08 23:26       ` Jason Gunthorpe
2021-02-09  0:23         ` Peter Xu
2021-02-09  8:19         ` Christoph Hellwig
2021-02-09 10:02           ` Joao Martins

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).