syzbot


KASAN: use-after-free Read in cma_cancel_listens

Status: auto-closed as invalid on 2020/02/20 10:11
Subsystems: rdma
[Documentation on labels]
Reported-by: syzbot+57a3b121df74c4eccbc7@syzkaller.appspotmail.com
First crash: 1655d, last: 1655d
Discussions (2)
Title Replies (including bot) Last reply
Re: KASAN: use-after-free Read in cma_cancel_listens 1 (1) 2019/10/29 18:48
KASAN: use-after-free Read in cma_cancel_listens 0 (1) 2019/10/24 05:41

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __list_del_entry_valid+0x9c/0x100 lib/list_debug.c:54
Read of size 8 at addr ffff888097eda1e8 by task syz-executor.2/15086

CPU: 1 PID: 15086 Comm: syz-executor.2 Not tainted 5.4.0-rc4+ #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+0x1d8/0x2f8 lib/dump_stack.c:113
 print_address_description+0x75/0x5c0 mm/kasan/report.c:374
 __kasan_report+0x14b/0x1c0 mm/kasan/report.c:506
 kasan_report+0x26/0x50 mm/kasan/common.c:634
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132
 __list_del_entry_valid+0x9c/0x100 lib/list_debug.c:54
 __list_del_entry include/linux/list.h:131 [inline]
 list_del include/linux/list.h:139 [inline]
 cma_cancel_listens+0x40/0x390 drivers/infiniband/core/cma.c:1750
 cma_cancel_operation drivers/infiniband/core/cma.c:1778 [inline]
 rdma_destroy_id+0x44f/0x1080 drivers/infiniband/core/cma.c:1842
 ucma_close+0x1eb/0x2c0 drivers/infiniband/core/ucma.c:1762
 __fput+0x2e4/0x740 fs/file_table.c:280
 ____fput+0x15/0x20 fs/file_table.c:313
 task_work_run+0x17e/0x1b0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x5e8/0x2190 kernel/exit.c:817
 do_group_exit+0x15c/0x2b0 kernel/exit.c:921
 get_signal+0x4ac/0x1d60 kernel/signal.c:2734
 do_signal+0x37/0x640 arch/x86/kernel/signal.c:815
 exit_to_usermode_loop arch/x86/entry/common.c:159 [inline]
 prepare_exit_to_usermode+0x303/0x580 arch/x86/entry/common.c:194
 syscall_return_slowpath+0x113/0x4a0 arch/x86/entry/common.c:274
 do_syscall_64+0x11f/0x1c0 arch/x86/entry/common.c:300
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459ef9
Code: ad b6 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 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007faedb0c5cf8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 000000000075bf28 RCX: 0000000000459ef9
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 000000000075bf28
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000075bf2c
R13: 00007ffe74d4703f R14: 00007faedb0c69c0 R15: 000000000075bf2c

Allocated by task 15089:
 save_stack mm/kasan/common.c:69 [inline]
 set_track mm/kasan/common.c:77 [inline]
 __kasan_kmalloc+0x11c/0x1b0 mm/kasan/common.c:510
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:524
 kmem_cache_alloc_trace+0x221/0x2f0 mm/slab.c:3550
 kmalloc include/linux/slab.h:556 [inline]
 kzalloc include/linux/slab.h:690 [inline]
 __rdma_create_id+0x66/0x480 drivers/infiniband/core/cma.c:882
 ucma_create_id+0x250/0x540 drivers/infiniband/core/ucma.c:501
 ucma_write+0x2da/0x360 drivers/infiniband/core/ucma.c:1684
 __vfs_write+0xb8/0x740 fs/read_write.c:494
 vfs_write+0x275/0x590 fs/read_write.c:558
 ksys_write+0x117/0x220 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+0xf7/0x1c0 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 15272:
 save_stack mm/kasan/common.c:69 [inline]
 set_track mm/kasan/common.c:77 [inline]
 kasan_set_free_info mm/kasan/common.c:332 [inline]
 __kasan_slab_free+0x12a/0x1e0 mm/kasan/common.c:471
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:480
 __cache_free mm/slab.c:3425 [inline]
 kfree+0x115/0x200 mm/slab.c:3756
 rdma_destroy_id+0xea2/0x1080 drivers/infiniband/core/cma.c:1877
 ucma_close+0x1eb/0x2c0 drivers/infiniband/core/ucma.c:1762
 __fput+0x2e4/0x740 fs/file_table.c:280
 ____fput+0x15/0x20 fs/file_table.c:313
 task_work_run+0x17e/0x1b0 kernel/task_work.c:113
 get_signal+0x1ca8/0x1d60 kernel/signal.c:2528
 do_signal+0x37/0x640 arch/x86/kernel/signal.c:815
 exit_to_usermode_loop arch/x86/entry/common.c:159 [inline]
 prepare_exit_to_usermode+0x303/0x580 arch/x86/entry/common.c:194
 syscall_return_slowpath+0x113/0x4a0 arch/x86/entry/common.c:274
 do_syscall_64+0x11f/0x1c0 arch/x86/entry/common.c:300
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff888097eda000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 488 bytes inside of
 2048-byte region [ffff888097eda000, ffff888097eda800)
The buggy address belongs to the page:
page:ffffea00025fb680 refcount:1 mapcount:0 mapping:ffff8880aa400e00 index:0x0
flags: 0x1fffc0000000200(slab)
raw: 01fffc0000000200 ffffea0002982a08 ffffea0002561a48 ffff8880aa400e00
raw: 0000000000000000 ffff888097eda000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888097eda080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888097eda100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888097eda180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                          ^
 ffff888097eda200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888097eda280: 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
2019/10/23 10:10 upstream 3b7c59a1950c d0686497 .config console log report ci-upstream-kasan-gce-smack-root
* Struck through repros no longer work on HEAD.