Kernel KVM virtualization development
 help / color / mirror / Atom feed
From: Alex Williamson <alex@shazbot.org>
To: Aaron Lewis <aaronlewis@google.com>
Cc: Jason Gunthorpe <jgg@nvidia.com>,
	kvm@vger.kernel.org, dmatlack@google.com, alex@shazbot.org
Subject: Re: [PATCH 0/3] vfio/type1: Fix pin leaks for reserved GUP-pinned pages
Date: Wed, 25 Nov 2026 12:34:32 -0700	[thread overview]
Message-ID: <20261125123432.353f392d@shazbot.org> (raw)
In-Reply-To: <CAAAPnDH=qUXK+Lv75=Ra3XJ-KO++9XX+VYNjxHSQA=qM1d9_Mg@mail.gmail.com>

On Fri, 20 Nov 2026 08:59:04 -0800
Aaron Lewis <aaronlewis@google.com> wrote:

> On Thu, Nov 19, 2026 at 12:27 PM Jason Gunthorpe <jgg@nvidia.com> wrote:
> >
> > On Thu, Nov 19, 2026 at 06:56:56PM +0000, Aaron Lewis wrote:  
> > > vfio/type1 uses PageReserved(), via is_invalid_reserved_pfn(), to guess
> > > whether a pfn was GUP-pinned or came from a VM_PFNMAP mapping. Reserved
> > > pfns are assumed to be PFNMAP, so they are not accounted in locked_vm
> > > and are never unpinned.  
> >
> > Please just use iommufd if you are running into real cases where this
> > doesn't work right :\
> >
> > Jason  
> 
> Is there any appetite to at least take patches 1 & 2? Patch 2 fixes a
> real problem with DMA mapping/unmapping where DevDax pages are properly
> refcounted during DMA mapping, but leaked during DMA unmapping. It
> fixes that by tracking whether pages were GUP-pinned or PFNMAP'd, so
> unmapping has the context to do the right thing rather than relying on
> a heuristic that makes its best guess.

While I would endorse using iommufd rather than type1, I don't think we
can entirely write it off for bug fixes yet.

Are you only suggesting 1 & 2 because the RLIMIT enforcement is user
visible in 3?  I'd tend to think we should consider them all, they're
real fixes, even if the usage scope is pretty narrow, currently.

More reviews would of course be welcome.  Thanks,

Alex

      reply	other threads:[~2026-11-25 19:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-19 18:56 [PATCH 0/3] vfio/type1: Fix pin leaks for reserved GUP-pinned pages Aaron Lewis
2026-11-19 18:56 ` [PATCH 1/3] vfio/type1: Skip reserved PFNs in vpfn_pages() Aaron Lewis
2026-11-19 18:56 ` [PATCH 2/3] vfio/type1: Track GUP vs PFNMAP in DMA map/unmap Aaron Lewis
2026-11-19 19:12   ` sashiko-bot
2026-11-19 18:56 ` [PATCH 3/3] vfio/type1: Track GUP vs PFNMAP in external page pinning Aaron Lewis
2026-11-19 20:27 ` [PATCH 0/3] vfio/type1: Fix pin leaks for reserved GUP-pinned pages Jason Gunthorpe
2026-11-20 16:59   ` Aaron Lewis
2026-11-25 19:34     ` Alex Williamson [this message]

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=20261125123432.353f392d@shazbot.org \
    --to=alex@shazbot.org \
    --cc=aaronlewis@google.com \
    --cc=dmatlack@google.com \
    --cc=jgg@nvidia.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