Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-11 Thread Dmitry Vyukov
On Wed, Apr 11, 2018 at 5:04 PM, Dmitry Vyukov  wrote:
> On Thu, Apr 5, 2018 at 4:23 PM, Greg KH  wrote:
>>> >> On 05/04/18 09:52, Dmitry Vyukov wrote:
>>> >> > On Thu, Apr 5, 2018 at 10:36 AM, Steven Whitehouse 
>>> >> >  wrote:
>>> >> > > Hi,
>>> >> > >
>>> >> > >
>>> >> > >
>>> >> > > On 05/04/18 09:19, Dmitry Vyukov wrote:
>>> >> > > > On Thu, Apr 5, 2018 at 8:34 AM, Greg KH 
>>> >> > > > 
>>> >> > > > wrote:
>>> >> > > > > On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:
>>> >> > > > > > Hello,
>>> >> > > > > >
>>> >> > > > > > syzbot hit the following crash on upstream commit
>>> >> > > > > > 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 
>>> >> > > > > > 2018 +)
>>> >> > > > > > Merge tag 'ext4_for_linus' of
>>> >> > > > > > git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
>>> >> > > > > > syzbot dashboard link:
>>> >> > > > > > https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5
>>> >> > > > > >
>>> >> > > > > > C reproducer:
>>> >> > > > > > https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
>>> >> > > > > > syzkaller reproducer:
>>> >> > > > > > https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
>>> >> > > > > > Raw console output:
>>> >> > > > > > https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
>>> >> > > > > > Kernel config:
>>> >> > > > > > https://syzkaller.appspot.com/x/.config?id=9118669095563550941
>>> >> > > > > > compiler: gcc (GCC) 7.1.1 20170620
>>> >> > > > > >
>>> >> > > > > > IMPORTANT: if you fix the bug, please add the following tag to 
>>> >> > > > > > the
>>> >> > > > > > commit:
>>> >> > > > > > Reported-by: 
>>> >> > > > > > syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
>>> >> > > > > > It will help syzbot understand when the bug is fixed. See 
>>> >> > > > > > footer for
>>> >> > > > > > details.
>>> >> > > > > > If you forward the report, please keep this part and the 
>>> >> > > > > > footer.
>>> >> > > > > >
>>> >> > > > > > R10:  R11: 0286 R12: 
>>> >> > > > > > 0003
>>> >> > > > > > R13: 0004 R14:  R15: 
>>> >> > > > > > 
>>> >> > > > > > [ cut here ]
>>> >> > > > > > kobject_add_internal failed for nodev( with -EEXIST, don't try 
>>> >> > > > > > to
>>> >> > > > > > register
>>> >> > > > > > things with the same name in the same directory.
>>> >> > > > > > sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
>>> >> > > > > > WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
>>> >> > > > > > kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
>>> >> > > > > > CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
>>> >> > > > > > Kernel panic - not syncing: panic_on_warn set ...
>>> >> > > > > >
>>> >> > > > > > Hardware name: Google Google Compute Engine/Google Compute 
>>> >> > > > > > Engine, BIOS
>>> >> > > > > > Google 01/01/2011
>>> >> > > > > > Call Trace:
>>> >> > > > > >__dump_stack lib/dump_stack.c:17 [inline]
>>> >> > > > > >dump_stack+0x1a7/0x27d lib/dump_stack.c:53
>>> >> > > > > >sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
>>> >> > > > > >sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
>>> >> > > > > >create_dir lib/kobject.c:69 [inline]
>>> >> > > > > >kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
>>> >> > > > > >kobject_add_varg lib/kobject.c:364 [inline]
>>> >> > > > > >kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
>>> >> > > > > >gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
>>> >> > > > > >fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
>>> >> > > > > >gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
>>> >> > > > > gfs2 bug, not a sysfs bug, we are correctly warning about an 
>>> >> > > > > incorrect
>>> >> > > > > usage of the api.
>>> >> > > > Then +gfs2 maintainers.
>>> >> > > >
>>> >> > > > > Now if we should turn this into a non-WARN message, that's a 
>>> >> > > > > different
>>> >> > > > > thing, I'll gladly take a patch for that.
>>> >> > > > If it's API usage bug in higher level code, then I think WARN is a
>>> >> > > > proper thing. We already had similar ones and they were fixed.
>>> >> > >
>>> >> > > I'm trying to figure out what the test is doing, but it is not very 
>>> >> > > clear.
>>> >> > > At a guess I'd say that perhaps it is trying to mount multiple 
>>> >> > > filesystems
>>> >> > > with the same label? If that is the case then it is not allowed, and 
>>> >> > > it
>>> >> > > should be caught be the sysfs code and result in a refusal to mount, 
>>> >> > > which
>>> >> > > is what I think I see here. Knowing which sysfs directory is 
>>> >> > > involved would
>>> >> > > allow us to confirm, but I suspect that the test needs altering to 
>>> >> > > give each
>>> >> > > gfs2 mount a different label at an initial guess,
>>> >> >
>>> >> > Hi Steve,
>>> >> >
>>> >> > But Greg claims that 

Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-11 Thread Dmitry Vyukov
On Wed, Apr 11, 2018 at 5:04 PM, Dmitry Vyukov  wrote:
> On Thu, Apr 5, 2018 at 4:23 PM, Greg KH  wrote:
>>> >> On 05/04/18 09:52, Dmitry Vyukov wrote:
>>> >> > On Thu, Apr 5, 2018 at 10:36 AM, Steven Whitehouse 
>>> >> >  wrote:
>>> >> > > Hi,
>>> >> > >
>>> >> > >
>>> >> > >
>>> >> > > On 05/04/18 09:19, Dmitry Vyukov wrote:
>>> >> > > > On Thu, Apr 5, 2018 at 8:34 AM, Greg KH 
>>> >> > > > 
>>> >> > > > wrote:
>>> >> > > > > On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:
>>> >> > > > > > Hello,
>>> >> > > > > >
>>> >> > > > > > syzbot hit the following crash on upstream commit
>>> >> > > > > > 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 
>>> >> > > > > > 2018 +)
>>> >> > > > > > Merge tag 'ext4_for_linus' of
>>> >> > > > > > git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
>>> >> > > > > > syzbot dashboard link:
>>> >> > > > > > https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5
>>> >> > > > > >
>>> >> > > > > > C reproducer:
>>> >> > > > > > https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
>>> >> > > > > > syzkaller reproducer:
>>> >> > > > > > https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
>>> >> > > > > > Raw console output:
>>> >> > > > > > https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
>>> >> > > > > > Kernel config:
>>> >> > > > > > https://syzkaller.appspot.com/x/.config?id=9118669095563550941
>>> >> > > > > > compiler: gcc (GCC) 7.1.1 20170620
>>> >> > > > > >
>>> >> > > > > > IMPORTANT: if you fix the bug, please add the following tag to 
>>> >> > > > > > the
>>> >> > > > > > commit:
>>> >> > > > > > Reported-by: 
>>> >> > > > > > syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
>>> >> > > > > > It will help syzbot understand when the bug is fixed. See 
>>> >> > > > > > footer for
>>> >> > > > > > details.
>>> >> > > > > > If you forward the report, please keep this part and the 
>>> >> > > > > > footer.
>>> >> > > > > >
>>> >> > > > > > R10:  R11: 0286 R12: 
>>> >> > > > > > 0003
>>> >> > > > > > R13: 0004 R14:  R15: 
>>> >> > > > > > 
>>> >> > > > > > [ cut here ]
>>> >> > > > > > kobject_add_internal failed for nodev( with -EEXIST, don't try 
>>> >> > > > > > to
>>> >> > > > > > register
>>> >> > > > > > things with the same name in the same directory.
>>> >> > > > > > sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
>>> >> > > > > > WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
>>> >> > > > > > kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
>>> >> > > > > > CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
>>> >> > > > > > Kernel panic - not syncing: panic_on_warn set ...
>>> >> > > > > >
>>> >> > > > > > Hardware name: Google Google Compute Engine/Google Compute 
>>> >> > > > > > Engine, BIOS
>>> >> > > > > > Google 01/01/2011
>>> >> > > > > > Call Trace:
>>> >> > > > > >__dump_stack lib/dump_stack.c:17 [inline]
>>> >> > > > > >dump_stack+0x1a7/0x27d lib/dump_stack.c:53
>>> >> > > > > >sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
>>> >> > > > > >sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
>>> >> > > > > >create_dir lib/kobject.c:69 [inline]
>>> >> > > > > >kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
>>> >> > > > > >kobject_add_varg lib/kobject.c:364 [inline]
>>> >> > > > > >kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
>>> >> > > > > >gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
>>> >> > > > > >fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
>>> >> > > > > >gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
>>> >> > > > > gfs2 bug, not a sysfs bug, we are correctly warning about an 
>>> >> > > > > incorrect
>>> >> > > > > usage of the api.
>>> >> > > > Then +gfs2 maintainers.
>>> >> > > >
>>> >> > > > > Now if we should turn this into a non-WARN message, that's a 
>>> >> > > > > different
>>> >> > > > > thing, I'll gladly take a patch for that.
>>> >> > > > If it's API usage bug in higher level code, then I think WARN is a
>>> >> > > > proper thing. We already had similar ones and they were fixed.
>>> >> > >
>>> >> > > I'm trying to figure out what the test is doing, but it is not very 
>>> >> > > clear.
>>> >> > > At a guess I'd say that perhaps it is trying to mount multiple 
>>> >> > > filesystems
>>> >> > > with the same label? If that is the case then it is not allowed, and 
>>> >> > > it
>>> >> > > should be caught be the sysfs code and result in a refusal to mount, 
>>> >> > > which
>>> >> > > is what I think I see here. Knowing which sysfs directory is 
>>> >> > > involved would
>>> >> > > allow us to confirm, but I suspect that the test needs altering to 
>>> >> > > give each
>>> >> > > gfs2 mount a different label at an initial guess,
>>> >> >
>>> >> > Hi Steve,
>>> >> >
>>> >> > But Greg claims that this is incorrect usage of sysfs API:
>>> >> >
>>> >> > > gfs2 bug, not a sysfs bug, we are 

Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-11 Thread Dmitry Vyukov
On Thu, Apr 5, 2018 at 4:23 PM, Greg KH  wrote:
>> >> On 05/04/18 09:52, Dmitry Vyukov wrote:
>> >> > On Thu, Apr 5, 2018 at 10:36 AM, Steven Whitehouse 
>> >> >  wrote:
>> >> > > Hi,
>> >> > >
>> >> > >
>> >> > >
>> >> > > On 05/04/18 09:19, Dmitry Vyukov wrote:
>> >> > > > On Thu, Apr 5, 2018 at 8:34 AM, Greg KH 
>> >> > > > wrote:
>> >> > > > > On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:
>> >> > > > > > Hello,
>> >> > > > > >
>> >> > > > > > syzbot hit the following crash on upstream commit
>> >> > > > > > 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 
>> >> > > > > > 2018 +)
>> >> > > > > > Merge tag 'ext4_for_linus' of
>> >> > > > > > git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
>> >> > > > > > syzbot dashboard link:
>> >> > > > > > https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5
>> >> > > > > >
>> >> > > > > > C reproducer:
>> >> > > > > > https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
>> >> > > > > > syzkaller reproducer:
>> >> > > > > > https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
>> >> > > > > > Raw console output:
>> >> > > > > > https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
>> >> > > > > > Kernel config:
>> >> > > > > > https://syzkaller.appspot.com/x/.config?id=9118669095563550941
>> >> > > > > > compiler: gcc (GCC) 7.1.1 20170620
>> >> > > > > >
>> >> > > > > > IMPORTANT: if you fix the bug, please add the following tag to 
>> >> > > > > > the
>> >> > > > > > commit:
>> >> > > > > > Reported-by: 
>> >> > > > > > syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
>> >> > > > > > It will help syzbot understand when the bug is fixed. See 
>> >> > > > > > footer for
>> >> > > > > > details.
>> >> > > > > > If you forward the report, please keep this part and the footer.
>> >> > > > > >
>> >> > > > > > R10:  R11: 0286 R12: 
>> >> > > > > > 0003
>> >> > > > > > R13: 0004 R14:  R15: 
>> >> > > > > > 
>> >> > > > > > [ cut here ]
>> >> > > > > > kobject_add_internal failed for nodev( with -EEXIST, don't try 
>> >> > > > > > to
>> >> > > > > > register
>> >> > > > > > things with the same name in the same directory.
>> >> > > > > > sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
>> >> > > > > > WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
>> >> > > > > > kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
>> >> > > > > > CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
>> >> > > > > > Kernel panic - not syncing: panic_on_warn set ...
>> >> > > > > >
>> >> > > > > > Hardware name: Google Google Compute Engine/Google Compute 
>> >> > > > > > Engine, BIOS
>> >> > > > > > Google 01/01/2011
>> >> > > > > > Call Trace:
>> >> > > > > >__dump_stack lib/dump_stack.c:17 [inline]
>> >> > > > > >dump_stack+0x1a7/0x27d lib/dump_stack.c:53
>> >> > > > > >sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
>> >> > > > > >sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
>> >> > > > > >create_dir lib/kobject.c:69 [inline]
>> >> > > > > >kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
>> >> > > > > >kobject_add_varg lib/kobject.c:364 [inline]
>> >> > > > > >kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
>> >> > > > > >gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
>> >> > > > > >fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
>> >> > > > > >gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
>> >> > > > > gfs2 bug, not a sysfs bug, we are correctly warning about an 
>> >> > > > > incorrect
>> >> > > > > usage of the api.
>> >> > > > Then +gfs2 maintainers.
>> >> > > >
>> >> > > > > Now if we should turn this into a non-WARN message, that's a 
>> >> > > > > different
>> >> > > > > thing, I'll gladly take a patch for that.
>> >> > > > If it's API usage bug in higher level code, then I think WARN is a
>> >> > > > proper thing. We already had similar ones and they were fixed.
>> >> > >
>> >> > > I'm trying to figure out what the test is doing, but it is not very 
>> >> > > clear.
>> >> > > At a guess I'd say that perhaps it is trying to mount multiple 
>> >> > > filesystems
>> >> > > with the same label? If that is the case then it is not allowed, and 
>> >> > > it
>> >> > > should be caught be the sysfs code and result in a refusal to mount, 
>> >> > > which
>> >> > > is what I think I see here. Knowing which sysfs directory is involved 
>> >> > > would
>> >> > > allow us to confirm, but I suspect that the test needs altering to 
>> >> > > give each
>> >> > > gfs2 mount a different label at an initial guess,
>> >> >
>> >> > Hi Steve,
>> >> >
>> >> > But Greg claims that this is incorrect usage of sysfs API:
>> >> >
>> >> > > gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
>> >> > > usage of the api.
>> >> > I think this means that sysfs callers must not 

Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-11 Thread Dmitry Vyukov
On Thu, Apr 5, 2018 at 4:23 PM, Greg KH  wrote:
>> >> On 05/04/18 09:52, Dmitry Vyukov wrote:
>> >> > On Thu, Apr 5, 2018 at 10:36 AM, Steven Whitehouse 
>> >> >  wrote:
>> >> > > Hi,
>> >> > >
>> >> > >
>> >> > >
>> >> > > On 05/04/18 09:19, Dmitry Vyukov wrote:
>> >> > > > On Thu, Apr 5, 2018 at 8:34 AM, Greg KH 
>> >> > > > wrote:
>> >> > > > > On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:
>> >> > > > > > Hello,
>> >> > > > > >
>> >> > > > > > syzbot hit the following crash on upstream commit
>> >> > > > > > 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 
>> >> > > > > > 2018 +)
>> >> > > > > > Merge tag 'ext4_for_linus' of
>> >> > > > > > git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
>> >> > > > > > syzbot dashboard link:
>> >> > > > > > https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5
>> >> > > > > >
>> >> > > > > > C reproducer:
>> >> > > > > > https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
>> >> > > > > > syzkaller reproducer:
>> >> > > > > > https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
>> >> > > > > > Raw console output:
>> >> > > > > > https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
>> >> > > > > > Kernel config:
>> >> > > > > > https://syzkaller.appspot.com/x/.config?id=9118669095563550941
>> >> > > > > > compiler: gcc (GCC) 7.1.1 20170620
>> >> > > > > >
>> >> > > > > > IMPORTANT: if you fix the bug, please add the following tag to 
>> >> > > > > > the
>> >> > > > > > commit:
>> >> > > > > > Reported-by: 
>> >> > > > > > syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
>> >> > > > > > It will help syzbot understand when the bug is fixed. See 
>> >> > > > > > footer for
>> >> > > > > > details.
>> >> > > > > > If you forward the report, please keep this part and the footer.
>> >> > > > > >
>> >> > > > > > R10:  R11: 0286 R12: 
>> >> > > > > > 0003
>> >> > > > > > R13: 0004 R14:  R15: 
>> >> > > > > > 
>> >> > > > > > [ cut here ]
>> >> > > > > > kobject_add_internal failed for nodev( with -EEXIST, don't try 
>> >> > > > > > to
>> >> > > > > > register
>> >> > > > > > things with the same name in the same directory.
>> >> > > > > > sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
>> >> > > > > > WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
>> >> > > > > > kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
>> >> > > > > > CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
>> >> > > > > > Kernel panic - not syncing: panic_on_warn set ...
>> >> > > > > >
>> >> > > > > > Hardware name: Google Google Compute Engine/Google Compute 
>> >> > > > > > Engine, BIOS
>> >> > > > > > Google 01/01/2011
>> >> > > > > > Call Trace:
>> >> > > > > >__dump_stack lib/dump_stack.c:17 [inline]
>> >> > > > > >dump_stack+0x1a7/0x27d lib/dump_stack.c:53
>> >> > > > > >sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
>> >> > > > > >sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
>> >> > > > > >create_dir lib/kobject.c:69 [inline]
>> >> > > > > >kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
>> >> > > > > >kobject_add_varg lib/kobject.c:364 [inline]
>> >> > > > > >kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
>> >> > > > > >gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
>> >> > > > > >fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
>> >> > > > > >gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
>> >> > > > > gfs2 bug, not a sysfs bug, we are correctly warning about an 
>> >> > > > > incorrect
>> >> > > > > usage of the api.
>> >> > > > Then +gfs2 maintainers.
>> >> > > >
>> >> > > > > Now if we should turn this into a non-WARN message, that's a 
>> >> > > > > different
>> >> > > > > thing, I'll gladly take a patch for that.
>> >> > > > If it's API usage bug in higher level code, then I think WARN is a
>> >> > > > proper thing. We already had similar ones and they were fixed.
>> >> > >
>> >> > > I'm trying to figure out what the test is doing, but it is not very 
>> >> > > clear.
>> >> > > At a guess I'd say that perhaps it is trying to mount multiple 
>> >> > > filesystems
>> >> > > with the same label? If that is the case then it is not allowed, and 
>> >> > > it
>> >> > > should be caught be the sysfs code and result in a refusal to mount, 
>> >> > > which
>> >> > > is what I think I see here. Knowing which sysfs directory is involved 
>> >> > > would
>> >> > > allow us to confirm, but I suspect that the test needs altering to 
>> >> > > give each
>> >> > > gfs2 mount a different label at an initial guess,
>> >> >
>> >> > Hi Steve,
>> >> >
>> >> > But Greg claims that this is incorrect usage of sysfs API:
>> >> >
>> >> > > gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
>> >> > > usage of the api.
>> >> > I think this means that sysfs callers must not try to create the same
>> >> > thing twice.
>> >> >
>> >> > Either way 

Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-11 Thread Dmitry Vyukov
On Thu, Apr 5, 2018 at 4:02 AM, syzbot
 wrote:
> Hello,
>
> syzbot hit the following crash on upstream commit
> 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 +)
> Merge tag 'ext4_for_linus' of
> git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
> syzbot dashboard link:
> https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5
>
> C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
> syzkaller reproducer:
> https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
> Raw console output:
> https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
> Kernel config:
> https://syzkaller.appspot.com/x/.config?id=9118669095563550941
> compiler: gcc (GCC) 7.1.1 20170620
>
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
> It will help syzbot understand when the bug is fixed. See footer for
> details.
> If you forward the report, please keep this part and the footer.

#syz dup: WARNING: kobject bug in gfs2_sys_fs_add

> R10:  R11: 0286 R12: 0003
> R13: 0004 R14:  R15: 
> [ cut here ]
> kobject_add_internal failed for nodev( with -EEXIST, don't try to register
> things with the same name in the same directory.
> sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
> WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
> kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
> CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
> Kernel panic - not syncing: panic_on_warn set ...
>
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:17 [inline]
>  dump_stack+0x1a7/0x27d lib/dump_stack.c:53
>  sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
>  sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
>  create_dir lib/kobject.c:69 [inline]
>  kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
>  kobject_add_varg lib/kobject.c:364 [inline]
>  kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
>  gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
>  fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
>  gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
>  mount_fs+0x66/0x2d0 fs/super.c:1222
>  vfs_kern_mount.part.26+0xc6/0x4a0 fs/namespace.c:1037
>  vfs_kern_mount fs/namespace.c:2514 [inline]
>  do_new_mount fs/namespace.c:2517 [inline]
>  do_mount+0xea4/0x2b90 fs/namespace.c:2847
>  ksys_mount+0xab/0x120 fs/namespace.c:3063
>  SYSC_mount fs/namespace.c:3077 [inline]
>  SyS_mount+0x39/0x50 fs/namespace.c:3074
>  do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
>  entry_SYSCALL_64_after_hwframe+0x42/0xb7
> RIP: 0033:0x4432fa
> RSP: 002b:7ffda3d84538 EFLAGS: 0286 ORIG_RAX: 00a5
> RAX: ffda RBX: 20001a40 RCX: 004432fa
> RDX: 20001a00 RSI: 20001a40 RDI: 7ffda3d84550
> RBP:  R08: 20001f00 R09: 000a
> R10:  R11: 0286 R12: 0003
> R13: 0004 R14:  R15: 
> CPU: 1 PID: 4473 Comm: syzkaller533472 Not tainted 4.16.0+ #15
> [ cut here ]
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:17 [inline]
>  dump_stack+0x1a7/0x27d lib/dump_stack.c:53
> kobject_add_internal failed for nodev( with -EEXIST, don't try to register
> things with the same name in the same directory.
>  panic+0x1f8/0x42c kernel/panic.c:183
> WARNING: CPU: 0 PID: 4474 at lib/kobject.c:238
> kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
> Modules linked in:
>  __warn+0x1dc/0x200 kernel/panic.c:547
> CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
>  report_bug+0x1f4/0x2b0 lib/bug.c:186
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
>  fixup_bug.part.10+0x37/0x80 arch/x86/kernel/traps.c:178
> RIP: 0010:kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
>  fixup_bug arch/x86/kernel/traps.c:247 [inline]
>  do_error_trap+0x2d7/0x3e0 arch/x86/kernel/traps.c:296
> RSP: :8801addaf470 EFLAGS: 00010282
> RAX: dc08 RBX: 8801d9661110 RCX: 815b5d2e
> RDX:  RSI: 110035bb5e3e RDI: 110035bb5e13
> RBP: 8801addaf568 R08: 110035bb5dd5 R09: 0001
> R10: 0001 R11:  R12: 110035bb5e94
> R13: ffef R14: 8801d39ae348 R15: 110035bb5e98
> FS:  01db2880() GS:8801db00() knlGS:
>  do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:315
>  invalid_op+0x1b/0x40 arch/x86/entry/entry_64.S:991
> RIP: 0010:kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
> CS:  0010 DS:  ES:  

Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-11 Thread Dmitry Vyukov
On Thu, Apr 5, 2018 at 4:02 AM, syzbot
 wrote:
> Hello,
>
> syzbot hit the following crash on upstream commit
> 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 +)
> Merge tag 'ext4_for_linus' of
> git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
> syzbot dashboard link:
> https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5
>
> C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
> syzkaller reproducer:
> https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
> Raw console output:
> https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
> Kernel config:
> https://syzkaller.appspot.com/x/.config?id=9118669095563550941
> compiler: gcc (GCC) 7.1.1 20170620
>
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
> It will help syzbot understand when the bug is fixed. See footer for
> details.
> If you forward the report, please keep this part and the footer.

#syz dup: WARNING: kobject bug in gfs2_sys_fs_add

> R10:  R11: 0286 R12: 0003
> R13: 0004 R14:  R15: 
> [ cut here ]
> kobject_add_internal failed for nodev( with -EEXIST, don't try to register
> things with the same name in the same directory.
> sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
> WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
> kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
> CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
> Kernel panic - not syncing: panic_on_warn set ...
>
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:17 [inline]
>  dump_stack+0x1a7/0x27d lib/dump_stack.c:53
>  sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
>  sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
>  create_dir lib/kobject.c:69 [inline]
>  kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
>  kobject_add_varg lib/kobject.c:364 [inline]
>  kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
>  gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
>  fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
>  gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
>  mount_fs+0x66/0x2d0 fs/super.c:1222
>  vfs_kern_mount.part.26+0xc6/0x4a0 fs/namespace.c:1037
>  vfs_kern_mount fs/namespace.c:2514 [inline]
>  do_new_mount fs/namespace.c:2517 [inline]
>  do_mount+0xea4/0x2b90 fs/namespace.c:2847
>  ksys_mount+0xab/0x120 fs/namespace.c:3063
>  SYSC_mount fs/namespace.c:3077 [inline]
>  SyS_mount+0x39/0x50 fs/namespace.c:3074
>  do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
>  entry_SYSCALL_64_after_hwframe+0x42/0xb7
> RIP: 0033:0x4432fa
> RSP: 002b:7ffda3d84538 EFLAGS: 0286 ORIG_RAX: 00a5
> RAX: ffda RBX: 20001a40 RCX: 004432fa
> RDX: 20001a00 RSI: 20001a40 RDI: 7ffda3d84550
> RBP:  R08: 20001f00 R09: 000a
> R10:  R11: 0286 R12: 0003
> R13: 0004 R14:  R15: 
> CPU: 1 PID: 4473 Comm: syzkaller533472 Not tainted 4.16.0+ #15
> [ cut here ]
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:17 [inline]
>  dump_stack+0x1a7/0x27d lib/dump_stack.c:53
> kobject_add_internal failed for nodev( with -EEXIST, don't try to register
> things with the same name in the same directory.
>  panic+0x1f8/0x42c kernel/panic.c:183
> WARNING: CPU: 0 PID: 4474 at lib/kobject.c:238
> kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
> Modules linked in:
>  __warn+0x1dc/0x200 kernel/panic.c:547
> CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
>  report_bug+0x1f4/0x2b0 lib/bug.c:186
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
>  fixup_bug.part.10+0x37/0x80 arch/x86/kernel/traps.c:178
> RIP: 0010:kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
>  fixup_bug arch/x86/kernel/traps.c:247 [inline]
>  do_error_trap+0x2d7/0x3e0 arch/x86/kernel/traps.c:296
> RSP: :8801addaf470 EFLAGS: 00010282
> RAX: dc08 RBX: 8801d9661110 RCX: 815b5d2e
> RDX:  RSI: 110035bb5e3e RDI: 110035bb5e13
> RBP: 8801addaf568 R08: 110035bb5dd5 R09: 0001
> R10: 0001 R11:  R12: 110035bb5e94
> R13: ffef R14: 8801d39ae348 R15: 110035bb5e98
> FS:  01db2880() GS:8801db00() knlGS:
>  do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:315
>  invalid_op+0x1b/0x40 arch/x86/entry/entry_64.S:991
> RIP: 0010:kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
> CS:  0010 DS:  ES:  CR0: 80050033
> CR2: 019657b0 CR3: 

Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Greg KH
On Thu, Apr 05, 2018 at 03:59:58PM +0200, Dmitry Vyukov wrote:
> On Thu, Apr 5, 2018 at 3:34 PM, Greg KH  wrote:
> > On Thu, Apr 05, 2018 at 10:00:04AM +0100, Steven Whitehouse wrote:
> >> Hi,
> >>
> >>
> >> On 05/04/18 09:52, Dmitry Vyukov wrote:
> >> > On Thu, Apr 5, 2018 at 10:36 AM, Steven Whitehouse  
> >> > wrote:
> >> > > Hi,
> >> > >
> >> > >
> >> > >
> >> > > On 05/04/18 09:19, Dmitry Vyukov wrote:
> >> > > > On Thu, Apr 5, 2018 at 8:34 AM, Greg KH 
> >> > > > wrote:
> >> > > > > On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:
> >> > > > > > Hello,
> >> > > > > >
> >> > > > > > syzbot hit the following crash on upstream commit
> >> > > > > > 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 
> >> > > > > > 2018 +)
> >> > > > > > Merge tag 'ext4_for_linus' of
> >> > > > > > git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
> >> > > > > > syzbot dashboard link:
> >> > > > > > https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5
> >> > > > > >
> >> > > > > > C reproducer:
> >> > > > > > https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
> >> > > > > > syzkaller reproducer:
> >> > > > > > https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
> >> > > > > > Raw console output:
> >> > > > > > https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
> >> > > > > > Kernel config:
> >> > > > > > https://syzkaller.appspot.com/x/.config?id=9118669095563550941
> >> > > > > > compiler: gcc (GCC) 7.1.1 20170620
> >> > > > > >
> >> > > > > > IMPORTANT: if you fix the bug, please add the following tag to 
> >> > > > > > the
> >> > > > > > commit:
> >> > > > > > Reported-by: 
> >> > > > > > syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
> >> > > > > > It will help syzbot understand when the bug is fixed. See footer 
> >> > > > > > for
> >> > > > > > details.
> >> > > > > > If you forward the report, please keep this part and the footer.
> >> > > > > >
> >> > > > > > R10:  R11: 0286 R12: 0003
> >> > > > > > R13: 0004 R14:  R15: 
> >> > > > > > [ cut here ]
> >> > > > > > kobject_add_internal failed for nodev( with -EEXIST, don't try to
> >> > > > > > register
> >> > > > > > things with the same name in the same directory.
> >> > > > > > sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
> >> > > > > > WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
> >> > > > > > kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
> >> > > > > > CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
> >> > > > > > Kernel panic - not syncing: panic_on_warn set ...
> >> > > > > >
> >> > > > > > Hardware name: Google Google Compute Engine/Google Compute 
> >> > > > > > Engine, BIOS
> >> > > > > > Google 01/01/2011
> >> > > > > > Call Trace:
> >> > > > > >__dump_stack lib/dump_stack.c:17 [inline]
> >> > > > > >dump_stack+0x1a7/0x27d lib/dump_stack.c:53
> >> > > > > >sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
> >> > > > > >sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
> >> > > > > >create_dir lib/kobject.c:69 [inline]
> >> > > > > >kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
> >> > > > > >kobject_add_varg lib/kobject.c:364 [inline]
> >> > > > > >kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
> >> > > > > >gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
> >> > > > > >fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
> >> > > > > >gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
> >> > > > > gfs2 bug, not a sysfs bug, we are correctly warning about an 
> >> > > > > incorrect
> >> > > > > usage of the api.
> >> > > > Then +gfs2 maintainers.
> >> > > >
> >> > > > > Now if we should turn this into a non-WARN message, that's a 
> >> > > > > different
> >> > > > > thing, I'll gladly take a patch for that.
> >> > > > If it's API usage bug in higher level code, then I think WARN is a
> >> > > > proper thing. We already had similar ones and they were fixed.
> >> > >
> >> > > I'm trying to figure out what the test is doing, but it is not very 
> >> > > clear.
> >> > > At a guess I'd say that perhaps it is trying to mount multiple 
> >> > > filesystems
> >> > > with the same label? If that is the case then it is not allowed, and it
> >> > > should be caught be the sysfs code and result in a refusal to mount, 
> >> > > which
> >> > > is what I think I see here. Knowing which sysfs directory is involved 
> >> > > would
> >> > > allow us to confirm, but I suspect that the test needs altering to 
> >> > > give each
> >> > > gfs2 mount a different label at an initial guess,
> >> >
> >> > Hi Steve,
> >> >
> >> > But Greg claims that this is incorrect usage of sysfs API:
> >> >
> >> > > gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
> >> > > usage of the api.
> >> > I think this means that sysfs callers must not try 

Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Greg KH
On Thu, Apr 05, 2018 at 03:59:58PM +0200, Dmitry Vyukov wrote:
> On Thu, Apr 5, 2018 at 3:34 PM, Greg KH  wrote:
> > On Thu, Apr 05, 2018 at 10:00:04AM +0100, Steven Whitehouse wrote:
> >> Hi,
> >>
> >>
> >> On 05/04/18 09:52, Dmitry Vyukov wrote:
> >> > On Thu, Apr 5, 2018 at 10:36 AM, Steven Whitehouse  
> >> > wrote:
> >> > > Hi,
> >> > >
> >> > >
> >> > >
> >> > > On 05/04/18 09:19, Dmitry Vyukov wrote:
> >> > > > On Thu, Apr 5, 2018 at 8:34 AM, Greg KH 
> >> > > > wrote:
> >> > > > > On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:
> >> > > > > > Hello,
> >> > > > > >
> >> > > > > > syzbot hit the following crash on upstream commit
> >> > > > > > 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 
> >> > > > > > 2018 +)
> >> > > > > > Merge tag 'ext4_for_linus' of
> >> > > > > > git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
> >> > > > > > syzbot dashboard link:
> >> > > > > > https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5
> >> > > > > >
> >> > > > > > C reproducer:
> >> > > > > > https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
> >> > > > > > syzkaller reproducer:
> >> > > > > > https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
> >> > > > > > Raw console output:
> >> > > > > > https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
> >> > > > > > Kernel config:
> >> > > > > > https://syzkaller.appspot.com/x/.config?id=9118669095563550941
> >> > > > > > compiler: gcc (GCC) 7.1.1 20170620
> >> > > > > >
> >> > > > > > IMPORTANT: if you fix the bug, please add the following tag to 
> >> > > > > > the
> >> > > > > > commit:
> >> > > > > > Reported-by: 
> >> > > > > > syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
> >> > > > > > It will help syzbot understand when the bug is fixed. See footer 
> >> > > > > > for
> >> > > > > > details.
> >> > > > > > If you forward the report, please keep this part and the footer.
> >> > > > > >
> >> > > > > > R10:  R11: 0286 R12: 0003
> >> > > > > > R13: 0004 R14:  R15: 
> >> > > > > > [ cut here ]
> >> > > > > > kobject_add_internal failed for nodev( with -EEXIST, don't try to
> >> > > > > > register
> >> > > > > > things with the same name in the same directory.
> >> > > > > > sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
> >> > > > > > WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
> >> > > > > > kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
> >> > > > > > CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
> >> > > > > > Kernel panic - not syncing: panic_on_warn set ...
> >> > > > > >
> >> > > > > > Hardware name: Google Google Compute Engine/Google Compute 
> >> > > > > > Engine, BIOS
> >> > > > > > Google 01/01/2011
> >> > > > > > Call Trace:
> >> > > > > >__dump_stack lib/dump_stack.c:17 [inline]
> >> > > > > >dump_stack+0x1a7/0x27d lib/dump_stack.c:53
> >> > > > > >sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
> >> > > > > >sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
> >> > > > > >create_dir lib/kobject.c:69 [inline]
> >> > > > > >kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
> >> > > > > >kobject_add_varg lib/kobject.c:364 [inline]
> >> > > > > >kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
> >> > > > > >gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
> >> > > > > >fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
> >> > > > > >gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
> >> > > > > gfs2 bug, not a sysfs bug, we are correctly warning about an 
> >> > > > > incorrect
> >> > > > > usage of the api.
> >> > > > Then +gfs2 maintainers.
> >> > > >
> >> > > > > Now if we should turn this into a non-WARN message, that's a 
> >> > > > > different
> >> > > > > thing, I'll gladly take a patch for that.
> >> > > > If it's API usage bug in higher level code, then I think WARN is a
> >> > > > proper thing. We already had similar ones and they were fixed.
> >> > >
> >> > > I'm trying to figure out what the test is doing, but it is not very 
> >> > > clear.
> >> > > At a guess I'd say that perhaps it is trying to mount multiple 
> >> > > filesystems
> >> > > with the same label? If that is the case then it is not allowed, and it
> >> > > should be caught be the sysfs code and result in a refusal to mount, 
> >> > > which
> >> > > is what I think I see here. Knowing which sysfs directory is involved 
> >> > > would
> >> > > allow us to confirm, but I suspect that the test needs altering to 
> >> > > give each
> >> > > gfs2 mount a different label at an initial guess,
> >> >
> >> > Hi Steve,
> >> >
> >> > But Greg claims that this is incorrect usage of sysfs API:
> >> >
> >> > > gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
> >> > > usage of the api.
> >> > I think this means that sysfs callers must not try to create the same
> >> > thing twice.
> >> >
> >> > Either way user-space 

Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Dmitry Vyukov
On Thu, Apr 5, 2018 at 3:34 PM, Greg KH  wrote:
> On Thu, Apr 05, 2018 at 10:00:04AM +0100, Steven Whitehouse wrote:
>> Hi,
>>
>>
>> On 05/04/18 09:52, Dmitry Vyukov wrote:
>> > On Thu, Apr 5, 2018 at 10:36 AM, Steven Whitehouse  
>> > wrote:
>> > > Hi,
>> > >
>> > >
>> > >
>> > > On 05/04/18 09:19, Dmitry Vyukov wrote:
>> > > > On Thu, Apr 5, 2018 at 8:34 AM, Greg KH 
>> > > > wrote:
>> > > > > On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:
>> > > > > > Hello,
>> > > > > >
>> > > > > > syzbot hit the following crash on upstream commit
>> > > > > > 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 
>> > > > > > +)
>> > > > > > Merge tag 'ext4_for_linus' of
>> > > > > > git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
>> > > > > > syzbot dashboard link:
>> > > > > > https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5
>> > > > > >
>> > > > > > C reproducer:
>> > > > > > https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
>> > > > > > syzkaller reproducer:
>> > > > > > https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
>> > > > > > Raw console output:
>> > > > > > https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
>> > > > > > Kernel config:
>> > > > > > https://syzkaller.appspot.com/x/.config?id=9118669095563550941
>> > > > > > compiler: gcc (GCC) 7.1.1 20170620
>> > > > > >
>> > > > > > IMPORTANT: if you fix the bug, please add the following tag to the
>> > > > > > commit:
>> > > > > > Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
>> > > > > > It will help syzbot understand when the bug is fixed. See footer 
>> > > > > > for
>> > > > > > details.
>> > > > > > If you forward the report, please keep this part and the footer.
>> > > > > >
>> > > > > > R10:  R11: 0286 R12: 0003
>> > > > > > R13: 0004 R14:  R15: 
>> > > > > > [ cut here ]
>> > > > > > kobject_add_internal failed for nodev( with -EEXIST, don't try to
>> > > > > > register
>> > > > > > things with the same name in the same directory.
>> > > > > > sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
>> > > > > > WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
>> > > > > > kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
>> > > > > > CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
>> > > > > > Kernel panic - not syncing: panic_on_warn set ...
>> > > > > >
>> > > > > > Hardware name: Google Google Compute Engine/Google Compute Engine, 
>> > > > > > BIOS
>> > > > > > Google 01/01/2011
>> > > > > > Call Trace:
>> > > > > >__dump_stack lib/dump_stack.c:17 [inline]
>> > > > > >dump_stack+0x1a7/0x27d lib/dump_stack.c:53
>> > > > > >sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
>> > > > > >sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
>> > > > > >create_dir lib/kobject.c:69 [inline]
>> > > > > >kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
>> > > > > >kobject_add_varg lib/kobject.c:364 [inline]
>> > > > > >kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
>> > > > > >gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
>> > > > > >fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
>> > > > > >gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
>> > > > > gfs2 bug, not a sysfs bug, we are correctly warning about an 
>> > > > > incorrect
>> > > > > usage of the api.
>> > > > Then +gfs2 maintainers.
>> > > >
>> > > > > Now if we should turn this into a non-WARN message, that's a 
>> > > > > different
>> > > > > thing, I'll gladly take a patch for that.
>> > > > If it's API usage bug in higher level code, then I think WARN is a
>> > > > proper thing. We already had similar ones and they were fixed.
>> > >
>> > > I'm trying to figure out what the test is doing, but it is not very 
>> > > clear.
>> > > At a guess I'd say that perhaps it is trying to mount multiple 
>> > > filesystems
>> > > with the same label? If that is the case then it is not allowed, and it
>> > > should be caught be the sysfs code and result in a refusal to mount, 
>> > > which
>> > > is what I think I see here. Knowing which sysfs directory is involved 
>> > > would
>> > > allow us to confirm, but I suspect that the test needs altering to give 
>> > > each
>> > > gfs2 mount a different label at an initial guess,
>> >
>> > Hi Steve,
>> >
>> > But Greg claims that this is incorrect usage of sysfs API:
>> >
>> > > gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
>> > > usage of the api.
>> > I think this means that sysfs callers must not try to create the same
>> > thing twice.
>> >
>> > Either way user-space code must not be able to triggers WARNINGs in
>> > kernel. If it does than this is something to fix in kernel.
>>
>> I guess that this warning was added more recently as I've not seen it
>> before.
>
> No, it has been there since 

Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Dmitry Vyukov
On Thu, Apr 5, 2018 at 3:34 PM, Greg KH  wrote:
> On Thu, Apr 05, 2018 at 10:00:04AM +0100, Steven Whitehouse wrote:
>> Hi,
>>
>>
>> On 05/04/18 09:52, Dmitry Vyukov wrote:
>> > On Thu, Apr 5, 2018 at 10:36 AM, Steven Whitehouse  
>> > wrote:
>> > > Hi,
>> > >
>> > >
>> > >
>> > > On 05/04/18 09:19, Dmitry Vyukov wrote:
>> > > > On Thu, Apr 5, 2018 at 8:34 AM, Greg KH 
>> > > > wrote:
>> > > > > On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:
>> > > > > > Hello,
>> > > > > >
>> > > > > > syzbot hit the following crash on upstream commit
>> > > > > > 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 
>> > > > > > +)
>> > > > > > Merge tag 'ext4_for_linus' of
>> > > > > > git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
>> > > > > > syzbot dashboard link:
>> > > > > > https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5
>> > > > > >
>> > > > > > C reproducer:
>> > > > > > https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
>> > > > > > syzkaller reproducer:
>> > > > > > https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
>> > > > > > Raw console output:
>> > > > > > https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
>> > > > > > Kernel config:
>> > > > > > https://syzkaller.appspot.com/x/.config?id=9118669095563550941
>> > > > > > compiler: gcc (GCC) 7.1.1 20170620
>> > > > > >
>> > > > > > IMPORTANT: if you fix the bug, please add the following tag to the
>> > > > > > commit:
>> > > > > > Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
>> > > > > > It will help syzbot understand when the bug is fixed. See footer 
>> > > > > > for
>> > > > > > details.
>> > > > > > If you forward the report, please keep this part and the footer.
>> > > > > >
>> > > > > > R10:  R11: 0286 R12: 0003
>> > > > > > R13: 0004 R14:  R15: 
>> > > > > > [ cut here ]
>> > > > > > kobject_add_internal failed for nodev( with -EEXIST, don't try to
>> > > > > > register
>> > > > > > things with the same name in the same directory.
>> > > > > > sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
>> > > > > > WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
>> > > > > > kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
>> > > > > > CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
>> > > > > > Kernel panic - not syncing: panic_on_warn set ...
>> > > > > >
>> > > > > > Hardware name: Google Google Compute Engine/Google Compute Engine, 
>> > > > > > BIOS
>> > > > > > Google 01/01/2011
>> > > > > > Call Trace:
>> > > > > >__dump_stack lib/dump_stack.c:17 [inline]
>> > > > > >dump_stack+0x1a7/0x27d lib/dump_stack.c:53
>> > > > > >sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
>> > > > > >sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
>> > > > > >create_dir lib/kobject.c:69 [inline]
>> > > > > >kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
>> > > > > >kobject_add_varg lib/kobject.c:364 [inline]
>> > > > > >kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
>> > > > > >gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
>> > > > > >fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
>> > > > > >gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
>> > > > > gfs2 bug, not a sysfs bug, we are correctly warning about an 
>> > > > > incorrect
>> > > > > usage of the api.
>> > > > Then +gfs2 maintainers.
>> > > >
>> > > > > Now if we should turn this into a non-WARN message, that's a 
>> > > > > different
>> > > > > thing, I'll gladly take a patch for that.
>> > > > If it's API usage bug in higher level code, then I think WARN is a
>> > > > proper thing. We already had similar ones and they were fixed.
>> > >
>> > > I'm trying to figure out what the test is doing, but it is not very 
>> > > clear.
>> > > At a guess I'd say that perhaps it is trying to mount multiple 
>> > > filesystems
>> > > with the same label? If that is the case then it is not allowed, and it
>> > > should be caught be the sysfs code and result in a refusal to mount, 
>> > > which
>> > > is what I think I see here. Knowing which sysfs directory is involved 
>> > > would
>> > > allow us to confirm, but I suspect that the test needs altering to give 
>> > > each
>> > > gfs2 mount a different label at an initial guess,
>> >
>> > Hi Steve,
>> >
>> > But Greg claims that this is incorrect usage of sysfs API:
>> >
>> > > gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
>> > > usage of the api.
>> > I think this means that sysfs callers must not try to create the same
>> > thing twice.
>> >
>> > Either way user-space code must not be able to triggers WARNINGs in
>> > kernel. If it does than this is something to fix in kernel.
>>
>> I guess that this warning was added more recently as I've not seen it
>> before.
>
> No, it has been there since at least the 3.13 kernel release (back in
> 2013), which is where it got moved 

Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Steven Whitehouse

Hi,


On 05/04/18 14:34, Greg KH wrote:

On Thu, Apr 05, 2018 at 10:00:04AM +0100, Steven Whitehouse wrote:

Hi,


On 05/04/18 09:52, Dmitry Vyukov wrote:

On Thu, Apr 5, 2018 at 10:36 AM, Steven Whitehouse  wrote:

Hi,



On 05/04/18 09:19, Dmitry Vyukov wrote:

On Thu, Apr 5, 2018 at 8:34 AM, Greg KH 
wrote:

On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:

Hello,

syzbot hit the following crash on upstream commit
3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 +)
Merge tag 'ext4_for_linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
syzbot dashboard link:
https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5

C reproducer:
https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
syzkaller reproducer:
https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
Raw console output:
https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
Kernel config:
https://syzkaller.appspot.com/x/.config?id=9118669095563550941
compiler: gcc (GCC) 7.1.1 20170620

IMPORTANT: if you fix the bug, please add the following tag to the
commit:
Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for
details.
If you forward the report, please keep this part and the footer.

R10:  R11: 0286 R12: 0003
R13: 0004 R14:  R15: 
[ cut here ]
kobject_add_internal failed for nodev( with -EEXIST, don't try to
register
things with the same name in the same directory.
sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
Kernel panic - not syncing: panic_on_warn set ...

Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1a7/0x27d lib/dump_stack.c:53
sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
create_dir lib/kobject.c:69 [inline]
kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
kobject_add_varg lib/kobject.c:364 [inline]
kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321

gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
usage of the api.

Then +gfs2 maintainers.


Now if we should turn this into a non-WARN message, that's a different
thing, I'll gladly take a patch for that.

If it's API usage bug in higher level code, then I think WARN is a
proper thing. We already had similar ones and they were fixed.

I'm trying to figure out what the test is doing, but it is not very clear.
At a guess I'd say that perhaps it is trying to mount multiple filesystems
with the same label? If that is the case then it is not allowed, and it
should be caught be the sysfs code and result in a refusal to mount, which
is what I think I see here. Knowing which sysfs directory is involved would
allow us to confirm, but I suspect that the test needs altering to give each
gfs2 mount a different label at an initial guess,

Hi Steve,

But Greg claims that this is incorrect usage of sysfs API:


gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
usage of the api.

I think this means that sysfs callers must not try to create the same
thing twice.

Either way user-space code must not be able to triggers WARNINGs in
kernel. If it does than this is something to fix in kernel.

I guess that this warning was added more recently as I've not seen it
before.

No, it has been there since at least the 3.13 kernel release (back in
2013), which is where it got moved to a separate function, but the logic
has been around in the kernel tree for much longer than that as seen in
commit d1c1459e4594 ("sysfs: separate out dup filename warning into a
separate function")


My expectation is that it will return -EEXIST and not print a
warning there. To avoid that we would have to create a new list of GFS2
superblocks, and check the list for each mount I think. We could do that,
but it seems a bit odd to duplicate code that is already there and working.

Don't you have a list of the "names" of the things you are creating
somewhere?  Or are you relying on sysfs to do your housekeeping for you?

Also, why did this trigger a syzbot report?  It's only a dump_stack()
reference, one showing that yes, this is something that should not be
done, but the kernel keeps on working afterward.

thanks,

greg k-h


Unfortunately, no. We don't have the list of names elsewhere. The names 
are used as a cluster-wide ID, so not having duplicates on a single node 
is a good thing 

Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Steven Whitehouse

Hi,


On 05/04/18 14:34, Greg KH wrote:

On Thu, Apr 05, 2018 at 10:00:04AM +0100, Steven Whitehouse wrote:

Hi,


On 05/04/18 09:52, Dmitry Vyukov wrote:

On Thu, Apr 5, 2018 at 10:36 AM, Steven Whitehouse  wrote:

Hi,



On 05/04/18 09:19, Dmitry Vyukov wrote:

On Thu, Apr 5, 2018 at 8:34 AM, Greg KH 
wrote:

On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:

Hello,

syzbot hit the following crash on upstream commit
3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 +)
Merge tag 'ext4_for_linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
syzbot dashboard link:
https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5

C reproducer:
https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
syzkaller reproducer:
https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
Raw console output:
https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
Kernel config:
https://syzkaller.appspot.com/x/.config?id=9118669095563550941
compiler: gcc (GCC) 7.1.1 20170620

IMPORTANT: if you fix the bug, please add the following tag to the
commit:
Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for
details.
If you forward the report, please keep this part and the footer.

R10:  R11: 0286 R12: 0003
R13: 0004 R14:  R15: 
[ cut here ]
kobject_add_internal failed for nodev( with -EEXIST, don't try to
register
things with the same name in the same directory.
sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
Kernel panic - not syncing: panic_on_warn set ...

Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1a7/0x27d lib/dump_stack.c:53
sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
create_dir lib/kobject.c:69 [inline]
kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
kobject_add_varg lib/kobject.c:364 [inline]
kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321

gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
usage of the api.

Then +gfs2 maintainers.


Now if we should turn this into a non-WARN message, that's a different
thing, I'll gladly take a patch for that.

If it's API usage bug in higher level code, then I think WARN is a
proper thing. We already had similar ones and they were fixed.

I'm trying to figure out what the test is doing, but it is not very clear.
At a guess I'd say that perhaps it is trying to mount multiple filesystems
with the same label? If that is the case then it is not allowed, and it
should be caught be the sysfs code and result in a refusal to mount, which
is what I think I see here. Knowing which sysfs directory is involved would
allow us to confirm, but I suspect that the test needs altering to give each
gfs2 mount a different label at an initial guess,

Hi Steve,

But Greg claims that this is incorrect usage of sysfs API:


gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
usage of the api.

I think this means that sysfs callers must not try to create the same
thing twice.

Either way user-space code must not be able to triggers WARNINGs in
kernel. If it does than this is something to fix in kernel.

I guess that this warning was added more recently as I've not seen it
before.

No, it has been there since at least the 3.13 kernel release (back in
2013), which is where it got moved to a separate function, but the logic
has been around in the kernel tree for much longer than that as seen in
commit d1c1459e4594 ("sysfs: separate out dup filename warning into a
separate function")


My expectation is that it will return -EEXIST and not print a
warning there. To avoid that we would have to create a new list of GFS2
superblocks, and check the list for each mount I think. We could do that,
but it seems a bit odd to duplicate code that is already there and working.

Don't you have a list of the "names" of the things you are creating
somewhere?  Or are you relying on sysfs to do your housekeeping for you?

Also, why did this trigger a syzbot report?  It's only a dump_stack()
reference, one showing that yes, this is something that should not be
done, but the kernel keeps on working afterward.

thanks,

greg k-h


Unfortunately, no. We don't have the list of names elsewhere. The names 
are used as a cluster-wide ID, so not having duplicates on a single node 
is a good thing :-) The name is effectively the same as the fs 

Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Greg KH
On Thu, Apr 05, 2018 at 10:00:04AM +0100, Steven Whitehouse wrote:
> Hi,
> 
> 
> On 05/04/18 09:52, Dmitry Vyukov wrote:
> > On Thu, Apr 5, 2018 at 10:36 AM, Steven Whitehouse  
> > wrote:
> > > Hi,
> > > 
> > > 
> > > 
> > > On 05/04/18 09:19, Dmitry Vyukov wrote:
> > > > On Thu, Apr 5, 2018 at 8:34 AM, Greg KH 
> > > > wrote:
> > > > > On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:
> > > > > > Hello,
> > > > > > 
> > > > > > syzbot hit the following crash on upstream commit
> > > > > > 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 
> > > > > > +)
> > > > > > Merge tag 'ext4_for_linus' of
> > > > > > git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
> > > > > > syzbot dashboard link:
> > > > > > https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5
> > > > > > 
> > > > > > C reproducer:
> > > > > > https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
> > > > > > syzkaller reproducer:
> > > > > > https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
> > > > > > Raw console output:
> > > > > > https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
> > > > > > Kernel config:
> > > > > > https://syzkaller.appspot.com/x/.config?id=9118669095563550941
> > > > > > compiler: gcc (GCC) 7.1.1 20170620
> > > > > > 
> > > > > > IMPORTANT: if you fix the bug, please add the following tag to the
> > > > > > commit:
> > > > > > Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
> > > > > > It will help syzbot understand when the bug is fixed. See footer for
> > > > > > details.
> > > > > > If you forward the report, please keep this part and the footer.
> > > > > > 
> > > > > > R10:  R11: 0286 R12: 0003
> > > > > > R13: 0004 R14:  R15: 
> > > > > > [ cut here ]
> > > > > > kobject_add_internal failed for nodev( with -EEXIST, don't try to
> > > > > > register
> > > > > > things with the same name in the same directory.
> > > > > > sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
> > > > > > WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
> > > > > > kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
> > > > > > CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
> > > > > > Kernel panic - not syncing: panic_on_warn set ...
> > > > > > 
> > > > > > Hardware name: Google Google Compute Engine/Google Compute Engine, 
> > > > > > BIOS
> > > > > > Google 01/01/2011
> > > > > > Call Trace:
> > > > > >__dump_stack lib/dump_stack.c:17 [inline]
> > > > > >dump_stack+0x1a7/0x27d lib/dump_stack.c:53
> > > > > >sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
> > > > > >sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
> > > > > >create_dir lib/kobject.c:69 [inline]
> > > > > >kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
> > > > > >kobject_add_varg lib/kobject.c:364 [inline]
> > > > > >kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
> > > > > >gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
> > > > > >fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
> > > > > >gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
> > > > > gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
> > > > > usage of the api.
> > > > Then +gfs2 maintainers.
> > > > 
> > > > > Now if we should turn this into a non-WARN message, that's a different
> > > > > thing, I'll gladly take a patch for that.
> > > > If it's API usage bug in higher level code, then I think WARN is a
> > > > proper thing. We already had similar ones and they were fixed.
> > > 
> > > I'm trying to figure out what the test is doing, but it is not very clear.
> > > At a guess I'd say that perhaps it is trying to mount multiple filesystems
> > > with the same label? If that is the case then it is not allowed, and it
> > > should be caught be the sysfs code and result in a refusal to mount, which
> > > is what I think I see here. Knowing which sysfs directory is involved 
> > > would
> > > allow us to confirm, but I suspect that the test needs altering to give 
> > > each
> > > gfs2 mount a different label at an initial guess,
> > 
> > Hi Steve,
> > 
> > But Greg claims that this is incorrect usage of sysfs API:
> > 
> > > gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
> > > usage of the api.
> > I think this means that sysfs callers must not try to create the same
> > thing twice.
> > 
> > Either way user-space code must not be able to triggers WARNINGs in
> > kernel. If it does than this is something to fix in kernel.
> 
> I guess that this warning was added more recently as I've not seen it
> before.

No, it has been there since at least the 3.13 kernel release (back in
2013), which is where it got moved to a separate function, but the logic
has been around in the kernel tree for much longer than that as seen in
commit d1c1459e4594 ("sysfs: separate out 

Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Greg KH
On Thu, Apr 05, 2018 at 10:00:04AM +0100, Steven Whitehouse wrote:
> Hi,
> 
> 
> On 05/04/18 09:52, Dmitry Vyukov wrote:
> > On Thu, Apr 5, 2018 at 10:36 AM, Steven Whitehouse  
> > wrote:
> > > Hi,
> > > 
> > > 
> > > 
> > > On 05/04/18 09:19, Dmitry Vyukov wrote:
> > > > On Thu, Apr 5, 2018 at 8:34 AM, Greg KH 
> > > > wrote:
> > > > > On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:
> > > > > > Hello,
> > > > > > 
> > > > > > syzbot hit the following crash on upstream commit
> > > > > > 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 
> > > > > > +)
> > > > > > Merge tag 'ext4_for_linus' of
> > > > > > git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
> > > > > > syzbot dashboard link:
> > > > > > https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5
> > > > > > 
> > > > > > C reproducer:
> > > > > > https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
> > > > > > syzkaller reproducer:
> > > > > > https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
> > > > > > Raw console output:
> > > > > > https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
> > > > > > Kernel config:
> > > > > > https://syzkaller.appspot.com/x/.config?id=9118669095563550941
> > > > > > compiler: gcc (GCC) 7.1.1 20170620
> > > > > > 
> > > > > > IMPORTANT: if you fix the bug, please add the following tag to the
> > > > > > commit:
> > > > > > Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
> > > > > > It will help syzbot understand when the bug is fixed. See footer for
> > > > > > details.
> > > > > > If you forward the report, please keep this part and the footer.
> > > > > > 
> > > > > > R10:  R11: 0286 R12: 0003
> > > > > > R13: 0004 R14:  R15: 
> > > > > > [ cut here ]
> > > > > > kobject_add_internal failed for nodev( with -EEXIST, don't try to
> > > > > > register
> > > > > > things with the same name in the same directory.
> > > > > > sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
> > > > > > WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
> > > > > > kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
> > > > > > CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
> > > > > > Kernel panic - not syncing: panic_on_warn set ...
> > > > > > 
> > > > > > Hardware name: Google Google Compute Engine/Google Compute Engine, 
> > > > > > BIOS
> > > > > > Google 01/01/2011
> > > > > > Call Trace:
> > > > > >__dump_stack lib/dump_stack.c:17 [inline]
> > > > > >dump_stack+0x1a7/0x27d lib/dump_stack.c:53
> > > > > >sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
> > > > > >sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
> > > > > >create_dir lib/kobject.c:69 [inline]
> > > > > >kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
> > > > > >kobject_add_varg lib/kobject.c:364 [inline]
> > > > > >kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
> > > > > >gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
> > > > > >fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
> > > > > >gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
> > > > > gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
> > > > > usage of the api.
> > > > Then +gfs2 maintainers.
> > > > 
> > > > > Now if we should turn this into a non-WARN message, that's a different
> > > > > thing, I'll gladly take a patch for that.
> > > > If it's API usage bug in higher level code, then I think WARN is a
> > > > proper thing. We already had similar ones and they were fixed.
> > > 
> > > I'm trying to figure out what the test is doing, but it is not very clear.
> > > At a guess I'd say that perhaps it is trying to mount multiple filesystems
> > > with the same label? If that is the case then it is not allowed, and it
> > > should be caught be the sysfs code and result in a refusal to mount, which
> > > is what I think I see here. Knowing which sysfs directory is involved 
> > > would
> > > allow us to confirm, but I suspect that the test needs altering to give 
> > > each
> > > gfs2 mount a different label at an initial guess,
> > 
> > Hi Steve,
> > 
> > But Greg claims that this is incorrect usage of sysfs API:
> > 
> > > gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
> > > usage of the api.
> > I think this means that sysfs callers must not try to create the same
> > thing twice.
> > 
> > Either way user-space code must not be able to triggers WARNINGs in
> > kernel. If it does than this is something to fix in kernel.
> 
> I guess that this warning was added more recently as I've not seen it
> before.

No, it has been there since at least the 3.13 kernel release (back in
2013), which is where it got moved to a separate function, but the logic
has been around in the kernel tree for much longer than that as seen in
commit d1c1459e4594 ("sysfs: separate out dup filename warning into a
separate function")


Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Dmitry Vyukov
On Thu, Apr 5, 2018 at 11:00 AM, Steven Whitehouse  wrote:
> Hi,
>
>
>
> On 05/04/18 09:52, Dmitry Vyukov wrote:
>>
>> On Thu, Apr 5, 2018 at 10:36 AM, Steven Whitehouse 
>> wrote:
>>>
>>> Hi,
>>>
>>>
>>>
>>> On 05/04/18 09:19, Dmitry Vyukov wrote:

 On Thu, Apr 5, 2018 at 8:34 AM, Greg KH 
 wrote:
>
> On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:
>>
>> Hello,
>>
>> syzbot hit the following crash on upstream commit
>> 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018
>> +)
>> Merge tag 'ext4_for_linus' of
>> git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
>> syzbot dashboard link:
>> https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5
>>
>> C reproducer:
>> https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
>> syzkaller reproducer:
>> https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
>> Raw console output:
>> https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
>> Kernel config:
>> https://syzkaller.appspot.com/x/.config?id=9118669095563550941
>> compiler: gcc (GCC) 7.1.1 20170620
>>
>> IMPORTANT: if you fix the bug, please add the following tag to the
>> commit:
>> Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
>> It will help syzbot understand when the bug is fixed. See footer for
>> details.
>> If you forward the report, please keep this part and the footer.
>>
>> R10:  R11: 0286 R12: 0003
>> R13: 0004 R14:  R15: 
>> [ cut here ]
>> kobject_add_internal failed for nodev( with -EEXIST, don't try to
>> register
>> things with the same name in the same directory.
>> sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
>> WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
>> kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
>> CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
>> Kernel panic - not syncing: panic_on_warn set ...
>>
>> Hardware name: Google Google Compute Engine/Google Compute Engine,
>> BIOS
>> Google 01/01/2011
>> Call Trace:
>>__dump_stack lib/dump_stack.c:17 [inline]
>>dump_stack+0x1a7/0x27d lib/dump_stack.c:53
>>sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
>>sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
>>create_dir lib/kobject.c:69 [inline]
>>kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
>>kobject_add_varg lib/kobject.c:364 [inline]
>>kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
>>gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
>>fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
>>gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
>
> gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
> usage of the api.

 Then +gfs2 maintainers.

> Now if we should turn this into a non-WARN message, that's a different
> thing, I'll gladly take a patch for that.

 If it's API usage bug in higher level code, then I think WARN is a
 proper thing. We already had similar ones and they were fixed.
>>>
>>>
>>> I'm trying to figure out what the test is doing, but it is not very
>>> clear.
>>> At a guess I'd say that perhaps it is trying to mount multiple
>>> filesystems
>>> with the same label? If that is the case then it is not allowed, and it
>>> should be caught be the sysfs code and result in a refusal to mount,
>>> which
>>> is what I think I see here. Knowing which sysfs directory is involved
>>> would
>>> allow us to confirm, but I suspect that the test needs altering to give
>>> each
>>> gfs2 mount a different label at an initial guess,
>>
>>
>> Hi Steve,
>>
>> But Greg claims that this is incorrect usage of sysfs API:
>>
>>> gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
>>> usage of the api.
>>
>> I think this means that sysfs callers must not try to create the same
>> thing twice.
>>
>> Either way user-space code must not be able to triggers WARNINGs in
>> kernel. If it does than this is something to fix in kernel.
>
>
> I guess that this warning was added more recently as I've not seen it
> before. My expectation is that it will return -EEXIST and not print a
> warning there. To avoid that we would have to create a new list of GFS2
> superblocks, and check the list for each mount I think. We could do that,
> but it seems a bit odd to duplicate code that is already there and working.
>
> So it sounds like a case of differing assumptions about what is a valid use
> of the sysfs api. Shouldn't be too hard to fix though,


Greg?

Should we go with your other option of demoting WARNING to pr_err
then? I don't how many real bugs that warning 

Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Dmitry Vyukov
On Thu, Apr 5, 2018 at 11:00 AM, Steven Whitehouse  wrote:
> Hi,
>
>
>
> On 05/04/18 09:52, Dmitry Vyukov wrote:
>>
>> On Thu, Apr 5, 2018 at 10:36 AM, Steven Whitehouse 
>> wrote:
>>>
>>> Hi,
>>>
>>>
>>>
>>> On 05/04/18 09:19, Dmitry Vyukov wrote:

 On Thu, Apr 5, 2018 at 8:34 AM, Greg KH 
 wrote:
>
> On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:
>>
>> Hello,
>>
>> syzbot hit the following crash on upstream commit
>> 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018
>> +)
>> Merge tag 'ext4_for_linus' of
>> git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
>> syzbot dashboard link:
>> https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5
>>
>> C reproducer:
>> https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
>> syzkaller reproducer:
>> https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
>> Raw console output:
>> https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
>> Kernel config:
>> https://syzkaller.appspot.com/x/.config?id=9118669095563550941
>> compiler: gcc (GCC) 7.1.1 20170620
>>
>> IMPORTANT: if you fix the bug, please add the following tag to the
>> commit:
>> Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
>> It will help syzbot understand when the bug is fixed. See footer for
>> details.
>> If you forward the report, please keep this part and the footer.
>>
>> R10:  R11: 0286 R12: 0003
>> R13: 0004 R14:  R15: 
>> [ cut here ]
>> kobject_add_internal failed for nodev( with -EEXIST, don't try to
>> register
>> things with the same name in the same directory.
>> sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
>> WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
>> kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
>> CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
>> Kernel panic - not syncing: panic_on_warn set ...
>>
>> Hardware name: Google Google Compute Engine/Google Compute Engine,
>> BIOS
>> Google 01/01/2011
>> Call Trace:
>>__dump_stack lib/dump_stack.c:17 [inline]
>>dump_stack+0x1a7/0x27d lib/dump_stack.c:53
>>sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
>>sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
>>create_dir lib/kobject.c:69 [inline]
>>kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
>>kobject_add_varg lib/kobject.c:364 [inline]
>>kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
>>gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
>>fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
>>gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
>
> gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
> usage of the api.

 Then +gfs2 maintainers.

> Now if we should turn this into a non-WARN message, that's a different
> thing, I'll gladly take a patch for that.

 If it's API usage bug in higher level code, then I think WARN is a
 proper thing. We already had similar ones and they were fixed.
>>>
>>>
>>> I'm trying to figure out what the test is doing, but it is not very
>>> clear.
>>> At a guess I'd say that perhaps it is trying to mount multiple
>>> filesystems
>>> with the same label? If that is the case then it is not allowed, and it
>>> should be caught be the sysfs code and result in a refusal to mount,
>>> which
>>> is what I think I see here. Knowing which sysfs directory is involved
>>> would
>>> allow us to confirm, but I suspect that the test needs altering to give
>>> each
>>> gfs2 mount a different label at an initial guess,
>>
>>
>> Hi Steve,
>>
>> But Greg claims that this is incorrect usage of sysfs API:
>>
>>> gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
>>> usage of the api.
>>
>> I think this means that sysfs callers must not try to create the same
>> thing twice.
>>
>> Either way user-space code must not be able to triggers WARNINGs in
>> kernel. If it does than this is something to fix in kernel.
>
>
> I guess that this warning was added more recently as I've not seen it
> before. My expectation is that it will return -EEXIST and not print a
> warning there. To avoid that we would have to create a new list of GFS2
> superblocks, and check the list for each mount I think. We could do that,
> but it seems a bit odd to duplicate code that is already there and working.
>
> So it sounds like a case of differing assumptions about what is a valid use
> of the sysfs api. Shouldn't be too hard to fix though,


Greg?

Should we go with your other option of demoting WARNING to pr_err
then? I don't how many real bugs that warning caught versus callers
just properly handle EEXIST.


Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Steven Whitehouse

Hi,


On 05/04/18 09:52, Dmitry Vyukov wrote:

On Thu, Apr 5, 2018 at 10:36 AM, Steven Whitehouse  wrote:

Hi,



On 05/04/18 09:19, Dmitry Vyukov wrote:

On Thu, Apr 5, 2018 at 8:34 AM, Greg KH 
wrote:

On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:

Hello,

syzbot hit the following crash on upstream commit
3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 +)
Merge tag 'ext4_for_linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
syzbot dashboard link:
https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5

C reproducer:
https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
syzkaller reproducer:
https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
Raw console output:
https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
Kernel config:
https://syzkaller.appspot.com/x/.config?id=9118669095563550941
compiler: gcc (GCC) 7.1.1 20170620

IMPORTANT: if you fix the bug, please add the following tag to the
commit:
Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for
details.
If you forward the report, please keep this part and the footer.

R10:  R11: 0286 R12: 0003
R13: 0004 R14:  R15: 
[ cut here ]
kobject_add_internal failed for nodev( with -EEXIST, don't try to
register
things with the same name in the same directory.
sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
Kernel panic - not syncing: panic_on_warn set ...

Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
   __dump_stack lib/dump_stack.c:17 [inline]
   dump_stack+0x1a7/0x27d lib/dump_stack.c:53
   sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
   sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
   create_dir lib/kobject.c:69 [inline]
   kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
   kobject_add_varg lib/kobject.c:364 [inline]
   kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
   gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
   fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
   gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321

gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
usage of the api.

Then +gfs2 maintainers.


Now if we should turn this into a non-WARN message, that's a different
thing, I'll gladly take a patch for that.

If it's API usage bug in higher level code, then I think WARN is a
proper thing. We already had similar ones and they were fixed.


I'm trying to figure out what the test is doing, but it is not very clear.
At a guess I'd say that perhaps it is trying to mount multiple filesystems
with the same label? If that is the case then it is not allowed, and it
should be caught be the sysfs code and result in a refusal to mount, which
is what I think I see here. Knowing which sysfs directory is involved would
allow us to confirm, but I suspect that the test needs altering to give each
gfs2 mount a different label at an initial guess,


Hi Steve,

But Greg claims that this is incorrect usage of sysfs API:


gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
usage of the api.

I think this means that sysfs callers must not try to create the same
thing twice.

Either way user-space code must not be able to triggers WARNINGs in
kernel. If it does than this is something to fix in kernel.


I guess that this warning was added more recently as I've not seen it 
before. My expectation is that it will return -EEXIST and not print a 
warning there. To avoid that we would have to create a new list of GFS2 
superblocks, and check the list for each mount I think. We could do 
that, but it seems a bit odd to duplicate code that is already there and 
working.


So it sounds like a case of differing assumptions about what is a valid 
use of the sysfs api. Shouldn't be too hard to fix though,


Steve.



Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Steven Whitehouse

Hi,


On 05/04/18 09:52, Dmitry Vyukov wrote:

On Thu, Apr 5, 2018 at 10:36 AM, Steven Whitehouse  wrote:

Hi,



On 05/04/18 09:19, Dmitry Vyukov wrote:

On Thu, Apr 5, 2018 at 8:34 AM, Greg KH 
wrote:

On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:

Hello,

syzbot hit the following crash on upstream commit
3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 +)
Merge tag 'ext4_for_linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
syzbot dashboard link:
https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5

C reproducer:
https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
syzkaller reproducer:
https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
Raw console output:
https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
Kernel config:
https://syzkaller.appspot.com/x/.config?id=9118669095563550941
compiler: gcc (GCC) 7.1.1 20170620

IMPORTANT: if you fix the bug, please add the following tag to the
commit:
Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for
details.
If you forward the report, please keep this part and the footer.

R10:  R11: 0286 R12: 0003
R13: 0004 R14:  R15: 
[ cut here ]
kobject_add_internal failed for nodev( with -EEXIST, don't try to
register
things with the same name in the same directory.
sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
Kernel panic - not syncing: panic_on_warn set ...

Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
   __dump_stack lib/dump_stack.c:17 [inline]
   dump_stack+0x1a7/0x27d lib/dump_stack.c:53
   sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
   sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
   create_dir lib/kobject.c:69 [inline]
   kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
   kobject_add_varg lib/kobject.c:364 [inline]
   kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
   gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
   fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
   gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321

gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
usage of the api.

Then +gfs2 maintainers.


Now if we should turn this into a non-WARN message, that's a different
thing, I'll gladly take a patch for that.

If it's API usage bug in higher level code, then I think WARN is a
proper thing. We already had similar ones and they were fixed.


I'm trying to figure out what the test is doing, but it is not very clear.
At a guess I'd say that perhaps it is trying to mount multiple filesystems
with the same label? If that is the case then it is not allowed, and it
should be caught be the sysfs code and result in a refusal to mount, which
is what I think I see here. Knowing which sysfs directory is involved would
allow us to confirm, but I suspect that the test needs altering to give each
gfs2 mount a different label at an initial guess,


Hi Steve,

But Greg claims that this is incorrect usage of sysfs API:


gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
usage of the api.

I think this means that sysfs callers must not try to create the same
thing twice.

Either way user-space code must not be able to triggers WARNINGs in
kernel. If it does than this is something to fix in kernel.


I guess that this warning was added more recently as I've not seen it 
before. My expectation is that it will return -EEXIST and not print a 
warning there. To avoid that we would have to create a new list of GFS2 
superblocks, and check the list for each mount I think. We could do 
that, but it seems a bit odd to duplicate code that is already there and 
working.


So it sounds like a case of differing assumptions about what is a valid 
use of the sysfs api. Shouldn't be too hard to fix though,


Steve.



Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Dmitry Vyukov
On Thu, Apr 5, 2018 at 10:36 AM, Steven Whitehouse  wrote:
> Hi,
>
>
>
> On 05/04/18 09:19, Dmitry Vyukov wrote:
>>
>> On Thu, Apr 5, 2018 at 8:34 AM, Greg KH 
>> wrote:
>>>
>>> On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:

 Hello,

 syzbot hit the following crash on upstream commit
 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 +)
 Merge tag 'ext4_for_linus' of
 git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
 syzbot dashboard link:
 https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5

 C reproducer:
 https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
 syzkaller reproducer:
 https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
 Raw console output:
 https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
 Kernel config:
 https://syzkaller.appspot.com/x/.config?id=9118669095563550941
 compiler: gcc (GCC) 7.1.1 20170620

 IMPORTANT: if you fix the bug, please add the following tag to the
 commit:
 Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
 It will help syzbot understand when the bug is fixed. See footer for
 details.
 If you forward the report, please keep this part and the footer.

 R10:  R11: 0286 R12: 0003
 R13: 0004 R14:  R15: 
 [ cut here ]
 kobject_add_internal failed for nodev( with -EEXIST, don't try to
 register
 things with the same name in the same directory.
 sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
 WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
 kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
 CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
 Kernel panic - not syncing: panic_on_warn set ...

 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
 Google 01/01/2011
 Call Trace:
   __dump_stack lib/dump_stack.c:17 [inline]
   dump_stack+0x1a7/0x27d lib/dump_stack.c:53
   sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
   sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
   create_dir lib/kobject.c:69 [inline]
   kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
   kobject_add_varg lib/kobject.c:364 [inline]
   kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
   gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
   fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
   gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
>>>
>>> gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
>>> usage of the api.
>>
>> Then +gfs2 maintainers.
>>
>>> Now if we should turn this into a non-WARN message, that's a different
>>> thing, I'll gladly take a patch for that.
>>
>> If it's API usage bug in higher level code, then I think WARN is a
>> proper thing. We already had similar ones and they were fixed.
>
>
> I'm trying to figure out what the test is doing, but it is not very clear.
> At a guess I'd say that perhaps it is trying to mount multiple filesystems
> with the same label? If that is the case then it is not allowed, and it
> should be caught be the sysfs code and result in a refusal to mount, which
> is what I think I see here. Knowing which sysfs directory is involved would
> allow us to confirm, but I suspect that the test needs altering to give each
> gfs2 mount a different label at an initial guess,


Hi Steve,

But Greg claims that this is incorrect usage of sysfs API:

> gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
> usage of the api.

I think this means that sysfs callers must not try to create the same
thing twice.

Either way user-space code must not be able to triggers WARNINGs in
kernel. If it does than this is something to fix in kernel.


Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Dmitry Vyukov
On Thu, Apr 5, 2018 at 10:36 AM, Steven Whitehouse  wrote:
> Hi,
>
>
>
> On 05/04/18 09:19, Dmitry Vyukov wrote:
>>
>> On Thu, Apr 5, 2018 at 8:34 AM, Greg KH 
>> wrote:
>>>
>>> On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:

 Hello,

 syzbot hit the following crash on upstream commit
 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 +)
 Merge tag 'ext4_for_linus' of
 git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
 syzbot dashboard link:
 https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5

 C reproducer:
 https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
 syzkaller reproducer:
 https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
 Raw console output:
 https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
 Kernel config:
 https://syzkaller.appspot.com/x/.config?id=9118669095563550941
 compiler: gcc (GCC) 7.1.1 20170620

 IMPORTANT: if you fix the bug, please add the following tag to the
 commit:
 Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
 It will help syzbot understand when the bug is fixed. See footer for
 details.
 If you forward the report, please keep this part and the footer.

 R10:  R11: 0286 R12: 0003
 R13: 0004 R14:  R15: 
 [ cut here ]
 kobject_add_internal failed for nodev( with -EEXIST, don't try to
 register
 things with the same name in the same directory.
 sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
 WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
 kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
 CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
 Kernel panic - not syncing: panic_on_warn set ...

 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
 Google 01/01/2011
 Call Trace:
   __dump_stack lib/dump_stack.c:17 [inline]
   dump_stack+0x1a7/0x27d lib/dump_stack.c:53
   sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
   sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
   create_dir lib/kobject.c:69 [inline]
   kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
   kobject_add_varg lib/kobject.c:364 [inline]
   kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
   gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
   fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
   gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
>>>
>>> gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
>>> usage of the api.
>>
>> Then +gfs2 maintainers.
>>
>>> Now if we should turn this into a non-WARN message, that's a different
>>> thing, I'll gladly take a patch for that.
>>
>> If it's API usage bug in higher level code, then I think WARN is a
>> proper thing. We already had similar ones and they were fixed.
>
>
> I'm trying to figure out what the test is doing, but it is not very clear.
> At a guess I'd say that perhaps it is trying to mount multiple filesystems
> with the same label? If that is the case then it is not allowed, and it
> should be caught be the sysfs code and result in a refusal to mount, which
> is what I think I see here. Knowing which sysfs directory is involved would
> allow us to confirm, but I suspect that the test needs altering to give each
> gfs2 mount a different label at an initial guess,


Hi Steve,

But Greg claims that this is incorrect usage of sysfs API:

> gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
> usage of the api.

I think this means that sysfs callers must not try to create the same
thing twice.

Either way user-space code must not be able to triggers WARNINGs in
kernel. If it does than this is something to fix in kernel.


Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Steven Whitehouse

Hi,


On 05/04/18 09:19, Dmitry Vyukov wrote:

On Thu, Apr 5, 2018 at 8:34 AM, Greg KH  wrote:

On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:

Hello,

syzbot hit the following crash on upstream commit
3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 +)
Merge tag 'ext4_for_linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
syzbot dashboard link:
https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5

C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
syzkaller reproducer:
https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
Raw console output:
https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
Kernel config:
https://syzkaller.appspot.com/x/.config?id=9118669095563550941
compiler: gcc (GCC) 7.1.1 20170620

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for
details.
If you forward the report, please keep this part and the footer.

R10:  R11: 0286 R12: 0003
R13: 0004 R14:  R15: 
[ cut here ]
kobject_add_internal failed for nodev( with -EEXIST, don't try to register
things with the same name in the same directory.
sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
Kernel panic - not syncing: panic_on_warn set ...

Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
  __dump_stack lib/dump_stack.c:17 [inline]
  dump_stack+0x1a7/0x27d lib/dump_stack.c:53
  sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
  sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
  create_dir lib/kobject.c:69 [inline]
  kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
  kobject_add_varg lib/kobject.c:364 [inline]
  kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
  gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
  fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
  gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321

gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
usage of the api.

Then +gfs2 maintainers.


Now if we should turn this into a non-WARN message, that's a different
thing, I'll gladly take a patch for that.

If it's API usage bug in higher level code, then I think WARN is a
proper thing. We already had similar ones and they were fixed.


I'm trying to figure out what the test is doing, but it is not very 
clear. At a guess I'd say that perhaps it is trying to mount multiple 
filesystems with the same label? If that is the case then it is not 
allowed, and it should be caught be the sysfs code and result in a 
refusal to mount, which is what I think I see here. Knowing which sysfs 
directory is involved would allow us to confirm, but I suspect that the 
test needs altering to give each gfs2 mount a different label at an 
initial guess,


Steve.



Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Steven Whitehouse

Hi,


On 05/04/18 09:19, Dmitry Vyukov wrote:

On Thu, Apr 5, 2018 at 8:34 AM, Greg KH  wrote:

On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:

Hello,

syzbot hit the following crash on upstream commit
3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 +)
Merge tag 'ext4_for_linus' of
git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
syzbot dashboard link:
https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5

C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
syzkaller reproducer:
https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
Raw console output:
https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
Kernel config:
https://syzkaller.appspot.com/x/.config?id=9118669095563550941
compiler: gcc (GCC) 7.1.1 20170620

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for
details.
If you forward the report, please keep this part and the footer.

R10:  R11: 0286 R12: 0003
R13: 0004 R14:  R15: 
[ cut here ]
kobject_add_internal failed for nodev( with -EEXIST, don't try to register
things with the same name in the same directory.
sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
Kernel panic - not syncing: panic_on_warn set ...

Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
  __dump_stack lib/dump_stack.c:17 [inline]
  dump_stack+0x1a7/0x27d lib/dump_stack.c:53
  sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
  sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
  create_dir lib/kobject.c:69 [inline]
  kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
  kobject_add_varg lib/kobject.c:364 [inline]
  kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
  gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
  fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
  gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321

gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
usage of the api.

Then +gfs2 maintainers.


Now if we should turn this into a non-WARN message, that's a different
thing, I'll gladly take a patch for that.

If it's API usage bug in higher level code, then I think WARN is a
proper thing. We already had similar ones and they were fixed.


I'm trying to figure out what the test is doing, but it is not very 
clear. At a guess I'd say that perhaps it is trying to mount multiple 
filesystems with the same label? If that is the case then it is not 
allowed, and it should be caught be the sysfs code and result in a 
refusal to mount, which is what I think I see here. Knowing which sysfs 
directory is involved would allow us to confirm, but I suspect that the 
test needs altering to give each gfs2 mount a different label at an 
initial guess,


Steve.



Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Dmitry Vyukov
On Thu, Apr 5, 2018 at 8:34 AM, Greg KH  wrote:
> On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:
>> Hello,
>>
>> syzbot hit the following crash on upstream commit
>> 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 +)
>> Merge tag 'ext4_for_linus' of
>> git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
>> syzbot dashboard link:
>> https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5
>>
>> C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
>> syzkaller reproducer:
>> https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
>> Raw console output:
>> https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
>> Kernel config:
>> https://syzkaller.appspot.com/x/.config?id=9118669095563550941
>> compiler: gcc (GCC) 7.1.1 20170620
>>
>> IMPORTANT: if you fix the bug, please add the following tag to the commit:
>> Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
>> It will help syzbot understand when the bug is fixed. See footer for
>> details.
>> If you forward the report, please keep this part and the footer.
>>
>> R10:  R11: 0286 R12: 0003
>> R13: 0004 R14:  R15: 
>> [ cut here ]
>> kobject_add_internal failed for nodev( with -EEXIST, don't try to register
>> things with the same name in the same directory.
>> sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
>> WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
>> kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
>> CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
>> Kernel panic - not syncing: panic_on_warn set ...
>>
>> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
>> Google 01/01/2011
>> Call Trace:
>>  __dump_stack lib/dump_stack.c:17 [inline]
>>  dump_stack+0x1a7/0x27d lib/dump_stack.c:53
>>  sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
>>  sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
>>  create_dir lib/kobject.c:69 [inline]
>>  kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
>>  kobject_add_varg lib/kobject.c:364 [inline]
>>  kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
>>  gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
>>  fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
>>  gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
>
> gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
> usage of the api.

Then +gfs2 maintainers.

> Now if we should turn this into a non-WARN message, that's a different
> thing, I'll gladly take a patch for that.

If it's API usage bug in higher level code, then I think WARN is a
proper thing. We already had similar ones and they were fixed.


Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Dmitry Vyukov
On Thu, Apr 5, 2018 at 8:34 AM, Greg KH  wrote:
> On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:
>> Hello,
>>
>> syzbot hit the following crash on upstream commit
>> 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 +)
>> Merge tag 'ext4_for_linus' of
>> git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
>> syzbot dashboard link:
>> https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5
>>
>> C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
>> syzkaller reproducer:
>> https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
>> Raw console output:
>> https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
>> Kernel config:
>> https://syzkaller.appspot.com/x/.config?id=9118669095563550941
>> compiler: gcc (GCC) 7.1.1 20170620
>>
>> IMPORTANT: if you fix the bug, please add the following tag to the commit:
>> Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
>> It will help syzbot understand when the bug is fixed. See footer for
>> details.
>> If you forward the report, please keep this part and the footer.
>>
>> R10:  R11: 0286 R12: 0003
>> R13: 0004 R14:  R15: 
>> [ cut here ]
>> kobject_add_internal failed for nodev( with -EEXIST, don't try to register
>> things with the same name in the same directory.
>> sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
>> WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
>> kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
>> CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
>> Kernel panic - not syncing: panic_on_warn set ...
>>
>> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
>> Google 01/01/2011
>> Call Trace:
>>  __dump_stack lib/dump_stack.c:17 [inline]
>>  dump_stack+0x1a7/0x27d lib/dump_stack.c:53
>>  sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
>>  sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
>>  create_dir lib/kobject.c:69 [inline]
>>  kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
>>  kobject_add_varg lib/kobject.c:364 [inline]
>>  kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
>>  gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
>>  fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
>>  gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
>
> gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
> usage of the api.

Then +gfs2 maintainers.

> Now if we should turn this into a non-WARN message, that's a different
> thing, I'll gladly take a patch for that.

If it's API usage bug in higher level code, then I think WARN is a
proper thing. We already had similar ones and they were fixed.


Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Greg KH
On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:
> Hello,
> 
> syzbot hit the following crash on upstream commit
> 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 +)
> Merge tag 'ext4_for_linus' of
> git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
> syzbot dashboard link:
> https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5
> 
> C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
> syzkaller reproducer:
> https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
> Raw console output:
> https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
> Kernel config:
> https://syzkaller.appspot.com/x/.config?id=9118669095563550941
> compiler: gcc (GCC) 7.1.1 20170620
> 
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
> It will help syzbot understand when the bug is fixed. See footer for
> details.
> If you forward the report, please keep this part and the footer.
> 
> R10:  R11: 0286 R12: 0003
> R13: 0004 R14:  R15: 
> [ cut here ]
> kobject_add_internal failed for nodev( with -EEXIST, don't try to register
> things with the same name in the same directory.
> sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
> WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
> kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
> CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
> Kernel panic - not syncing: panic_on_warn set ...
> 
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:17 [inline]
>  dump_stack+0x1a7/0x27d lib/dump_stack.c:53
>  sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
>  sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
>  create_dir lib/kobject.c:69 [inline]
>  kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
>  kobject_add_varg lib/kobject.c:364 [inline]
>  kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
>  gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
>  fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
>  gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321

gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
usage of the api.

Now if we should turn this into a non-WARN message, that's a different
thing, I'll gladly take a patch for that.

thanks,

greg k-h


Re: WARNING: kobject bug in sysfs_warn_dup

2018-04-05 Thread Greg KH
On Wed, Apr 04, 2018 at 07:02:01PM -0700, syzbot wrote:
> Hello,
> 
> syzbot hit the following crash on upstream commit
> 3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 +)
> Merge tag 'ext4_for_linus' of
> git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
> syzbot dashboard link:
> https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5
> 
> C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
> syzkaller reproducer:
> https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
> Raw console output:
> https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
> Kernel config:
> https://syzkaller.appspot.com/x/.config?id=9118669095563550941
> compiler: gcc (GCC) 7.1.1 20170620
> 
> IMPORTANT: if you fix the bug, please add the following tag to the commit:
> Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
> It will help syzbot understand when the bug is fixed. See footer for
> details.
> If you forward the report, please keep this part and the footer.
> 
> R10:  R11: 0286 R12: 0003
> R13: 0004 R14:  R15: 
> [ cut here ]
> kobject_add_internal failed for nodev( with -EEXIST, don't try to register
> things with the same name in the same directory.
> sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
> WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238
> kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
> CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
> Kernel panic - not syncing: panic_on_warn set ...
> 
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
> Google 01/01/2011
> Call Trace:
>  __dump_stack lib/dump_stack.c:17 [inline]
>  dump_stack+0x1a7/0x27d lib/dump_stack.c:53
>  sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
>  sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
>  create_dir lib/kobject.c:69 [inline]
>  kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
>  kobject_add_varg lib/kobject.c:364 [inline]
>  kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
>  gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
>  fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
>  gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321

gfs2 bug, not a sysfs bug, we are correctly warning about an incorrect
usage of the api.

Now if we should turn this into a non-WARN message, that's a different
thing, I'll gladly take a patch for that.

thanks,

greg k-h


WARNING: kobject bug in sysfs_warn_dup

2018-04-04 Thread syzbot

Hello,

syzbot hit the following crash on upstream commit
3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 +)
Merge tag 'ext4_for_linus' of  
git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
syzbot dashboard link:  
https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5


C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
syzkaller reproducer:  
https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
Raw console output:  
https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
Kernel config:  
https://syzkaller.appspot.com/x/.config?id=9118669095563550941

compiler: gcc (GCC) 7.1.1 20170620

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for  
details.

If you forward the report, please keep this part and the footer.

R10:  R11: 0286 R12: 0003
R13: 0004 R14:  R15: 
[ cut here ]
kobject_add_internal failed for nodev( with -EEXIST, don't try to register  
things with the same name in the same directory.

sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238  
kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235

CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
Kernel panic - not syncing: panic_on_warn set ...

Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011

Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1a7/0x27d lib/dump_stack.c:53
 sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
 sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
 create_dir lib/kobject.c:69 [inline]
 kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
 kobject_add_varg lib/kobject.c:364 [inline]
 kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
 gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
 fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
 gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
 mount_fs+0x66/0x2d0 fs/super.c:1222
 vfs_kern_mount.part.26+0xc6/0x4a0 fs/namespace.c:1037
 vfs_kern_mount fs/namespace.c:2514 [inline]
 do_new_mount fs/namespace.c:2517 [inline]
 do_mount+0xea4/0x2b90 fs/namespace.c:2847
 ksys_mount+0xab/0x120 fs/namespace.c:3063
 SYSC_mount fs/namespace.c:3077 [inline]
 SyS_mount+0x39/0x50 fs/namespace.c:3074
 do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x4432fa
RSP: 002b:7ffda3d84538 EFLAGS: 0286 ORIG_RAX: 00a5
RAX: ffda RBX: 20001a40 RCX: 004432fa
RDX: 20001a00 RSI: 20001a40 RDI: 7ffda3d84550
RBP:  R08: 20001f00 R09: 000a
R10:  R11: 0286 R12: 0003
R13: 0004 R14:  R15: 
CPU: 1 PID: 4473 Comm: syzkaller533472 Not tainted 4.16.0+ #15
[ cut here ]
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011

Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1a7/0x27d lib/dump_stack.c:53
kobject_add_internal failed for nodev( with -EEXIST, don't try to register  
things with the same name in the same directory.

 panic+0x1f8/0x42c kernel/panic.c:183
WARNING: CPU: 0 PID: 4474 at lib/kobject.c:238  
kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235

Modules linked in:
 __warn+0x1dc/0x200 kernel/panic.c:547
CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
 report_bug+0x1f4/0x2b0 lib/bug.c:186
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011

 fixup_bug.part.10+0x37/0x80 arch/x86/kernel/traps.c:178
RIP: 0010:kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
 fixup_bug arch/x86/kernel/traps.c:247 [inline]
 do_error_trap+0x2d7/0x3e0 arch/x86/kernel/traps.c:296
RSP: :8801addaf470 EFLAGS: 00010282
RAX: dc08 RBX: 8801d9661110 RCX: 815b5d2e
RDX:  RSI: 110035bb5e3e RDI: 110035bb5e13
RBP: 8801addaf568 R08: 110035bb5dd5 R09: 0001
R10: 0001 R11:  R12: 110035bb5e94
R13: ffef R14: 8801d39ae348 R15: 110035bb5e98
FS:  01db2880() GS:8801db00() knlGS:
 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:315
 invalid_op+0x1b/0x40 arch/x86/entry/entry_64.S:991
RIP: 0010:kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 019657b0 CR3: 0001ae0ca000 CR4: 001406f0
RSP: 0018:8801ade37470 EFLAGS: 00010282
DR0:  DR1:  DR2: 
DR3:  DR6: fffe0ff0 DR7: 0400
RAX: dc08 RBX: 8801d9459190 

WARNING: kobject bug in sysfs_warn_dup

2018-04-04 Thread syzbot

Hello,

syzbot hit the following crash on upstream commit
3e968c9f1401088abc9a19ae6ff571644d37a355 (Wed Apr 4 21:19:24 2018 +)
Merge tag 'ext4_for_linus' of  
git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
syzbot dashboard link:  
https://syzkaller.appspot.com/bug?extid=ff87a28e665c163aa7f5


C reproducer: https://syzkaller.appspot.com/x/repro.c?id=5104666266304512
syzkaller reproducer:  
https://syzkaller.appspot.com/x/repro.syz?id=5683447737614336
Raw console output:  
https://syzkaller.appspot.com/x/log.txt?id=5104818200772608
Kernel config:  
https://syzkaller.appspot.com/x/.config?id=9118669095563550941

compiler: gcc (GCC) 7.1.1 20170620

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+ff87a28e665c163aa...@syzkaller.appspotmail.com
It will help syzbot understand when the bug is fixed. See footer for  
details.

If you forward the report, please keep this part and the footer.

R10:  R11: 0286 R12: 0003
R13: 0004 R14:  R15: 
[ cut here ]
kobject_add_internal failed for nodev( with -EEXIST, don't try to register  
things with the same name in the same directory.

sysfs: cannot create duplicate filename '/fs/gfs2/nodev('
WARNING: CPU: 1 PID: 4473 at lib/kobject.c:238  
kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235

CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
Kernel panic - not syncing: panic_on_warn set ...

Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011

Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1a7/0x27d lib/dump_stack.c:53
 sysfs_warn_dup+0x83/0xa0 fs/sysfs/dir.c:30
 sysfs_create_dir_ns+0x178/0x1d0 fs/sysfs/dir.c:58
 create_dir lib/kobject.c:69 [inline]
 kobject_add_internal+0x335/0xbc0 lib/kobject.c:227
 kobject_add_varg lib/kobject.c:364 [inline]
 kobject_init_and_add+0xf9/0x150 lib/kobject.c:436
 gfs2_sys_fs_add+0x1ff/0x580 fs/gfs2/sys.c:652
 fill_super+0x86f/0x1d70 fs/gfs2/ops_fstype.c:1118
 gfs2_mount+0x587/0x6e0 fs/gfs2/ops_fstype.c:1321
 mount_fs+0x66/0x2d0 fs/super.c:1222
 vfs_kern_mount.part.26+0xc6/0x4a0 fs/namespace.c:1037
 vfs_kern_mount fs/namespace.c:2514 [inline]
 do_new_mount fs/namespace.c:2517 [inline]
 do_mount+0xea4/0x2b90 fs/namespace.c:2847
 ksys_mount+0xab/0x120 fs/namespace.c:3063
 SYSC_mount fs/namespace.c:3077 [inline]
 SyS_mount+0x39/0x50 fs/namespace.c:3074
 do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x4432fa
RSP: 002b:7ffda3d84538 EFLAGS: 0286 ORIG_RAX: 00a5
RAX: ffda RBX: 20001a40 RCX: 004432fa
RDX: 20001a00 RSI: 20001a40 RDI: 7ffda3d84550
RBP:  R08: 20001f00 R09: 000a
R10:  R11: 0286 R12: 0003
R13: 0004 R14:  R15: 
CPU: 1 PID: 4473 Comm: syzkaller533472 Not tainted 4.16.0+ #15
[ cut here ]
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011

Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x1a7/0x27d lib/dump_stack.c:53
kobject_add_internal failed for nodev( with -EEXIST, don't try to register  
things with the same name in the same directory.

 panic+0x1f8/0x42c kernel/panic.c:183
WARNING: CPU: 0 PID: 4474 at lib/kobject.c:238  
kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235

Modules linked in:
 __warn+0x1dc/0x200 kernel/panic.c:547
CPU: 0 PID: 4474 Comm: syzkaller533472 Not tainted 4.16.0+ #15
 report_bug+0x1f4/0x2b0 lib/bug.c:186
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011

 fixup_bug.part.10+0x37/0x80 arch/x86/kernel/traps.c:178
RIP: 0010:kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
 fixup_bug arch/x86/kernel/traps.c:247 [inline]
 do_error_trap+0x2d7/0x3e0 arch/x86/kernel/traps.c:296
RSP: :8801addaf470 EFLAGS: 00010282
RAX: dc08 RBX: 8801d9661110 RCX: 815b5d2e
RDX:  RSI: 110035bb5e3e RDI: 110035bb5e13
RBP: 8801addaf568 R08: 110035bb5dd5 R09: 0001
R10: 0001 R11:  R12: 110035bb5e94
R13: ffef R14: 8801d39ae348 R15: 110035bb5e98
FS:  01db2880() GS:8801db00() knlGS:
 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:315
 invalid_op+0x1b/0x40 arch/x86/entry/entry_64.S:991
RIP: 0010:kobject_add_internal+0x8d4/0xbc0 lib/kobject.c:235
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 019657b0 CR3: 0001ae0ca000 CR4: 001406f0
RSP: 0018:8801ade37470 EFLAGS: 00010282
DR0:  DR1:  DR2: 
DR3:  DR6: fffe0ff0 DR7: 0400
RAX: dc08 RBX: 8801d9459190