public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Fei Li <fei1.li@intel.com>,
	kvm@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [RFC] UAF in acrn_irqfd_assign() and vfio_virqfd_enable()
Date: Mon, 10 Jun 2024 21:53:05 +0100	[thread overview]
Message-ID: <20240610205305.GE1629371@ZenIV> (raw)
In-Reply-To: <20240610140906.2876b6f6.alex.williamson@redhat.com>

On Mon, Jun 10, 2024 at 02:09:06PM -0600, Alex Williamson wrote:
> > 
> > We could move vfs_poll() under vm->irqfds_lock, but that smells
> > like asking for deadlocks ;-/
> > 
> > vfio_virqfd_enable() has the same problem, except that there we
> > definitely can't move vfs_poll() under the lock - it's a spinlock.
> 
> vfio_virqfd_enable() and vfio_virqfd_disable() are serialized by their
> callers, I don't see that they have a UAF problem.  Thanks,
> 
> Alex

Umm...  I agree that there's no UAF on vfio side; acrn and xen/privcmd
counterparts, OTOH, look like they do have that...

OK, so the memory safety in there depends upon
	* external exclusion wrt vfio_virqfd_disable() on caller-specific
locks (vfio_pci_core_device::ioeventfds_lock for vfio_pci_rdwr.c,
vfio_pci_core_device::igate for the rest?  What about the path via
vfio_pci_core_disable()?)
	* no EPOLLHUP on eventfd while the file is pinned.  That's what
        /*
         * Do not drop the file until the irqfd is fully initialized,
         * otherwise we might race against the EPOLLHUP.
         */
in there (that "irqfd" is a typo for "kirqfd", right?) refers to.

  reply	other threads:[~2024-06-10 20:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20240607015656.GX1629371@ZenIV>
     [not found] ` <20240607015957.2372428-1-viro@zeniv.linux.org.uk>
     [not found]   ` <20240607015957.2372428-11-viro@zeniv.linux.org.uk>
     [not found]     ` <20240607-gelacht-enkel-06a7c9b31d4e@brauner>
     [not found]       ` <20240607161043.GZ1629371@ZenIV>
     [not found]         ` <20240607210814.GC1629371@ZenIV>
2024-06-10  5:12           ` [RFC] UAF in acrn_irqfd_assign() and vfio_virqfd_enable() Al Viro
2024-06-10 17:03             ` Al Viro
2024-06-10 20:09             ` Alex Williamson
2024-06-10 20:53               ` Al Viro [this message]
2024-06-11 23:04                 ` Alex Williamson
2024-06-12  2:16                   ` Al Viro

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=20240610205305.GE1629371@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=alex.williamson@redhat.com \
    --cc=fei1.li@intel.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-fsdevel@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