linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] F_SETLEASE mess
@ 2013-07-05  9:04 Al Viro
  2013-07-05 10:51 ` Jeff Layton
  0 siblings, 1 reply; 15+ messages in thread
From: Al Viro @ 2013-07-05  9:04 UTC (permalink / raw)
  To: Jeff Layton; +Cc: linux-fsdevel, Linus Torvalds

	generic_add_lease() with F_WRLCK checks for other openers
in a very crude way - it wants no extra references to dentry (thus
excluding other struct file pointing to it) *and* no extra references
to in-core inode, excluding openers of other links.  It fails with
EAGAIN if those conditions are not met.

	The way it deals with another open(2) racing with it (i.e.
managing to squeeze between the check and locks_insert_lock()) is
theoretically racy; do_dentry_open() would spin on ->i_lock, all
right, but... only if there already is something in inode->i_flock.
If this is the first lease/lock being set, break_lease() will do
nothing, rather than call __break_lease() and spin there.

	It's _very_ hard to hit; we are holding ->i_lock and thus can't
be preempted, so open(2) would have to get *everything* (pathname
lookup, etc.) done in a very narrow window.  So I don't believe it's
exploitable, but it really smells bad.  The check is extremely crude
and if nothing else it's a DoS fodder - a luser that keeps hitting that
file with stat(2) can prevent F_SETLEASE from succeeding, even though
he wouldn't be able to open the damn thing at all...

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-07-08 23:19 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-05  9:04 [RFC] F_SETLEASE mess Al Viro
2013-07-05 10:51 ` Jeff Layton
2013-07-05 12:08   ` Jeff Layton
2013-07-05 16:25     ` Bruce Fields
2013-07-05 21:46       ` Jeff Layton
2013-07-08 14:17         ` Bruce Fields
2013-07-08 14:33           ` Jeff Layton
2013-07-08 18:10           ` Myklebust, Trond
2013-07-08 18:53             ` Bruce Fields
2013-07-08 19:21               ` Myklebust, Trond
2013-07-08 19:34                 ` Bruce Fields
2013-07-08 20:14                   ` Myklebust, Trond
2013-07-08 21:17                     ` Bruce Fields
2013-07-08 22:25                       ` Myklebust, Trond
2013-07-08 23:19                         ` Bruce Fields

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).