[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161007204836.GR19539@ZenIV.linux.org.uk>
Date: Fri, 7 Oct 2016 21:48:36 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Calvin Owens <calvinowens@...com>
Cc: Jeff Layton <jlayton@...chiereds.net>,
"J. Bruce Fields" <bfields@...ldses.org>,
Rusty Russell <rusty@...tcorp.com.au>,
linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
kernel-team@...com
Subject: Re: [PATCH] fs: Assert on module file_operations without an owner
On Fri, Oct 07, 2016 at 01:35:52PM -0700, Calvin Owens wrote:
> Omitting the owner field in file_operations declared in modules is an
> easy mistake to make, and can result in crashes when the module is
> unloaded while userspace is poking the file.
>
> This patch modifies fops_get() to WARN when it encounters a NULL owner,
> since in this case it cannot take a reference on the containing module.
NAK. This is complete crap - we do *NOT* need ->owner on a lot of
file_operations.
* we do not need that on file_operations of a regular file or
directory on a normal filesystem, since that filesystem is not going
away until the file has been closed - ->f_path.mnt is holding a reference
to vfsmount, which is holding a reference to superblock, which is holding
a reference to file_system_type, which is holding a reference to _its_
->owner.
* we do not need that on anything on procfs - module removal is
legal while a procfs file is opened; its cleanup will be blocked for the
duration of ->read(), ->write(), etc. calls.
If anything, we would be better off with modifications that would get
rid of ->owner on file_operations. It's not trivial to do, but it might
be not impossible.
Powered by blists - more mailing lists