Skip to contentSkip to conversation

Race inotify_rm_watch vs umount

DISCUSSION OGAWA Hirofumi 4 participants 4 messages Jun 10, 2011 – Mar 6, 2012 1 message not in the archive VFS

lore
Share & tools
lore
#0 lore raw

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.

Signature · 1 line
OGAWA Hirofumi <[email protected]>
#1 lore raw
Quoted 8 lines · OGAWA Hirofumi

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

Quoted 21 lines

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.

maintainer
#2 lore raw
Quoted 6 lines · Eric Paris
Quoted 5 lines · OGAWA Hirofumi

Hi,

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

Quoted 7 lines
Quoted 3 lines

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

A message that is not in the archive (sent off-list or not yet received): CAGHUO11rNGU9VMAPQNdXtpQeAixFX6zxJc-tWur1McqbpYpYpQ@mail.gmail.com

#4 lore raw
Quoted 116 lines · Joseph Salisbury

Forwarded conversation
Subject: *Race inotify_rm_watch vs umount*
------------------------

From: *OGAWA Hirofumi* <[email protected] <mailto:[email protected]>>
Date: Fri, Jun 10, 2011 at 7:20 AM
To: John McCutchan <[email protected] <mailto:[email protected]>>, Robert Love <[email protected] <mailto:[email protected]>>, Eric Paris <[email protected] <mailto:[email protected]>>
Cc: [email protected] <mailto:[email protected]>, [email protected] <mailto:[email protected]>

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 <[email protected] <mailto:[email protected]>>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected] <mailto:[email protected]>
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

----------
From: *Eric Paris* <[email protected] <mailto:[email protected]>>
Date: Fri, Jun 10, 2011 at 9:46 AM
To: OGAWA Hirofumi <[email protected] <mailto:[email protected]>>
Cc: John McCutchan <[email protected] <mailto:[email protected]>>, Robert Love <[email protected] <mailto:[email protected]>>, [email protected] <mailto:[email protected]>, [email protected] <mailto:[email protected]>

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

Quoted 5 lines

umount inotify_rm_watch
... fsnotify_destroy_mark()

                                         fsnotify_destroy_inode_mark()
                                           /* removed from

i_fsnotify_marks */

Quoted 6 lines
    generic_shutdown_super()
      fsnotify_unmount_inodes()
        put_super()
                                           iput()
                                             iput_final()
                                               /* this is after

put_super() */

Quoted 10 lines

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* <[email protected] <mailto:[email protected]>>
Date: Fri, Jun 10, 2011 at 10:35 AM
To: Eric Paris <[email protected] <mailto:[email protected]>>
Cc: OGAWA Hirofumi <[email protected] <mailto:[email protected]>>, John McCutchan <[email protected] <mailto:[email protected]>>, Robert Love <[email protected] <mailto:[email protected]>>, [email protected] <mailto:[email protected]>, [email protected] <mailto:[email protected]>

Quoted 3 lines

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