linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Race inotify_rm_watch vs umount
@ 2011-06-10 11:20 OGAWA Hirofumi
  2011-06-10 13:46 ` Eric Paris
  0 siblings, 1 reply; 4+ messages in thread
From: OGAWA Hirofumi @ 2011-06-10 11:20 UTC (permalink / raw)
  To: John McCutchan, Robert Love, Eric Paris; +Cc: linux-kernel, linux-fsdevel

Hi,

I'm looking the race inotify_rm_watch() vs umount(). This race become the
cause of Oops. You can see the oops at

https://bugzilla.kernel.org/show_bug.cgi?id=22602

So, what race?

umount                               inotify_rm_watch
  ...                                  fsnotify_destroy_mark()
                                         fsnotify_destroy_inode_mark()
                                           /* removed from i_fsnotify_marks */
    generic_shutdown_super()
      fsnotify_unmount_inodes()
        put_super()
                                           iput()
                                             iput_final()
                                               /* this is after put_super() */

Like above, inotify doesn't guarantee to call final iput() before
put_super(). With this violation, FS driver can oops.

Well, so, what are requested for inotify?  We can't simply take
sb->s_umount in inotify_rm_watch()?

Any ideas?

Thanks.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

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

* Re: Race inotify_rm_watch vs umount
  2011-06-10 11:20 Race inotify_rm_watch vs umount OGAWA Hirofumi
@ 2011-06-10 13:46 ` Eric Paris
  2011-06-10 14:35   ` Al Viro
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Paris @ 2011-06-10 13:46 UTC (permalink / raw)
  To: OGAWA Hirofumi; +Cc: John McCutchan, Robert Love, linux-kernel, linux-fsdevel

On Fri, 2011-06-10 at 20:20 +0900, OGAWA Hirofumi wrote:
> Hi,
> 
> I'm looking the race inotify_rm_watch() vs umount(). This race become the
> cause of Oops. You can see the oops at
> 
> https://bugzilla.kernel.org/show_bug.cgi?id=22602
> 
> So, what race?

Ok, I see what you are saying, I'll see what I can do.  I'm a little
scared to call something like iput() under a lock though.  I might be
able to make the bigest lock a mutex and fix this....

I'll add this to my test suite.

-Eric
> 
> umount                               inotify_rm_watch
>   ...                                  fsnotify_destroy_mark()
>                                          fsnotify_destroy_inode_mark()
>                                            /* removed from i_fsnotify_marks */
>     generic_shutdown_super()
>       fsnotify_unmount_inodes()
>         put_super()
>                                            iput()
>                                              iput_final()
>                                                /* this is after put_super() */
> 
> Like above, inotify doesn't guarantee to call final iput() before
> put_super(). With this violation, FS driver can oops.
> 
> Well, so, what are requested for inotify?  We can't simply take
> sb->s_umount in inotify_rm_watch()?
> 
> Any ideas?
> 
> Thanks.

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

* Re: Race inotify_rm_watch vs umount
  2011-06-10 13:46 ` Eric Paris
@ 2011-06-10 14:35   ` Al Viro
       [not found]     ` <CAGHUO11rNGU9VMAPQNdXtpQeAixFX6zxJc-tWur1McqbpYpYpQ@mail.gmail.com>
  0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2011-06-10 14:35 UTC (permalink / raw)
  To: Eric Paris
  Cc: OGAWA Hirofumi, John McCutchan, Robert Love, linux-kernel,
	linux-fsdevel

On Fri, Jun 10, 2011 at 09:46:05AM -0400, Eric Paris wrote:
> On Fri, 2011-06-10 at 20:20 +0900, OGAWA Hirofumi wrote:
> > Hi,
> > 
> > I'm looking the race inotify_rm_watch() vs umount(). This race become the
> > cause of Oops. You can see the oops at
> > 
> > https://bugzilla.kernel.org/show_bug.cgi?id=22602
> > 
> > So, what race?
> 
> Ok, I see what you are saying, I'll see what I can do.  I'm a little
> scared to call something like iput() under a lock though.  I might be
> able to make the bigest lock a mutex and fix this....

Which lock would that be?  I don't see any good candidates in there...

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

* Re: Race inotify_rm_watch vs umount
       [not found]     ` <CAGHUO11rNGU9VMAPQNdXtpQeAixFX6zxJc-tWur1McqbpYpYpQ@mail.gmail.com>
@ 2012-03-06 21:09       ` Joseph Salisbury
  0 siblings, 0 replies; 4+ messages in thread
From: Joseph Salisbury @ 2012-03-06 21:09 UTC (permalink / raw)
  To: viro, eparis; +Cc: hirofumi, john, rlove, linux-kernel, linux-fsdevel

On 03/06/2012 04:02 PM, Joseph Salisbury wrote:
>
>
> Forwarded conversation
> Subject: *Race inotify_rm_watch vs umount*
> ------------------------
>
> From: *OGAWA Hirofumi* <hirofumi@mail.parknet.co.jp
> <mailto:hirofumi@mail.parknet.co.jp>>
> Date: Fri, Jun 10, 2011 at 7:20 AM
> To: John McCutchan <john@johnmccutchan.com
> <mailto:john@johnmccutchan.com>>, Robert Love <rlove@rlove.org
> <mailto:rlove@rlove.org>>, Eric Paris <eparis@redhat.com
> <mailto:eparis@redhat.com>>
> Cc: linux-kernel@vger.kernel.org <mailto:linux-kernel@vger.kernel.org>,
> linux-fsdevel@vger.kernel.org <mailto:linux-fsdevel@vger.kernel.org>
>
>
> Hi,
>
> I'm looking the race inotify_rm_watch() vs umount(). This race become the
> cause of Oops. You can see the oops at
>
> https://bugzilla.kernel.org/show_bug.cgi?id=22602
>
> So, what race?
>
> umount                               inotify_rm_watch
>   ...                                  fsnotify_destroy_mark()
>                                          fsnotify_destroy_inode_mark()
>                                            /* removed from
> i_fsnotify_marks */
>     generic_shutdown_super()
>       fsnotify_unmount_inodes()
>         put_super()
>                                            iput()
>                                              iput_final()
>                                                /* this is after
> put_super() */
>
> Like above, inotify doesn't guarantee to call final iput() before
> put_super(). With this violation, FS driver can oops.
>
> Well, so, what are requested for inotify?  We can't simply take
> sb->s_umount in inotify_rm_watch()?
>
> Any ideas?
>
> Thanks.
> --
> OGAWA Hirofumi <hirofumi@mail.parknet.co.jp
> <mailto:hirofumi@mail.parknet.co.jp>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> <mailto:majordomo@vger.kernel.org>
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
> ----------
> From: *Eric Paris* <eparis@redhat.com <mailto:eparis@redhat.com>>
> Date: Fri, Jun 10, 2011 at 9:46 AM
> To: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp
> <mailto:hirofumi@mail.parknet.co.jp>>
> Cc: John McCutchan <john@johnmccutchan.com
> <mailto:john@johnmccutchan.com>>, Robert Love <rlove@rlove.org
> <mailto:rlove@rlove.org>>, linux-kernel@vger.kernel.org
> <mailto:linux-kernel@vger.kernel.org>, linux-fsdevel@vger.kernel.org
> <mailto:linux-fsdevel@vger.kernel.org>
>
>
> Ok, I see what you are saying, I'll see what I can do.  I'm a little
> scared to call something like iput() under a lock though.  I might be
> able to make the bigest lock a mutex and fix this....
>
> I'll add this to my test suite.
>
> -Eric
>  >
>  > umount                               inotify_rm_watch
>  >   ...                                  fsnotify_destroy_mark()
>  >                                          fsnotify_destroy_inode_mark()
>  >                                            /* removed from
> i_fsnotify_marks */
>  >     generic_shutdown_super()
>  >       fsnotify_unmount_inodes()
>  >         put_super()
>  >                                            iput()
>  >                                              iput_final()
>  >                                                /* this is after
> put_super() */
>  >
>  > Like above, inotify doesn't guarantee to call final iput() before
>  > put_super(). With this violation, FS driver can oops.
>  >
>  > Well, so, what are requested for inotify?  We can't simply take
>  > sb->s_umount in inotify_rm_watch()?
>  >
>  > Any ideas?
>  >
>  > Thanks.
>
>
> --
>
> ----------
> From: *Al Viro* <viro@zeniv.linux.org.uk <mailto:viro@zeniv.linux.org.uk>>
> Date: Fri, Jun 10, 2011 at 10:35 AM
> To: Eric Paris <eparis@redhat.com <mailto:eparis@redhat.com>>
> Cc: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp
> <mailto:hirofumi@mail.parknet.co.jp>>, John McCutchan
> <john@johnmccutchan.com <mailto:john@johnmccutchan.com>>, Robert Love
> <rlove@rlove.org <mailto:rlove@rlove.org>>, linux-kernel@vger.kernel.org
> <mailto:linux-kernel@vger.kernel.org>, linux-fsdevel@vger.kernel.org
> <mailto:linux-fsdevel@vger.kernel.org>
>
>
> Which lock would that be?  I don't see any good candidates in there...
>
>

Hello,

It appears this bug still exists in the 3.2 kernel[0].  There was some 
discussion about this bug in this thread and in the bug[1].  However, 
there haven't been any updates in a while.

Has there been any further findings on this issue?

Thanks,

Joe


[0] https://bugs.launchpad.net/ubuntu/+source/linux/+bug/922906
[1] https://bugzilla.kernel.org/show_bug.cgi?id=22602

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

end of thread, other threads:[~2012-03-06 21:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-10 11:20 Race inotify_rm_watch vs umount OGAWA Hirofumi
2011-06-10 13:46 ` Eric Paris
2011-06-10 14:35   ` Al Viro
     [not found]     ` <CAGHUO11rNGU9VMAPQNdXtpQeAixFX6zxJc-tWur1McqbpYpYpQ@mail.gmail.com>
2012-03-06 21:09       ` Joseph Salisbury

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