From: Al Viro <viro@ZenIV.linux.org.uk>
To: David Miller <davem@davemloft.net>
Cc: adobriyan@gmail.com, netdev@vger.kernel.org
Subject: Re: [PATCH] net: delete /proc THIS_MODULE references
Date: Mon, 15 Jan 2018 23:01:30 +0000 [thread overview]
Message-ID: <20180115230130.GO13338@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20180115.145012.1807423040561212598.davem@davemloft.net>
On Mon, Jan 15, 2018 at 02:50:12PM -0500, David Miller wrote:
> From: Alexey Dobriyan <adobriyan@gmail.com>
> Date: Sat, 13 Jan 2018 20:11:52 +0300
>
> > /proc has been ignoring struct file_operations::owner field for ages.
> >
> > Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
>
> What, then, makes sure that the procfs files are unregistered before the
> referencing module is unloaded?
Procfs interposes a bunch of wrappers for file_operations methods.
Attempt to remove proc_dir_entry marks it as going down and waits for
use count to reach 0. Wrappers check if it's marked and bump the
use count for the duration of actual method call otherwise. IOW,
removal prevents any subsequent method calls and waits for all
calls currently in progress to finish...
> Please explain the situation, and add a reference to the commit that
> made procfs stop using the fops owner field. That commit and it's
> commit message may help explain why all of this is fine.
Umm... It got started in
commit 786d7e1612f0b0adb6046f19b906609e4fe8b1ba
Author: Alexey Dobriyan <adobriyan@sw.ru>
Date: Sun Jul 15 23:39:00 2007 -0700
Fix rmmod/read/write races in /proc entries
Bugger if I remember how long did it take for the dust to settle - there
had been bugs in the original, and it took some time to fix. I think
the last straggler had been
commit 7e0e953bb0cf649f93277ac8fb67ecbb7f7b04a9
Author: Al Viro <viro@zeniv.linux.org.uk>
Date: Sat Feb 21 22:16:11 2015 -0500
procfs: fix race between symlink removals and traversals
and it had been a while between that and the previous one. Of course,
we still might have bugs there, but that's not different from anywhere
else in the kernel...
Procfs file_operations had not been supposed to need ->owner for at least
a decade...
prev parent reply other threads:[~2018-01-15 23:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-13 17:11 [PATCH] net: delete /proc THIS_MODULE references Alexey Dobriyan
2018-01-15 19:50 ` David Miller
2018-01-15 20:40 ` Alexey Dobriyan
2018-01-15 23:01 ` Al Viro [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=20180115230130.GO13338@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=adobriyan@gmail.com \
--cc=davem@davemloft.net \
--cc=netdev@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;
as well as URLs for NNTP newsgroup(s).