All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: David Laight <David.Laight@ACULAB.COM>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Cc: "nstange@suse.de" <nstange@suse.de>,
	"ap420073@gmail.com" <ap420073@gmail.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"rafael@kernel.org" <rafael@kernel.org>
Subject: Re: [RFC] debugfs: protect against rmmod while files are open
Date: Fri, 09 Oct 2020 12:56:59 +0200	[thread overview]
Message-ID: <793a6ba5b534917018165d38bcb5e2c5704d82c7.camel@sipsolutions.net> (raw)
In-Reply-To: <8fe62082d9774a1fb21894c27e140318@AcuMS.aculab.com>

On Fri, 2020-10-09 at 10:56 +0000, David Laight wrote:
> From: Johannes Berg
> > Sent: 09 October 2020 11:48
> > 
> > On Fri, 2020-10-09 at 12:41 +0200, Johannes Berg wrote:
> > 
> > > If the fops doesn't have a release method, we don't even need
> > > to keep a reference to the real_fops, we can just fops_put()
> > > them already in debugfs remove, and a later full_proxy_release()
> > > won't call anything anyway - this just crashed/UAFed because it
> > > used real_fops, not because there was actually a (now invalid)
> > > release() method.
> > 
> > I actually implemented something a bit better than what I described - we
> > never need a reference to the real_fops for the release method alone,
> > and that means if the release method is in the kernel image, rather than
> > a module, it can still be called.
> > 
> > That together should reduce the ~117 places you changed in the large
> > patchset to around a handful.
> 
> Is there an equivalent problem for normal cdev opens
> in any modules?

I guess so, but since there's no proxy_fops infrastructure and no
revoke(), you can't really do anything else other than adding .owner
properly, afaict.

johannes


  reply	other threads:[~2020-10-09 10:57 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-08 15:48 [PATCH net 000/117] net: avoid to remove module when its debugfs is being used Taehee Yoo
2020-10-08 15:59 ` David Laight
2020-10-08 15:59   ` David Laight
2020-10-08 16:14   ` Johannes Berg
2020-10-08 16:14     ` Johannes Berg
2020-10-08 16:37     ` Taehee Yoo
2020-10-08 16:37       ` Taehee Yoo
2020-10-09  5:38       ` Nicolai Stange
2020-10-09  5:38         ` Nicolai Stange
2020-10-09 10:07         ` Taehee Yoo
2020-10-09 10:07           ` Taehee Yoo
2020-10-09  5:09     ` Nicolai Stange
2020-10-09  5:09       ` Nicolai Stange
2020-10-09  7:45       ` Johannes Berg
2020-10-09  7:45         ` Johannes Berg
2020-10-09 10:15         ` Taehee Yoo
2020-10-09 10:15           ` Taehee Yoo
2020-10-09 10:21           ` Johannes Berg
2020-10-09 10:21             ` Johannes Berg
2020-10-09 10:41             ` [RFC] debugfs: protect against rmmod while files are open Johannes Berg
2020-10-09 10:48               ` Johannes Berg
2020-10-09 10:56                 ` David Laight
2020-10-09 10:56                   ` Johannes Berg [this message]
2020-10-09 11:15                   ` gregkh
2020-10-09 15:33             ` [PATCH net 000/117] net: avoid to remove module when its debugfs is being used Steve deRosier
2020-10-09 15:33               ` Steve deRosier
2020-10-09  7:53       ` [CRAZY-RFF] debugfs: track open files and release on remove Johannes Berg
2020-10-09  8:03         ` Greg KH
2020-10-09  8:06           ` Johannes Berg
2020-10-09  8:16             ` Greg KH
2020-10-09  8:19               ` Johannes Berg
2020-10-09  8:34                 ` David Laight
2020-10-09  8:44                   ` Johannes Berg
2020-10-09  9:00                     ` David Laight
2020-10-09  8:47                 ` Greg KH
2020-10-09  8:48                   ` Johannes Berg
2020-10-10  9:38                     ` Greg KH
2020-10-10 10:47                       ` Johannes Berg

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=793a6ba5b534917018165d38bcb5e2c5704d82c7.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=David.Laight@ACULAB.COM \
    --cc=ap420073@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=nstange@suse.de \
    --cc=rafael@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.