Re: Race inotify_rm_watch vs umount

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


On 03/06/2012 04:02 PM, Joseph Salisbury wrote:


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

From: *OGAWA Hirofumi* <hirofumi@xxxxxxxxxxxxxxxxxx
<mailto:hirofumi@xxxxxxxxxxxxxxxxxx>>
Date: Fri, Jun 10, 2011 at 7:20 AM
To: John McCutchan <john@xxxxxxxxxxxxxxxxx
<mailto:john@xxxxxxxxxxxxxxxxx>>, Robert Love <rlove@xxxxxxxxx
<mailto:rlove@xxxxxxxxx>>, Eric Paris <eparis@xxxxxxxxxx
<mailto:eparis@xxxxxxxxxx>>
Cc: linux-kernel@xxxxxxxxxxxxxxx <mailto:linux-kernel@xxxxxxxxxxxxxxx>,
linux-fsdevel@xxxxxxxxxxxxxxx <mailto:linux-fsdevel@xxxxxxxxxxxxxxx>


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@xxxxxxxxxxxxxxxxxx
<mailto:hirofumi@xxxxxxxxxxxxxxxxxx>>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
<mailto:majordomo@xxxxxxxxxxxxxxx>
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@xxxxxxxxxx <mailto:eparis@xxxxxxxxxx>>
Date: Fri, Jun 10, 2011 at 9:46 AM
To: OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx
<mailto:hirofumi@xxxxxxxxxxxxxxxxxx>>
Cc: John McCutchan <john@xxxxxxxxxxxxxxxxx
<mailto:john@xxxxxxxxxxxxxxxxx>>, Robert Love <rlove@xxxxxxxxx
<mailto:rlove@xxxxxxxxx>>, linux-kernel@xxxxxxxxxxxxxxx
<mailto:linux-kernel@xxxxxxxxxxxxxxx>, linux-fsdevel@xxxxxxxxxxxxxxx
<mailto:linux-fsdevel@xxxxxxxxxxxxxxx>


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@xxxxxxxxxxxxxxxxxx <mailto:viro@xxxxxxxxxxxxxxxxxx>>
Date: Fri, Jun 10, 2011 at 10:35 AM
To: Eric Paris <eparis@xxxxxxxxxx <mailto:eparis@xxxxxxxxxx>>
Cc: OGAWA Hirofumi <hirofumi@xxxxxxxxxxxxxxxxxx
<mailto:hirofumi@xxxxxxxxxxxxxxxxxx>>, John McCutchan
<john@xxxxxxxxxxxxxxxxx <mailto:john@xxxxxxxxxxxxxxxxx>>, Robert Love
<rlove@xxxxxxxxx <mailto:rlove@xxxxxxxxx>>, linux-kernel@xxxxxxxxxxxxxxx
<mailto:linux-kernel@xxxxxxxxxxxxxxx>, linux-fsdevel@xxxxxxxxxxxxxxx
<mailto:linux-fsdevel@xxxxxxxxxxxxxxx>


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


[Other Archives]     [Linux Kernel Newbies]     [Linux Driver Development]     [Fedora Kernel]     [Linux Kernel Testers]     [Linux SH]     [Linux Omap]     [Linux Kbuild]     [Linux Tape]     [Linux Input]     [Linux Kernel Janitors]     [Linux Kernel Packagers]     [Linux Doc]     [Linux Man Pages]     [Linux API]     [Linux Memory Management]     [Linux Modules]     [Linux Standards]     [Kernel Announce]     [Netdev]     [Git]     [Linux PCI]     Linux CAN Development     [Linux I2C]     [Linux RDMA]     [Linux NUMA]     [Netfilter]     [Netfilter Devel]     [SELinux]     [Bugtraq]     [FIO]     [Linux Perf Users]     [Linux Serial]     [Linux PPP]     [Linux ISDN]     [Linux Next]     [Kernel Stable Commits]     [Linux Tip Commits]     [Kernel MM Commits]     [Linux Security Module]     [Filesystem Development]     [Ext3 Filesystem]     [Linux bcache]     [Ext4 Filesystem]     [Linux BTRFS]     [Linux CEPH Filesystem]     [Linux XFS]     [XFS]     [Linux NFS]     [Linux CIFS]     [Ecryptfs]     [Linux NILFS]     [Linux Cachefs]     [Reiser FS]     [Initramfs]     [Linux FB Devel]     [Linux OpenGL]     [DRI Devel]     [Fastboot]     [Linux RT Users]     [Linux RT Stable]     [eCos]     [Corosync]     [Linux Clusters]     [LVS Devel]     [Hot Plug]     [Linux Virtualization]     [KVM]     [KVM PPC]     [KVM ia64]     [Linux Containers]     [Linux Hexagon]     [Linux Cgroups]     [Util Linux]     [Wireless]     [Linux Bluetooth]     [Bluez Devel]     [Ethernet Bridging]     [Embedded Linux]     [Barebox]     [Linux MMC]     [Linux IIO]     [Sparse]     [Smatch]     [Linux Arch]     [x86 Platform Driver]     [Linux ACPI]     [Linux IBM ACPI]     [LM Sensors]     [CPU Freq]     [Linux Power Management]     [Linmodems]     [Linux DCCP]     [Linux SCTP]     [ALSA Devel]     [Linux USB]     [Linux PA RISC]     [Linux Samsung SOC]     [MIPS Linux]     [IBM S/390 Linux]     [ARM Linux]     [ARM Kernel]     [ARM MSM]     [Tegra Devel]     [Sparc Linux]     [Linux Security]     [Linux Sound]     [Linux Media]     [Video 4 Linux]     [Linux IRDA Users]     [Linux for the blind]     [Linux RAID]     [Linux ATA RAID]     [Device Mapper]     [Linux SCSI]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Linux IDE]     [Linux SMP]     [Linux AXP]     [Linux Alpha]     [Linux M68K]     [Linux ia64]     [Linux 8086]     [Linux x86_64]     [Linux Config]     [Linux Apps]     [Linux MSDOS]     [Linux X.25]     [Linux Crypto]     [DM Crypt]     [Linux Trace Users]     [Linux Btrace]     [Linux Watchdog]     [Utrace Devel]     [Linux C Programming]     [Linux Assembly]     [Dash]     [DWARVES]     [Hail Devel]     [Linux Kernel Debugger]     [Linux gcc]     [Gcc Help]     [X.Org]     [Wine]

Add to Google Powered by Linux

[Older Kernel Discussion]     [Yosemite National Park Forum]     [Large Format Photos]     [Gimp]     [Yosemite Photos]     [Stuff]