syzbot


KASAN: use-after-free Read in prepare_to_wait_event (2)

Status: auto-closed as invalid on 2020/10/17 06:03
Subsystems: rdma
[Documentation on labels]
Reported-by: syzbot+719b61b6742dad330b17@syzkaller.appspotmail.com
First crash: 1377d, last: 1377d
Similar bugs (1)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in prepare_to_wait_event usb C 2 1716d 1721d 0/26 closed as dup on 2019/08/12 12:05

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __lock_acquire+0x3c7b/0x56e0 kernel/locking/lockdep.c:4250
Read of size 8 at addr ffff8880a30b12c8 by task syz-executor.1/29002

CPU: 1 PID: 29002 Comm: syz-executor.1 Not tainted 5.8.0-rc5-syzkaller #0
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+0x18f/0x20d lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x436 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
 __lock_acquire+0x3c7b/0x56e0 kernel/locking/lockdep.c:4250
 lock_acquire+0x1f1/0xad0 kernel/locking/lockdep.c:4959
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0x8c/0xc0 kernel/locking/spinlock.c:159
 prepare_to_wait_event+0x5b/0x650 kernel/sched/wait.c:280
 iw_cm_disconnect+0x295/0x320 drivers/infiniband/core/iwcm.c:316
 rdma_disconnect+0x12a/0xab0 drivers/infiniband/core/cma.c:4307
 p9_cm_event_handler+0x17c/0x2f0 net/9p/trans_rdma.c:280
 cma_cm_event_handler+0xa9/0x610 drivers/infiniband/core/cma.c:1929
 cma_remove_id_dev drivers/infiniband/core/cma.c:4811 [inline]
 cma_process_remove drivers/infiniband/core/cma.c:4832 [inline]
 cma_remove_one+0x782/0xbf0 drivers/infiniband/core/cma.c:4855
 remove_client_context+0xbe/0x110 drivers/infiniband/core/device.c:736
 disable_device+0x13b/0x270 drivers/infiniband/core/device.c:1282
 __ib_unregister_device+0x91/0x190 drivers/infiniband/core/device.c:1450
 ib_unregister_device_and_put+0x57/0x80 drivers/infiniband/core/device.c:1514
 nldev_dellink+0x209/0x310 drivers/infiniband/core/nldev.c:1571
 rdma_nl_rcv_msg+0x34a/0x5b0 drivers/infiniband/core/netlink.c:195
 rdma_nl_rcv_skb drivers/infiniband/core/netlink.c:239 [inline]
 rdma_nl_rcv+0x31a/0x470 drivers/infiniband/core/netlink.c:259
 netlink_unicast_kernel net/netlink/af_netlink.c:1303 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1329
 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1918
 sock_sendmsg_nosec net/socket.c:652 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:672
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2352
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2406
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2439
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x45c1d9
Code: Bad RIP value.
RSP: 002b:00007fc297ab7c78 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000029840 RCX: 000000000045c1d9
RDX: 0000000000000000 RSI: 0000000020002b40 RDI: 0000000000000003
RBP: 000000000078bf40 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000078bf0c
R13: 00007ffc28e3de2f R14: 00007fc297ab89c0 R15: 000000000078bf0c

Allocated by task 28994:
 save_stack+0x1b/0x40 mm/kasan/common.c:48
 set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:494
 kmem_cache_alloc_trace+0x14f/0x2d0 mm/slab.c:3551
 kmalloc include/linux/slab.h:555 [inline]
 kzalloc include/linux/slab.h:669 [inline]
 iw_create_cm_id+0x52/0x3a0 drivers/infiniband/core/iwcm.c:248
 cma_connect_iw drivers/infiniband/core/cma.c:3996 [inline]
 rdma_connect+0x46f/0x1ec0 drivers/infiniband/core/cma.c:4052
 rdma_create_trans+0xefc/0x13e0 net/9p/trans_rdma.c:722
 p9_client_create+0x81a/0x10c0 net/9p/client.c:1039
 v9fs_session_init+0x1dd/0x1770 fs/9p/v9fs.c:406
 v9fs_mount+0x79/0x970 fs/9p/vfs_super.c:124
 legacy_get_tree+0x105/0x220 fs/fs_context.c:592
 vfs_get_tree+0x89/0x2f0 fs/super.c:1547
 do_new_mount fs/namespace.c:2875 [inline]
 do_mount+0x1592/0x1fe0 fs/namespace.c:3200
 __do_sys_mount fs/namespace.c:3410 [inline]
 __se_sys_mount fs/namespace.c:3387 [inline]
 __x64_sys_mount+0x18f/0x230 fs/namespace.c:3387
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 28994:
 save_stack+0x1b/0x40 mm/kasan/common.c:48
 set_track mm/kasan/common.c:56 [inline]
 kasan_set_free_info mm/kasan/common.c:316 [inline]
 __kasan_slab_free+0xf5/0x140 mm/kasan/common.c:455
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x103/0x2c0 mm/slab.c:3757
 free_cm_id drivers/infiniband/core/iwcm.c:205 [inline]
 iwcm_deref_id+0xd4/0x120 drivers/infiniband/core/iwcm.c:217
 destroy_cm_id+0x266/0x520 drivers/infiniband/core/iwcm.c:444
 cma_connect_iw drivers/infiniband/core/cma.c:4026 [inline]
 rdma_connect+0xf22/0x1ec0 drivers/infiniband/core/cma.c:4052
 rdma_create_trans+0xefc/0x13e0 net/9p/trans_rdma.c:722
 p9_client_create+0x81a/0x10c0 net/9p/client.c:1039
 v9fs_session_init+0x1dd/0x1770 fs/9p/v9fs.c:406
 v9fs_mount+0x79/0x970 fs/9p/vfs_super.c:124
 legacy_get_tree+0x105/0x220 fs/fs_context.c:592
 vfs_get_tree+0x89/0x2f0 fs/super.c:1547
 do_new_mount fs/namespace.c:2875 [inline]
 do_mount+0x1592/0x1fe0 fs/namespace.c:3200
 __do_sys_mount fs/namespace.c:3410 [inline]
 __se_sys_mount fs/namespace.c:3387 [inline]
 __x64_sys_mount+0x18f/0x230 fs/namespace.c:3387
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff8880a30b1000
 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 712 bytes inside of
 1024-byte region [ffff8880a30b1000, ffff8880a30b1400)
The buggy address belongs to the page:
page:ffffea00028c2c40 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea00027a5408 ffffea00029a1f08 ffff8880aa000c40
raw: 0000000000000000 ffff8880a30b1000 0000000100000002 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a30b1180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a30b1200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880a30b1280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                              ^
 ffff8880a30b1300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a30b1380: 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/07/19 06:02 upstream f932d58abc38 9c812472 .config console log report ci-upstream-kasan-gce-root
* Struck through repros no longer work on HEAD.