linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* WARNING: refcount bug in kobject_add_internal
@ 2019-07-01 19:47 syzbot
  2019-07-01 23:27 ` syzbot
  2020-04-16  6:25 ` syzbot
  0 siblings, 2 replies; 5+ messages in thread
From: syzbot @ 2019-07-01 19:47 UTC (permalink / raw)
  To: gregkh, linux-kernel, rafael, syzkaller-bugs

Hello,

syzbot found the following crash on:

HEAD commit:    6fbc7275 Linux 5.2-rc7
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=120e0fc5a00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=bff6583efcfaed3f
dashboard link: https://syzkaller.appspot.com/bug?extid=32259bb9bc1a487ad206
compiler:       clang version 9.0.0 (/home/glider/llvm/clang  
80fee25776c2fb61e74c1ecb1a523375c2500b69)
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=115bad39a00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1241bdd5a00000

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

------------[ cut here ]------------
refcount_t: increment on 0; use-after-free.
WARNING: CPU: 1 PID: 8294 at lib/refcount.c:156  
refcount_inc_checked+0x4b/0x50 lib/refcount.c:156
Kernel panic - not syncing: panic_on_warn set ...
CPU: 1 PID: 8294 Comm: syz-executor086 Not tainted 5.2.0-rc7 #12
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:refcount_inc_checked+0x4b/0x50 lib/refcount.c:156
Code: 3d a7 68 7a 05 01 75 08 e8 42 47 16 fe 5b 5d c3 e8 3a 47 16 fe c6 05  
91 68 7a 05 01 48 c7 c7 c1 4d 66 88 31 c0 e8 25 19 e8 fd <0f> 0b eb df 90  
55 48 89 e5 41 57 41 56 41 55 41 54 53 48 83 e4 e0
RSP: 0018:ffff88809fa9f7f0 EFLAGS: 00010246
RAX: 5c3359f64ee59e00 RBX: ffff88821ae62bf8 RCX: ffff88808682c6c0
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: ffff88809fa9f7f8 R08: ffffffff815e87d4 R09: ffffed1015d66063
R10: ffffed1015d66063 R11: 1ffff11015d66062 R12: ffff88809ec74480
R13: 1ffff11013d8e890 R14: dffffc0000000000 R15: ffff88821ae62bf8
  kref_get include/linux/kref.h:45 [inline]
  kobject_get lib/kobject.c:642 [inline]
  kset_get include/linux/kobject.h:214 [inline]
  kobj_kset_join lib/kobject.c:194 [inline]
  kobject_add_internal+0x8c4/0xd50 lib/kobject.c:246
  kobject_add_varg lib/kobject.c:390 [inline]
  kobject_add+0x138/0x200 lib/kobject.c:442
  class_dir_create_and_add drivers/base/core.c:1732 [inline]
  get_device_parent+0x48b/0x4e0 drivers/base/core.c:1787
  device_add+0x3d6/0x1570 drivers/base/core.c:2048
  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:0x441289
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:00007ffe62540878 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000441289
RDX: 0000000000000002 RSI: 0000000020000000 RDI: 0000000000000003
RBP: 000000000000e96e R08: 00000000004002c8 R09: 00000000004002c8
R10: 0000000000000004 R11: 0000000000000246 R12: 0000000000402000
R13: 0000000000402090 R14: 0000000000000000 R15: 0000000000000000
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.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

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

* Re: WARNING: refcount bug in kobject_add_internal
  2019-07-01 19:47 WARNING: refcount bug in kobject_add_internal syzbot
@ 2019-07-01 23:27 ` syzbot
  2019-07-02  2:44   ` Benjamin Herrenschmidt
  2020-04-16  6:25 ` syzbot
  1 sibling, 1 reply; 5+ messages in thread
From: syzbot @ 2019-07-01 23:27 UTC (permalink / raw)
  To: benh, gregkh, linux-kernel, rafael, syzkaller-bugs, torvalds

syzbot has bisected this bug to:

commit 726e41097920a73e4c7c33385dcc0debb1281e18
Author: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date:   Tue Jul 10 00:29:10 2018 +0000

     drivers: core: Remove glue dirs from sysfs earlier

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=140d6739a00000
start commit:   6fbc7275 Linux 5.2-rc7
git tree:       upstream
final crash:    https://syzkaller.appspot.com/x/report.txt?x=160d6739a00000
console output: https://syzkaller.appspot.com/x/log.txt?x=120d6739a00000
kernel config:  https://syzkaller.appspot.com/x/.config?x=bff6583efcfaed3f
dashboard link: https://syzkaller.appspot.com/bug?extid=32259bb9bc1a487ad206
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=115bad39a00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1241bdd5a00000

Reported-by: syzbot+32259bb9bc1a487ad206@syzkaller.appspotmail.com
Fixes: 726e41097920 ("drivers: core: Remove glue dirs from sysfs earlier")

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

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

* Re: WARNING: refcount bug in kobject_add_internal
  2019-07-01 23:27 ` syzbot
@ 2019-07-02  2:44   ` Benjamin Herrenschmidt
  2019-07-02  3:07     ` Muchun Song
  0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Herrenschmidt @ 2019-07-02  2:44 UTC (permalink / raw)
  To: gregkh, linux-kernel, rafael, syzkaller-bugs, torvalds; +Cc: Muchun Song

Munchun, is this what your patch fixes ?


On Mon, 2019-07-01 at 16:27 -0700, syzbot wrote:
> syzbot has bisected this bug to:
> 
> commit 726e41097920a73e4c7c33385dcc0debb1281e18
> Author: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Date:   Tue Jul 10 00:29:10 2018 +0000
> 
>      drivers: core: Remove glue dirs from sysfs earlier
> 
> bisection log:  
> https://syzkaller.appspot.com/x/bisect.txt?x=140d6739a00000
> start commit:   6fbc7275 Linux 5.2-rc7
> git tree:       upstream
> final crash:    
> https://syzkaller.appspot.com/x/report.txt?x=160d6739a00000
> console output: 
> https://syzkaller.appspot.com/x/log.txt?x=120d6739a00000
> kernel config:  
> https://syzkaller.appspot.com/x/.config?x=bff6583efcfaed3f
> dashboard link: 
> https://syzkaller.appspot.com/bug?extid=32259bb9bc1a487ad206
> syz repro:      
> https://syzkaller.appspot.com/x/repro.syz?x=115bad39a00000
> C reproducer:   
> https://syzkaller.appspot.com/x/repro.c?x=1241bdd5a00000
> 
> Reported-by: syzbot+32259bb9bc1a487ad206@syzkaller.appspotmail.com
> Fixes: 726e41097920 ("drivers: core: Remove glue dirs from sysfs
> earlier")
> 
> For information about bisection process see: 
> https://goo.gl/tpsmEJ#bisection


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

* Re: WARNING: refcount bug in kobject_add_internal
  2019-07-02  2:44   ` Benjamin Herrenschmidt
@ 2019-07-02  3:07     ` Muchun Song
  0 siblings, 0 replies; 5+ messages in thread
From: Muchun Song @ 2019-07-02  3:07 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Greg Kroah-Hartman, linux-kernel, Rafael J. Wysocki,
	syzkaller-bugs, torvalds

Hi Ben,

Benjamin Herrenschmidt <benh@kernel.crashing.org> 于2019年7月2日周二 上午10:44写道:
>
> Munchun, is this what your patch fixes ?
>
 Yes, this is what my patch fixes.

The patchs can reference to:
        [PATCH v1 OPT1] driver core: Fix use-after-free and double
free on glue directory
        [PATCH v4 OPT2] driver core: Fix use-after-free and double
free on glue directory

And waiting for Greg chose which solution he prefered.

Yours,
Muchun

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

* Re: WARNING: refcount bug in kobject_add_internal
  2019-07-01 19:47 WARNING: refcount bug in kobject_add_internal syzbot
  2019-07-01 23:27 ` syzbot
@ 2020-04-16  6:25 ` syzbot
  1 sibling, 0 replies; 5+ messages in thread
From: syzbot @ 2020-04-16  6:25 UTC (permalink / raw)
  To: benh, gregkh, linux-kernel, longman, mingo, peterz, rafael,
	syzkaller-bugs, torvalds

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=1127249be00000
start commit:   6fbc7275 Linux 5.2-rc7
git tree:       upstream
kernel config:  https://syzkaller.appspot.com/x/.config?x=bff6583efcfaed3f
dashboard link: https://syzkaller.appspot.com/bug?extid=32259bb9bc1a487ad206
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=115bad39a00000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1241bdd5a00000

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] 5+ messages in thread

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-01 19:47 WARNING: refcount bug in kobject_add_internal syzbot
2019-07-01 23:27 ` syzbot
2019-07-02  2:44   ` Benjamin Herrenschmidt
2019-07-02  3:07     ` Muchun Song
2020-04-16  6:25 ` syzbot

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