mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kyle Zeng <kylebot@openai.com>
To: Jason Gunthorpe <jgg@ziepe.ca>
Cc: iommu@lists.linux.dev, Kevin Tian <kevin.tian@intel.com>,
	linux-kernel@vger.kernel.org, outbounddisclosures@openai.com
Subject: Re: [PATCH] iommufd: Reject opens until module initialization succeeds
Date: Fri, 30 Oct 2026 21:16:40 -0700	[thread overview]
Message-ID: <auVrqO6e2daXFwCW@com-75606> (raw)
In-Reply-To: <20261030120845.GA3889730@ziepe.ca>

On Fri, Oct 30, 2026 at 09:08:45AM -0300, Jason Gunthorpe wrote:
> On Thu, Oct 29, 2026 at 09:23:45PM -0700, Kyle Zeng wrote:
> > iommufd_init() publishes /dev/iommu before registering the optional
> > /dev/vfio/vfio compatibility node and running the optional self-test
> > initialization. Either later operation can fail. Since file operations
> > can acquire a reference to a COMING module, an already-open file can
> > survive the failed initialization and refer to freed iommufd module
> > memory.
> 
> What? This seems like a core bug not iommufd.
> 
> files take refcounts on their modules when they open via this:
> 
> static const struct file_operations iommufd_fops = {
> 	.owner = THIS_MODULE,
> 
> If the module hasn't even loaded yet I would rather expect the core
> code to not allow the module refcount to be taken, and if it somehow
> succeeds then it shouldn't allow the module to get yanked out from
> under it.
> 
> It is hard to guess what crashes to be more specific, but
> at least misc_deregister() is safe while files are open.
> 
> Though I wonder how module auto loading works..
> 
> Jason

Hi Jason,

Sorry for the confusion. This is supposed to be a two-patch series and I
accidentally dropped the first patch.
I'll resend the patch series. Also, I have a reproducer for this issue
and can provide through DM.

Best,
Kyle

      reply	other threads:[~2026-10-31  4:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-30  4:23 Kyle Zeng
2026-10-30 12:08 ` Jason Gunthorpe
2026-10-31  4:16   ` Kyle Zeng [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=auVrqO6e2daXFwCW@com-75606 \
    --to=kylebot@openai.com \
    --cc=iommu@lists.linux.dev \
    --cc=jgg@ziepe.ca \
    --cc=kevin.tian@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=outbounddisclosures@openai.com \
    /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

all inboxes | Powered by JetHome®