Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Steve Sistare <steven.sistare@oracle.com>
To: kvm@vger.kernel.org
Cc: Alex Williamson <alex.williamson@redhat.com>,
	Cornelia Huck <cohuck@redhat.com>,
	Jason Gunthorpe <jgg@nvidia.com>,
	Kevin Tian <kevin.tian@intel.com>,
	Steve Sistare <steven.sistare@oracle.com>
Subject: [PATCH V6 0/7] fixes for virtual address update
Date: Fri, 16 Dec 2022 10:50:33 -0800	[thread overview]
Message-ID: <1671216640-157935-1-git-send-email-steven.sistare@oracle.com> (raw)

Fix bugs in the interfaces that allow the underlying memory object of an
iova range to be mapped in a new address space.  They allow userland to
indefinitely block vfio mediated device kernel threads, and do not
propagate the locked_vm count to a new mm.  Also fix a pre-existing bug
that allows locked_vm underflow.

The fixes impose restrictions that eliminate waiting conditions, so
revert the dead code:
  commit 898b9eaeb3fe ("vfio/type1: block on invalid vaddr")
  commit 487ace134053 ("vfio/type1: implement notify callback")
  commit ec5e32940cc9 ("vfio: iommu driver notify callback")

Changes in V2 (thanks Alex):
  * do not allow group attach while vaddrs are invalid
  * add patches to delete dead code
  * add WARN_ON for never-should-happen conditions
  * check for changed mm in unmap.
  * check for vfio_lock_acct failure in remap

Changes in V3 (ditto!):
  * return errno at WARN_ON sites, and make it unique
  * correctly check for dma task mm change
  * change dma owner to current when vaddr is updated
  * add Fixes to commit messages
  * refactored new code in vfio_dma_do_map

Changes in V4:
  * misc cosmetic changes

Changes in V5 (thanks Jason and Kevin):
  * grab mm and use it for locked_vm accounting
  * separate patches for underflow and restoring locked_vm
  * account for reserved pages
  * improve error messages

Changes in V6:
  * drop "count reserved pages" patch
  * add "track locked_vm" patch
  * grab current->mm not group_leader->mm
  * simplify vfio_change_dma_owner
  * fix commit messages

Steve Sistare (7):
  vfio/type1: exclude mdevs from VFIO_UPDATE_VADDR
  vfio/type1: prevent underflow of locked_vm via exec()
  vfio/type1: track locked_vm per dma
  vfio/type1: restore locked_vm
  vfio/type1: revert "block on invalid vaddr"
  vfio/type1: revert "implement notify callback"
  vfio: revert "iommu driver notify callback"

 drivers/vfio/container.c        |   5 -
 drivers/vfio/vfio.h             |   7 --
 drivers/vfio/vfio_iommu_type1.c | 226 ++++++++++++++++++----------------------
 include/uapi/linux/vfio.h       |  15 +--
 4 files changed, 111 insertions(+), 142 deletions(-)

-- 
1.8.3.1


             reply	other threads:[~2022-12-16 18:51 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-16 18:50 Steve Sistare [this message]
2022-12-16 18:50 ` [PATCH V6 1/7] vfio/type1: exclude mdevs from VFIO_UPDATE_VADDR Steve Sistare
2022-12-16 18:50 ` [PATCH V6 2/7] vfio/type1: prevent underflow of locked_vm via exec() Steve Sistare
2022-12-19  7:48   ` Tian, Kevin
2022-12-20 15:01     ` Steven Sistare
2022-12-20 21:59       ` Alex Williamson
2022-12-20 22:06         ` Steven Sistare
2022-12-16 18:50 ` [PATCH V6 3/7] vfio/type1: track locked_vm per dma Steve Sistare
2022-12-19  7:51   ` Tian, Kevin
2022-12-16 18:50 ` [PATCH V6 4/7] vfio/type1: restore locked_vm Steve Sistare
2022-12-19  7:54   ` Tian, Kevin
2022-12-16 18:50 ` [PATCH V6 5/7] vfio/type1: revert "block on invalid vaddr" Steve Sistare
2022-12-19  7:54   ` Tian, Kevin
2022-12-16 18:50 ` [PATCH V6 6/7] vfio/type1: revert "implement notify callback" Steve Sistare
2022-12-19  7:55   ` Tian, Kevin
2022-12-16 18:50 ` [PATCH V6 7/7] vfio: revert "iommu driver " Steve Sistare
2022-12-19  7:55   ` Tian, Kevin
2022-12-19 18:42 ` [PATCH V6 0/7] fixes for virtual address update Steven Sistare
2022-12-19 20:55   ` Alex Williamson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1671216640-157935-1-git-send-email-steven.sistare@oracle.com \
    --to=steven.sistare@oracle.com \
    --cc=alex.williamson@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=jgg@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=kvm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox