linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* WARNING in kernfs_create_dir_ns
@ 2019-06-29 13:12 syzbot
  2019-06-30  5:41 ` syzbot
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: syzbot @ 2019-06-29 13:12 UTC (permalink / raw)
  To: gregkh, linux-kernel, syzkaller-bugs, tj

Hello,

syzbot found the following crash on:

HEAD commit:    4b972a01 Linux 5.2-rc6
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=14910879a00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=9a31528e58cc12e2
dashboard link: https://syzkaller.appspot.com/bug?extid=38f5d5cf7ae88c46b11a
compiler:       clang version 9.0.0 (/home/glider/llvm/clang  
80fee25776c2fb61e74c1ecb1a523375c2500b69)

Unfortunately, I don't have any reproducer for this crash yet.

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+38f5d5cf7ae88c46b11a@syzkaller.appspotmail.com

WARNING: CPU: 0 PID: 9071 at fs/kernfs/dir.c:493 kernfs_get  
fs/kernfs/dir.c:493 [inline]
WARNING: CPU: 0 PID: 9071 at fs/kernfs/dir.c:493 kernfs_new_node  
fs/kernfs/dir.c:700 [inline]
WARNING: CPU: 0 PID: 9071 at fs/kernfs/dir.c:493  
kernfs_create_dir_ns+0x205/0x230 fs/kernfs/dir.c:1022
Kernel panic - not syncing: panic_on_warn set ...
CPU: 0 PID: 9071 Comm: syz-executor.1 Not tainted 5.2.0-rc6 #6
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0x1d8/0x2f8 lib/dump_stack.c:113
  panic+0x28a/0x7c9 kernel/panic.c:219
  __warn+0x216/0x220 kernel/panic.c:576
  report_bug+0x190/0x290 lib/bug.c:186
  fixup_bug arch/x86/kernel/traps.c:179 [inline]
  do_error_trap+0xd7/0x450 arch/x86/kernel/traps.c:272
  do_invalid_op+0x36/0x40 arch/x86/kernel/traps.c:291
  invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:986
RIP: 0010:kernfs_get fs/kernfs/dir.c:493 [inline]
RIP: 0010:kernfs_new_node fs/kernfs/dir.c:700 [inline]
RIP: 0010:kernfs_create_dir_ns+0x205/0x230 fs/kernfs/dir.c:1022
Code: ff 4c 89 ff e8 7c cd ff ff 4c 63 fb eb 05 e8 e2 27 9a ff 4c 89 f8 48  
83 c4 10 5b 41 5c 41 5d 41 5e 41 5f 5d c3 e8 cb 27 9a ff <0f> 0b e9 e9 fe  
ff ff 89 d9 80 e1 07 80 c1 03 38 c1 0f 8c be fe ff
RSP: 0018:ffff88805a66f590 EFLAGS: 00010287
RAX: ffffffff81db8a25 RBX: ffff88808fad88c0 RCX: 0000000000040000
RDX: ffffc90007ff6000 RSI: 000000000001e1a2 RDI: 000000000001e1a3
RBP: ffff88805a66f5c8 R08: ffffffff81db8907 R09: ffffed1011f5b119
R10: ffffed1011f5b119 R11: 1ffff11011f5b118 R12: ffff888098366600
R13: dffffc0000000000 R14: 0000000000000000 R15: ffff8880a8f66620
  sysfs_create_dir_ns+0x161/0x300 fs/sysfs/dir.c:59
  create_dir lib/kobject.c:89 [inline]
  kobject_add_internal+0x459/0xd50 lib/kobject.c:255
  kobject_add_varg lib/kobject.c:390 [inline]
  kobject_add+0x138/0x200 lib/kobject.c:442
  device_add+0x508/0x1570 drivers/base/core.c:2062
  hci_register_dev+0x331/0x6c0 net/bluetooth/hci_core.c:3305
  hci_uart_register_dev drivers/bluetooth/hci_ldisc.c:661 [inline]
  hci_uart_set_proto drivers/bluetooth/hci_ldisc.c:685 [inline]
  hci_uart_tty_ioctl+0x815/0x970 drivers/bluetooth/hci_ldisc.c:739
  tty_ioctl+0xf66/0x15d0 drivers/tty/tty_io.c:2664
  do_vfs_ioctl+0x7d4/0x1890 fs/ioctl.c:46
  ksys_ioctl fs/ioctl.c:713 [inline]
  __do_sys_ioctl fs/ioctl.c:720 [inline]
  __se_sys_ioctl fs/ioctl.c:718 [inline]
  __x64_sys_ioctl+0xe3/0x120 fs/ioctl.c:718
  do_syscall_64+0xfe/0x140 arch/x86/entry/common.c:301
  entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459519
Code: fd b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7  
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff  
ff 0f 83 cb b7 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fb578425c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000459519
RDX: 0000000000000009 RSI: 00000000400455c8 RDI: 0000000000000003
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007fb5784266d4
R13: 00000000004c21a5 R14: 00000000004d5330 R15: 00000000ffffffff
Kernel Offset: disabled
Rebooting in 86400 seconds..


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

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

* Re: WARNING in kernfs_create_dir_ns
  2019-06-29 13:12 WARNING in kernfs_create_dir_ns syzbot
@ 2019-06-30  5:41 ` syzbot
  2019-07-08 14:46   ` Tejun Heo
  2019-06-30 10:40 ` syzbot
  2020-04-16  0:11 ` syzbot
  2 siblings, 1 reply; 7+ messages in thread
From: syzbot @ 2019-06-30  5:41 UTC (permalink / raw)
  To: gregkh, linux-kernel, syzkaller-bugs, tj

syzbot has found a reproducer for the following crash on:

HEAD commit:    72825454 Merge branch 'x86-urgent-for-linus' of git://git...
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=104d6755a00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=9a31528e58cc12e2
dashboard link: https://syzkaller.appspot.com/bug?extid=38f5d5cf7ae88c46b11a
compiler:       clang version 9.0.0 (/home/glider/llvm/clang  
80fee25776c2fb61e74c1ecb1a523375c2500b69)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=12a6c439a00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1353c323a00000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+38f5d5cf7ae88c46b11a@syzkaller.appspotmail.com

WARNING: CPU: 0 PID: 8613 at fs/kernfs/dir.c:493 kernfs_get  
fs/kernfs/dir.c:493 [inline]
WARNING: CPU: 0 PID: 8613 at fs/kernfs/dir.c:493 kernfs_new_node  
fs/kernfs/dir.c:700 [inline]
WARNING: CPU: 0 PID: 8613 at fs/kernfs/dir.c:493  
kernfs_create_dir_ns+0x205/0x230 fs/kernfs/dir.c:1022
Kernel panic - not syncing: panic_on_warn set ...
CPU: 0 PID: 8613 Comm: syz-executor696 Not tainted 5.2.0-rc6+ #11
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011
Call Trace:
  __dump_stack lib/dump_stack.c:77 [inline]
  dump_stack+0x1d8/0x2f8 lib/dump_stack.c:113
  panic+0x28a/0x7c9 kernel/panic.c:219
  __warn+0x216/0x220 kernel/panic.c:576
  report_bug+0x190/0x290 lib/bug.c:186
  fixup_bug arch/x86/kernel/traps.c:179 [inline]
  do_error_trap+0xd7/0x450 arch/x86/kernel/traps.c:272
  do_invalid_op+0x36/0x40 arch/x86/kernel/traps.c:291
  invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:986
RIP: 0010:kernfs_get fs/kernfs/dir.c:493 [inline]
RIP: 0010:kernfs_new_node fs/kernfs/dir.c:700 [inline]
RIP: 0010:kernfs_create_dir_ns+0x205/0x230 fs/kernfs/dir.c:1022
Code: ff 4c 89 ff e8 7c cd ff ff 4c 63 fb eb 05 e8 22 27 9a ff 4c 89 f8 48  
83 c4 10 5b 41 5c 41 5d 41 5e 41 5f 5d c3 e8 0b 27 9a ff <0f> 0b e9 e9 fe  
ff ff 89 d9 80 e1 07 80 c1 03 38 c1 0f 8c be fe ff
RSP: 0018:ffff88808d26f730 EFLAGS: 00010293
RAX: ffffffff81db8a95 RBX: ffff88809e5252a0 RCX: ffff88808a4aa000
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
RBP: ffff88808d26f768 R08: ffffffff81db8977 R09: ffffed1013ca4a55
R10: ffffed1013ca4a55 R11: 1ffff11013ca4a54 R12: ffff888098a8a200
R13: dffffc0000000000 R14: 0000000000000000 R15: ffff8880a339e620
  sysfs_create_dir_ns+0x161/0x300 fs/sysfs/dir.c:59
  create_dir lib/kobject.c:89 [inline]
  kobject_add_internal+0x459/0xd50 lib/kobject.c:255
  kobject_add_varg lib/kobject.c:390 [inline]
  kobject_add+0x138/0x200 lib/kobject.c:442
  device_add+0x508/0x1570 drivers/base/core.c:2062
  hci_register_dev+0x331/0x6c0 net/bluetooth/hci_core.c:3305
  __vhci_create_device drivers/bluetooth/hci_vhci.c:124 [inline]
  vhci_create_device+0x2d1/0x510 drivers/bluetooth/hci_vhci.c:148
  vhci_get_user drivers/bluetooth/hci_vhci.c:204 [inline]
  vhci_write+0x3ac/0x440 drivers/bluetooth/hci_vhci.c:284
  call_write_iter include/linux/fs.h:1872 [inline]
  new_sync_write fs/read_write.c:483 [inline]
  __vfs_write+0x617/0x7d0 fs/read_write.c:496
  vfs_write+0x227/0x510 fs/read_write.c:558
  ksys_write+0x16b/0x2a0 fs/read_write.c:611
  __do_sys_write fs/read_write.c:623 [inline]
  __se_sys_write fs/read_write.c:620 [inline]
  __x64_sys_write+0x7b/0x90 fs/read_write.c:620
  do_syscall_64+0xfe/0x140 arch/x86/entry/common.c:301
  entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x441279
Code: e8 ac e8 ff ff 48 83 c4 18 c3 0f 1f 80 00 00 00 00 48 89 f8 48 89 f7  
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff  
ff 0f 83 eb 08 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fffa3738588 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000441279
RDX: 0000000000000002 RSI: 0000000020000000 RDI: 0000000000000003
RBP: 000000000000ef5c R08: 00000000004002c8 R09: 00000000004002c8
R10: 0000000000000004 R11: 0000000000000246 R12: 0000000000401ff0
R13: 0000000000402080 R14: 0000000000000000 R15: 0000000000000000
Kernel Offset: disabled
Rebooting in 86400 seconds..


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

* Re: WARNING in kernfs_create_dir_ns
  2019-06-29 13:12 WARNING in kernfs_create_dir_ns syzbot
  2019-06-30  5:41 ` syzbot
@ 2019-06-30 10:40 ` syzbot
  2020-04-16  0:11 ` syzbot
  2 siblings, 0 replies; 7+ messages in thread
From: syzbot @ 2019-06-30 10:40 UTC (permalink / raw)
  To: a, b.a.t.m.a.n, davem, gregkh, hongjiefang, linux-kernel,
	linux-mmc, mareklindner, netdev, sw, syzkaller-bugs, tj,
	ulf.hansson

syzbot has bisected this bug to:

commit 7f38abf220e2c800a2c451372e9f07ed5fd0ea49
Author: Hongjie Fang <hongjiefang@asrmicro.com>
Date:   Tue Jul 31 02:55:09 2018 +0000

     mmc: core: improve reasonableness of bus width setting for HS400es

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=129d6755a00000
start commit:   72825454 Merge branch 'x86-urgent-for-linus' of git://git...
git tree:       upstream
final crash:    https://syzkaller.appspot.com/x/report.txt?x=119d6755a00000
console output: https://syzkaller.appspot.com/x/log.txt?x=169d6755a00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=9a31528e58cc12e2
dashboard link: https://syzkaller.appspot.com/bug?extid=38f5d5cf7ae88c46b11a
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=12a6c439a00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1353c323a00000

Reported-by: syzbot+38f5d5cf7ae88c46b11a@syzkaller.appspotmail.com
Fixes: 7f38abf220e2 ("mmc: core: improve reasonableness of bus width  
setting for HS400es")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

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

* Re: WARNING in kernfs_create_dir_ns
  2019-06-30  5:41 ` syzbot
@ 2019-07-08 14:46   ` Tejun Heo
  0 siblings, 0 replies; 7+ messages in thread
From: Tejun Heo @ 2019-07-08 14:46 UTC (permalink / raw)
  To: Hillf Danton; +Cc: syzbot, gregkh, linux-kernel, syzkaller-bugs

Hello,

On Mon, Jul 01, 2019 at 01:52:35PM +0800, Hillf Danton wrote:
> >WARNING: CPU: 0 PID: 8613 at fs/kernfs/dir.c:493 kernfs_get  fs/kernfs/dir.c:493 [inline]
> >WARNING: CPU: 0 PID: 8613 at fs/kernfs/dir.c:493 kernfs_new_node  fs/kernfs/dir.c:700 [inline]
> >WARNING: CPU: 0 PID: 8613 at fs/kernfs/dir.c:493 kernfs_create_dir_ns+0x205/0x230 fs/kernfs/dir.c:1022
...
> --- a/fs/sysfs/dir.c
> +++ b/fs/sysfs/dir.c
> @@ -53,6 +53,10 @@ int sysfs_create_dir_ns(struct kobject *kobj, const void *ns)
> 	if (!parent)
> 		return -ENOENT;
> 
> +	/* create dir if parent is not dying */
> +	if (!atomic_inc_not_zero(&parent->count))
> +		return -ENOENT;
> +
> 	kobject_get_ownership(kobj, &uid, &gid);
> 
> 	kn = kernfs_create_dir_ns(parent, kobject_name(kobj),
> @@ -61,10 +65,12 @@ int sysfs_create_dir_ns(struct kobject *kobj, const void *ns)
> 	if (IS_ERR(kn)) {
> 		if (PTR_ERR(kn) == -EEXIST)
> 			sysfs_warn_dup(parent, kobject_name(kobj));
> +		kernfs_put(parent);
> 		return PTR_ERR(kn);
> 	}
> 
> 	kobj->sd = kn;
> +	kernfs_put(parent);

I don't think this is the correct fix.  It's being called with kobj
whose parent's sysfs node is dangling.  It gotta be fixed from the
caller side.

Thanks.

-- 
tejun

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

* Re: WARNING in kernfs_create_dir_ns
  2019-06-29 13:12 WARNING in kernfs_create_dir_ns syzbot
  2019-06-30  5:41 ` syzbot
  2019-06-30 10:40 ` syzbot
@ 2020-04-16  0:11 ` syzbot
  2020-04-16  0:30   ` Waiman Long
  2 siblings, 1 reply; 7+ messages in thread
From: syzbot @ 2020-04-16  0:11 UTC (permalink / raw)
  To: a, b.a.t.m.a.n, davem, gregkh, hdanton, hongjiefang,
	linux-kernel, linux-mmc, longman, mareklindner, mingo, netdev,
	peterz, sw, syzkaller-bugs, tj, ulf.hansson

syzbot suspects this bug was fixed by commit:

commit 810507fe6fd5ff3de429121adff49523fabb643a
Author: Waiman Long <longman@redhat.com>
Date:   Thu Feb 6 15:24:08 2020 +0000

    locking/lockdep: Reuse freed chain_hlocks entries

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=1008138be00000
start commit:   72825454 Merge branch 'x86-urgent-for-linus' of git://git...
git tree:       upstream
kernel config:  https://syzkaller.appspot.com/x/.config?x=9a31528e58cc12e2
dashboard link: https://syzkaller.appspot.com/bug?extid=38f5d5cf7ae88c46b11a
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=12a6c439a00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1353c323a00000

If the result looks correct, please mark the bug fixed by replying with:

#syz fix: locking/lockdep: Reuse freed chain_hlocks entries

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

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

* Re: WARNING in kernfs_create_dir_ns
  2020-04-16  0:11 ` syzbot
@ 2020-04-16  0:30   ` Waiman Long
  0 siblings, 0 replies; 7+ messages in thread
From: Waiman Long @ 2020-04-16  0:30 UTC (permalink / raw)
  To: syzbot, a, b.a.t.m.a.n, davem, gregkh, hdanton, hongjiefang,
	linux-kernel, linux-mmc, mareklindner, mingo, netdev, peterz, sw,
	syzkaller-bugs, tj, ulf.hansson

#syz fix: locking/lockdep: Reuse freed chain_hlocks entries


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

* Re: WARNING in kernfs_create_dir_ns
       [not found] <20190709022335.12928-1-hdanton@sina.com>
@ 2019-07-09 14:22 ` Tejun Heo
  0 siblings, 0 replies; 7+ messages in thread
From: Tejun Heo @ 2019-07-09 14:22 UTC (permalink / raw)
  To: Hillf Danton; +Cc: syzbot, gregkh, linux-kernel, syzkaller-bugs

On Tue, Jul 09, 2019 at 10:23:35AM +0800, Hillf Danton wrote:
> > I don't think this is the correct fix.  It's being called with kobj
> > whose parent's sysfs node is dangling.  It gotta be fixed from the
> > caller side.
> >
> Make sense?
> 
> --- a/lib/kobject.c
> +++ b/lib/kobject.c

No, I meant that the problem likely is in the driver which is calling
into the generic layer with a dead parent.  We shouldn't be working
around that from generic layer.

Thanks.

-- 
tejun

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

end of thread, other threads:[~2020-04-16  0:30 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-29 13:12 WARNING in kernfs_create_dir_ns syzbot
2019-06-30  5:41 ` syzbot
2019-07-08 14:46   ` Tejun Heo
2019-06-30 10:40 ` syzbot
2020-04-16  0:11 ` syzbot
2020-04-16  0:30   ` Waiman Long
     [not found] <20190709022335.12928-1-hdanton@sina.com>
2019-07-09 14:22 ` Tejun Heo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).