All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Calvin Owens <calvinowens@fb.com>
Cc: Jeff Layton <jlayton@poochiereds.net>,
	"J. Bruce Fields" <bfields@fieldses.org>,
	Rusty Russell <rusty@rustcorp.com.au>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-team@fb.com
Subject: Re: [PATCH] fs: Assert on module file_operations without an owner
Date: Fri, 7 Oct 2016 21:48:36 +0100	[thread overview]
Message-ID: <20161007204836.GR19539@ZenIV.linux.org.uk> (raw)
In-Reply-To: <48414ef29337b54e2a842bd841f73f01ab74ebe7.1475872278.git.calvinowens@fb.com>

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.

  reply	other threads:[~2016-10-07 20:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-07 20:35 [PATCH] fs: Assert on module file_operations without an owner Calvin Owens
2016-10-07 20:48 ` Al Viro [this message]
2016-10-07 21:18   ` Calvin Owens
2016-10-07 21:39     ` Calvin Owens
2016-10-09  7:04 ` [fs] 148e828376: WARNING: CPU: 0 PID: 407 at fs/open.c:719 do_dentry_open+0x210/0x350 kernel test robot
2016-10-09  7:04   ` [lkp] " kernel test robot

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=20161007204836.GR19539@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=bfields@fieldses.org \
    --cc=calvinowens@fb.com \
    --cc=jlayton@poochiereds.net \
    --cc=kernel-team@fb.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustcorp.com.au \
    /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.