syzbot


BUG: spinlock bad magic in lock_sock_nested

Status: auto-closed as invalid on 2021/12/27 15:41
Subsystems: bluetooth
[Documentation on labels]
Reported-by: syzbot+eb47d1a545390e9fd5bf@syzkaller.appspotmail.com
First crash: 1554d, last: 1190d
Discussions (1)
Title Replies (including bot) Last reply
BUG: spinlock bad magic in lock_sock_nested 0 (1) 2020/09/08 07:33
Similar bugs (7)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream BUG: spinlock bad magic in lock_sock_nested (2) bluetooth 1 1048d 1048d 0/28 auto-closed as invalid on 2022/04/18 01:34
linux-5.15 BUG: spinlock bad magic in release_metapage origin:upstream C 33 21h51m 77d 0/3 upstream: reported C repro on 2024/09/15 11:43
upstream BUG: spinlock bad magic in btrfs_stop_all_workers btrfs 5 165d 165d 26/28 fixed on 2024/07/31 03:12
upstream BUG: unable to handle kernel paging request in take_dentry_name_snapshot reiserfs overlayfs C error done 30 239d 731d 0/28 closed as dup on 2023/10/04 08:35
upstream BUG: spinlock bad magic in skb_queue_tail afs net 1 712d 708d 0/28 auto-obsoleted due to no activity on 2023/03/19 17:50
linux-6.1 BUG: spinlock bad magic in release_metapage 25 38d 58d 0/3 upstream: reported on 2024/10/04 04:01
upstream BUG: spinlock bad magic in release_metapage jfs C inconclusive 210 1d06h 82d 0/28 upstream: reported C repro on 2024/09/10 08:16

Sample crash report:
BUG: spinlock bad magic on CPU#0, kworker/0:6/9773
==================================================================
BUG: KASAN: slab-out-of-bounds in task_pid_nr include/linux/sched.h:1440 [inline]
BUG: KASAN: slab-out-of-bounds in spin_dump kernel/locking/spinlock_debug.c:65 [inline]
BUG: KASAN: slab-out-of-bounds in spin_bug.cold+0x95/0x9e kernel/locking/spinlock_debug.c:75
Read of size 4 at addr ffff8880812387c8 by task kworker/0:6/9773

CPU: 0 PID: 9773 Comm: kworker/0:6 Not tainted 5.14.0-rc1-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events l2cap_chan_timeout
Call Trace:
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:105
 print_address_description.constprop.0.cold+0x6c/0x309 mm/kasan/report.c:233
 __kasan_report mm/kasan/report.c:419 [inline]
 kasan_report.cold+0x83/0xdf mm/kasan/report.c:436
 task_pid_nr include/linux/sched.h:1440 [inline]
 spin_dump kernel/locking/spinlock_debug.c:65 [inline]
 spin_bug.cold+0x95/0x9e kernel/locking/spinlock_debug.c:75
 debug_spin_lock_before kernel/locking/spinlock_debug.c:83 [inline]
 do_raw_spin_lock+0x216/0x2b0 kernel/locking/spinlock_debug.c:112
 spin_lock_bh include/linux/spinlock.h:359 [inline]
 lock_sock_nested+0x40/0x120 net/core/sock.c:3162
 l2cap_sock_teardown_cb+0xa1/0x660 net/bluetooth/l2cap_sock.c:1528
 l2cap_chan_del+0xbc/0xa80 net/bluetooth/l2cap_core.c:622
 l2cap_chan_close+0x1b9/0xaf0 net/bluetooth/l2cap_core.c:825
 l2cap_chan_timeout+0x17e/0x2f0 net/bluetooth/l2cap_core.c:436
 process_one_work+0x98d/0x1630 kernel/workqueue.c:2276
 worker_thread+0x658/0x11f0 kernel/workqueue.c:2422
 kthread+0x3e5/0x4d0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Allocated by task 16745:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc mm/kasan/common.c:513 [inline]
 ____kasan_kmalloc mm/kasan/common.c:472 [inline]
 __kasan_kmalloc+0x9b/0xd0 mm/kasan/common.c:522
 kmalloc include/linux/slab.h:596 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 __register_sysctl_table+0x112/0x1090 fs/proc/proc_sysctl.c:1318
 __addrconf_sysctl_register+0x1db/0x3d0 net/ipv6/addrconf.c:6965
 addrconf_sysctl_register net/ipv6/addrconf.c:7012 [inline]
 addrconf_sysctl_register+0x139/0x1d0 net/ipv6/addrconf.c:7001
 ipv6_add_dev+0x936/0x1120 net/ipv6/addrconf.c:445
 addrconf_notify+0x872/0x2400 net/ipv6/addrconf.c:3491
 notifier_call_chain+0xb5/0x200 kernel/notifier.c:83
 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:2122
 call_netdevice_notifiers_extack net/core/dev.c:2134 [inline]
 call_netdevice_notifiers net/core/dev.c:2148 [inline]
 register_netdevice+0x106b/0x1500 net/core/dev.c:10362
 veth_newlink+0x58c/0xad0 drivers/net/veth.c:1547
 __rtnl_newlink+0x106e/0x1760 net/core/rtnetlink.c:3460
 rtnl_newlink+0x64/0xa0 net/core/rtnetlink.c:3508
 rtnetlink_rcv_msg+0x413/0xb80 net/core/rtnetlink.c:5574
 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2504
 netlink_unicast_kernel net/netlink/af_netlink.c:1314 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1340
 netlink_sendmsg+0x86d/0xdb0 net/netlink/af_netlink.c:1929
 sock_sendmsg_nosec net/socket.c:703 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:723
 __sys_sendto+0x21c/0x320 net/socket.c:2019
 __do_sys_sendto net/socket.c:2031 [inline]
 __se_sys_sendto net/socket.c:2027 [inline]
 __x64_sys_sendto+0xdd/0x1b0 net/socket.c:2027
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Last potentially related work creation:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_record_aux_stack+0xe5/0x110 mm/kasan/generic.c:348
 kvfree_call_rcu+0x74/0x990 kernel/rcu/tree.c:3594
 drop_sysctl_table+0x3c0/0x4e0 fs/proc/proc_sysctl.c:1647
 unregister_sysctl_table fs/proc/proc_sysctl.c:1685 [inline]
 unregister_sysctl_table+0xc2/0x190 fs/proc/proc_sysctl.c:1660
 __addrconf_sysctl_unregister net/ipv6/addrconf.c:6994 [inline]
 addrconf_sysctl_unregister+0xee/0x1c0 net/ipv6/addrconf.c:7022
 addrconf_ifdown.isra.0+0xf8f/0x15b0 net/ipv6/addrconf.c:3849
 addrconf_notify+0x606/0x2400 net/ipv6/addrconf.c:3631
 notifier_call_chain+0xb5/0x200 kernel/notifier.c:83
 call_netdevice_notifiers_info+0xb5/0x130 net/core/dev.c:2122
 call_netdevice_notifiers_extack net/core/dev.c:2134 [inline]
 call_netdevice_notifiers net/core/dev.c:2148 [inline]
 unregister_netdevice_many+0x951/0x1790 net/core/dev.c:11075
 unregister_netdevice_queue+0x2dd/0x3c0 net/core/dev.c:11009
 unregister_netdevice include/linux/netdevice.h:2969 [inline]
 ppp_release+0x216/0x240 drivers/net/ppp/ppp_generic.c:404
 __fput+0x288/0x920 fs/file_table.c:280
 task_work_run+0xdd/0x1a0 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:175 [inline]
 exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:209
 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline]
 syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:302
 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x44/0xae

The buggy address belongs to the object at ffff888081238000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 1992 bytes inside of
 2048-byte region [ffff888081238000, ffff888081238800)
The buggy address belongs to the page:
page:ffffea0002048e00 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff88808123d000 pfn:0x81238
head:ffffea0002048e00 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 ffffea0001f33408 ffffea0000891c08 ffff888010842000
raw: ffff88808123d000 0000000000080004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 8486, ts 189855522898, free_ts 0
 prep_new_page mm/page_alloc.c:2433 [inline]
 get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4166
 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5388
 alloc_pages+0x18c/0x2a0 mm/mempolicy.c:2244
 alloc_slab_page mm/slub.c:1688 [inline]
 allocate_slab+0x32e/0x4b0 mm/slub.c:1828
 new_slab mm/slub.c:1891 [inline]
 new_slab_objects mm/slub.c:2637 [inline]
 ___slab_alloc+0x4ba/0x820 mm/slub.c:2800
 __slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2840
 slab_alloc_node mm/slub.c:2922 [inline]
 __kmalloc_node_track_caller+0x2e3/0x360 mm/slub.c:4648
 kmalloc_reserve net/core/skbuff.c:355 [inline]
 pskb_expand_head+0x15e/0x1060 net/core/skbuff.c:1685
 netlink_trim+0x1ea/0x240 net/netlink/af_netlink.c:1296
 netlink_broadcast_filtered+0x65/0xdc0 net/netlink/af_netlink.c:1501
 netlink_broadcast net/netlink/af_netlink.c:1546 [inline]
 nlmsg_multicast include/net/netlink.h:1033 [inline]
 nlmsg_notify+0x90/0x250 net/netlink/af_netlink.c:2547
 rtnl_notify net/core/rtnetlink.c:741 [inline]
 rtmsg_ifinfo_send net/core/rtnetlink.c:3835 [inline]
 rtmsg_ifinfo_event net/core/rtnetlink.c:3850 [inline]
 rtmsg_ifinfo_event net/core/rtnetlink.c:3838 [inline]
 rtmsg_ifinfo+0xf0/0x120 net/core/rtnetlink.c:3856
 __dev_notify_flags+0x226/0x2b0 net/core/dev.c:8844
 dev_change_flags+0x112/0x170 net/core/dev.c:8886
 do_setlink+0x90a/0x3900 net/core/rtnetlink.c:2721
 __rtnl_newlink+0xddb/0x1760 net/core/rtnetlink.c:3393
page_owner free stack trace missing

Memory state around the buggy address:
 ffff888081238680: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc
 ffff888081238700: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff888081238780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                                              ^
 ffff888081238800: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888081238880: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (26):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/07/18 16:48 upstream 1d67c8d993ba f115ae98 .config console log report info ci-upstream-kasan-gce-root BUG: spinlock bad magic in lock_sock_nested
2021/05/25 17:46 upstream a050a6d2b7e8 93d3a9f6 .config console log report info ci-upstream-kasan-gce-smack-root BUG: spinlock bad magic in lock_sock_nested
2021/02/17 20:10 upstream f40ddce88593 14052202 .config console log report info ci-upstream-kasan-gce-root BUG: spinlock bad magic in lock_sock_nested
2021/04/29 06:27 net-old bbd6f0a94813 77e2b668 .config console log report info ci-upstream-net-this-kasan-gce BUG: spinlock bad magic in lock_sock_nested
2021/03/06 14:46 net-old a4dcfbc4ee22 e4b4d570 .config console log report info ci-upstream-net-this-kasan-gce BUG: spinlock bad magic in lock_sock_nested
2021/03/01 20:50 net-old 447621e373bd 183afb6c .config console log report info ci-upstream-net-this-kasan-gce BUG: spinlock bad magic in lock_sock_nested
2021/02/26 10:15 net-old 2c87f7a38f93 76f7fc95 .config console log report info ci-upstream-net-this-kasan-gce BUG: spinlock bad magic in lock_sock_nested
2021/08/29 15:40 net-next-old eaf2aaec0be4 be2c130d .config console log report info ci-upstream-net-kasan-gce BUG: spinlock bad magic in lock_sock_nested
2021/04/27 21:19 net-next-old 95aafe911db6 805b5003 .config console log report info ci-upstream-net-kasan-gce BUG: spinlock bad magic in lock_sock_nested
2021/02/12 11:51 net-next-old 3c5a2fd042d0 a5f86b15 .config console log report info ci-upstream-net-kasan-gce BUG: spinlock bad magic in lock_sock_nested
2021/02/04 03:42 net-next-old 32d1bbb1d609 624dad51 .config console log report info ci-upstream-net-kasan-gce BUG: spinlock bad magic in lock_sock_nested
2021/01/28 15:40 net-next-old d1f3bdd4eaae 7df34f59 .config console log report info ci-upstream-net-kasan-gce BUG: spinlock bad magic in lock_sock_nested
2021/01/17 01:05 upstream 0da0a8a0a0e1 65a7a854 .config console log report info ci-upstream-kasan-gce-root
2020/12/01 13:34 upstream b65054597872 07bfe8a5 .config console log report info ci-upstream-kasan-gce-root
2020/11/29 13:58 upstream aae5ab854e38 a0092f9d .config console log report info ci-upstream-kasan-gce-selinux-root
2021/01/15 22:03 net-old 146620506274 65a7a854 .config console log report info ci-upstream-net-this-kasan-gce
2020/12/08 17:27 net-old 819f56bad110 a7f7f4a4 .config console log report info ci-upstream-net-this-kasan-gce
2020/11/19 16:29 net-old 6d9c8d15af0e 0767f13f .config console log report info ci-upstream-net-this-kasan-gce
2020/11/12 21:38 net-old 52755b66ddce 77a55c8e .config console log report info ci-upstream-net-this-kasan-gce
2020/11/08 08:15 net-old 4e0396c59559 64069d48 .config console log report info ci-upstream-net-this-kasan-gce
2021/01/13 19:11 net-next-old f50e2f9f7916 a945f0a3 .config console log report info ci-upstream-net-kasan-gce
2021/01/11 09:04 net-next-old 73b7a6047971 2c1f2513 .config console log report info ci-upstream-net-kasan-gce
2021/01/10 15:51 net-next-old 73b7a6047971 2c1f2513 .config console log report info ci-upstream-net-kasan-gce
2020/12/09 21:32 net-next-old afae3cc2da10 c090b4da .config console log report info ci-upstream-net-kasan-gce
2020/11/08 23:02 net-next-old bff6f1db91e3 64069d48 .config console log report info ci-upstream-net-kasan-gce
2020/08/29 18:44 net-next-old 0f091e43310f d5a3ae1f .config console log report ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.