syzbot


KASAN: use-after-free Read in l2cap_sock_kill

Status: auto-closed as invalid on 2021/02/19 19:34
Subsystems: bluetooth
[Documentation on labels]
First crash: 1250d, last: 1250d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in l2cap_sock_kill C inconclusive 59 1302d 1314d 0/1 upstream: reported C repro on 2020/09/18 18:43

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read include/linux/instrumented.h:71 [inline]
BUG: KASAN: use-after-free in test_bit include/asm-generic/bitops/instrumented-non-atomic.h:134 [inline]
BUG: KASAN: use-after-free in sock_flag include/net/sock.h:894 [inline]
BUG: KASAN: use-after-free in l2cap_sock_kill+0x1f/0x240 net/bluetooth/l2cap_sock.c:1210
Read of size 8 at addr ffff88805c874060 by task kworker/0:6/10964

CPU: 0 PID: 10964 Comm: kworker/0:6 Not tainted 5.10.0-rc4-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:77 [inline]
 dump_stack+0x107/0x163 lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x4c8 mm/kasan/report.c:385
 __kasan_report mm/kasan/report.c:545 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:562
 check_memory_region_inline mm/kasan/generic.c:186 [inline]
 check_memory_region+0x13d/0x180 mm/kasan/generic.c:192
 instrument_atomic_read include/linux/instrumented.h:71 [inline]
 test_bit include/asm-generic/bitops/instrumented-non-atomic.h:134 [inline]
 sock_flag include/net/sock.h:894 [inline]
 l2cap_sock_kill+0x1f/0x240 net/bluetooth/l2cap_sock.c:1210
 l2cap_chan_timeout+0x1cc/0x2f0 net/bluetooth/l2cap_core.c:438
 process_one_work+0x933/0x15a0 kernel/workqueue.c:2272
 worker_thread+0x64c/0x1120 kernel/workqueue.c:2418
 kthread+0x3af/0x4a0 kernel/kthread.c:292
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296

Allocated by task 18212:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:461
 kmalloc include/linux/slab.h:557 [inline]
 sk_prot_alloc+0x17a/0x300 net/core/sock.c:1666
 sk_alloc+0x32/0xbd0 net/core/sock.c:1720
 l2cap_sock_alloc.constprop.0+0x31/0x230 net/bluetooth/l2cap_sock.c:1805
 l2cap_sock_create+0x123/0x1f0 net/bluetooth/l2cap_sock.c:1851
 bt_sock_create+0x17c/0x340 net/bluetooth/af_bluetooth.c:130
 __sock_create+0x3de/0x780 net/socket.c:1404
 sock_create net/socket.c:1455 [inline]
 __sys_socket+0xef/0x200 net/socket.c:1497
 __do_sys_socket net/socket.c:1506 [inline]
 __se_sys_socket net/socket.c:1504 [inline]
 __x64_sys_socket+0x6f/0xb0 net/socket.c:1504
 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 18211:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:56
 kasan_set_free_info+0x1b/0x30 mm/kasan/generic.c:355
 __kasan_slab_free+0x102/0x140 mm/kasan/common.c:422
 slab_free_hook mm/slub.c:1544 [inline]
 slab_free_freelist_hook+0x5d/0x150 mm/slub.c:1577
 slab_free mm/slub.c:3142 [inline]
 kfree+0xdb/0x360 mm/slub.c:4124
 sk_prot_free net/core/sock.c:1703 [inline]
 __sk_destruct+0x6c0/0x8f0 net/core/sock.c:1788
 sk_destruct+0xbd/0xe0 net/core/sock.c:1803
 __sk_free+0xef/0x3d0 net/core/sock.c:1814
 sk_free+0x78/0xa0 net/core/sock.c:1825
 sock_put include/net/sock.h:1792 [inline]
 l2cap_sock_kill+0x203/0x240 net/bluetooth/l2cap_sock.c:1219
 l2cap_sock_release+0x184/0x200 net/bluetooth/l2cap_sock.c:1389
 __sock_release+0xcd/0x280 net/socket.c:595
 sock_close+0x18/0x20 net/socket.c:1254
 __fput+0x285/0x920 fs/file_table.c:281
 task_work_run+0xdd/0x190 kernel/task_work.c:151
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:164 [inline]
 exit_to_user_mode_prepare+0x17e/0x1a0 kernel/entry/common.c:191
 syscall_exit_to_user_mode+0x38/0x260 kernel/entry/common.c:266
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Last call_rcu():
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_record_aux_stack+0xc0/0xf0 mm/kasan/generic.c:346
 __call_rcu kernel/rcu/tree.c:2953 [inline]
 call_rcu+0xbb/0x700 kernel/rcu/tree.c:3027
 netlink_release+0xd43/0x1cf0 net/netlink/af_netlink.c:802
 __sock_release net/socket.c:595 [inline]
 sock_release+0x87/0x1b0 net/socket.c:623
 netlink_kernel_release+0x4b/0x60 net/netlink/af_netlink.c:2107
 uevent_net_exit+0xbd/0x290 lib/kobject_uevent.c:798
 ops_exit_list+0xb0/0x160 net/core/net_namespace.c:187
 cleanup_net+0x4ea/0xa00 net/core/net_namespace.c:604
 process_one_work+0x933/0x15a0 kernel/workqueue.c:2272
 worker_thread+0x64c/0x1120 kernel/workqueue.c:2418
 kthread+0x3af/0x4a0 kernel/kthread.c:292
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296

The buggy address belongs to the object at ffff88805c874000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 96 bytes inside of
 2048-byte region [ffff88805c874000, ffff88805c874800)
The buggy address belongs to the page:
page:000000005aa7609b refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5c870
head:000000005aa7609b order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head)
raw: 00fff00000010200 0000000000000000 0000000100000001 ffff888010042000
raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88805c873f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88805c873f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88805c874000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff88805c874080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88805c874100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/11/21 19:26 net-next-old c900378316d3 68068804 .config console log report info ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.