syzbot


KASAN: use-after-free Read in cma_check_port

Status: closed as dup on 2019/04/01 18:32
Subsystems: rdma
[Documentation on labels]
Reported-by: syzbot+70f6c187224c333bb8da@syzkaller.appspotmail.com
First crash: 1850d, last: 1847d
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
WARNING in cma_exit_net rdma 25 1848d 1849d
Discussions (1)
Title Replies (including bot) Last reply
KASAN: use-after-free Read in cma_check_port 1 (2) 2019/04/01 18:32

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in cma_check_port+0x8ce/0x8f0 drivers/infiniband/core/cma.c:3354
Read of size 8 at addr ffff8880a7d7ac48 by task syz-executor333/7822

CPU: 1 PID: 7822 Comm: syz-executor333 Not tainted 5.1.0-rc3-next-20190402 #16
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+0x172/0x1f0 lib/dump_stack.c:113
 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:187
 kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132
 cma_check_port+0x8ce/0x8f0 drivers/infiniband/core/cma.c:3354
 cma_use_port drivers/infiniband/core/cma.c:3391 [inline]
 cma_get_port drivers/infiniband/core/cma.c:3473 [inline]
 rdma_bind_addr+0x19c3/0x1f80 drivers/infiniband/core/cma.c:3591
 p9_rdma_bind_privport net/9p/trans_rdma.c:627 [inline]
 rdma_create_trans+0x9ad/0x1390 net/9p/trans_rdma.c:673
 p9_client_create+0x89c/0x1400 net/9p/client.c:1053
 v9fs_session_init+0x1e7/0x1960 fs/9p/v9fs.c:421
 v9fs_mount+0x7d/0x920 fs/9p/vfs_super.c:135
 legacy_get_tree+0xf2/0x200 fs/fs_context.c:584
 vfs_get_tree+0x123/0x450 fs/super.c:1481
 do_new_mount fs/namespace.c:2622 [inline]
 do_mount+0x1436/0x2c40 fs/namespace.c:2942
 ksys_mount+0xdb/0x150 fs/namespace.c:3151
 __do_sys_mount fs/namespace.c:3165 [inline]
 __se_sys_mount fs/namespace.c:3162 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3162
 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x441209
Code: e8 3c ad 02 00 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 9b 09 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fff651fe848 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000441209
RDX: 00000000200000c0 RSI: 0000000020000080 RDI: 0000000020000000
RBP: 000000000001008e R08: 0000000020000340 R09: 00000000004002c8
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000402030
R13: 00000000004020c0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 7821:
 save_stack+0x45/0xd0 mm/kasan/common.c:75
 set_track mm/kasan/common.c:87 [inline]
 __kasan_kmalloc mm/kasan/common.c:497 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:470
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:511
 kmem_cache_alloc_trace+0x151/0x760 mm/slab.c:3622
 kmalloc include/linux/slab.h:547 [inline]
 kzalloc include/linux/slab.h:742 [inline]
 cma_alloc_port+0x4f/0x1a0 drivers/infiniband/core/cma.c:3241
 cma_use_port drivers/infiniband/core/cma.c:3389 [inline]
 cma_get_port drivers/infiniband/core/cma.c:3473 [inline]
 rdma_bind_addr+0x1bc0/0x1f80 drivers/infiniband/core/cma.c:3591
 p9_rdma_bind_privport net/9p/trans_rdma.c:627 [inline]
 rdma_create_trans+0x9ad/0x1390 net/9p/trans_rdma.c:673
 p9_client_create+0x89c/0x1400 net/9p/client.c:1053
 v9fs_session_init+0x1e7/0x1960 fs/9p/v9fs.c:421
 v9fs_mount+0x7d/0x920 fs/9p/vfs_super.c:135
 legacy_get_tree+0xf2/0x200 fs/fs_context.c:584
 vfs_get_tree+0x123/0x450 fs/super.c:1481
 do_new_mount fs/namespace.c:2622 [inline]
 do_mount+0x1436/0x2c40 fs/namespace.c:2942
 ksys_mount+0xdb/0x150 fs/namespace.c:3151
 __do_sys_mount fs/namespace.c:3165 [inline]
 __se_sys_mount fs/namespace.c:3162 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3162
 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 7821:
 save_stack+0x45/0xd0 mm/kasan/common.c:75
 set_track mm/kasan/common.c:87 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:459
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:467
 __cache_free mm/slab.c:3499 [inline]
 kfree+0xcf/0x230 mm/slab.c:3822
 cma_release_port drivers/infiniband/core/cma.c:1773 [inline]
 rdma_destroy_id+0x7fc/0xaa0 drivers/infiniband/core/cma.c:1840
 rdma_destroy_trans+0x179/0x1c0 net/9p/trans_rdma.c:392
 rdma_create_trans+0xffc/0x1390 net/9p/trans_rdma.c:749
 p9_client_create+0x89c/0x1400 net/9p/client.c:1053
 v9fs_session_init+0x1e7/0x1960 fs/9p/v9fs.c:421
 v9fs_mount+0x7d/0x920 fs/9p/vfs_super.c:135
 legacy_get_tree+0xf2/0x200 fs/fs_context.c:584
 vfs_get_tree+0x123/0x450 fs/super.c:1481
 do_new_mount fs/namespace.c:2622 [inline]
 do_mount+0x1436/0x2c40 fs/namespace.c:2942
 ksys_mount+0xdb/0x150 fs/namespace.c:3151
 __do_sys_mount fs/namespace.c:3165 [inline]
 __se_sys_mount fs/namespace.c:3162 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3162
 do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880a7d7ac40
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 8 bytes inside of
 32-byte region [ffff8880a7d7ac40, ffff8880a7d7ac60)
The buggy address belongs to the page:
page:ffffea00029f5e80 count:1 mapcount:0 mapping:ffff88812c3f01c0 index:0xffff8880a7d7afc1
flags: 0x1fffc0000000200(slab)
raw: 01fffc0000000200 ffffea000267ea08 ffffea000267ec08 ffff88812c3f01c0
raw: ffff8880a7d7afc1 ffff8880a7d7a000 0000000100000009 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a7d7ab00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8880a7d7ab80: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
>ffff8880a7d7ac00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
                                              ^
 ffff8880a7d7ac80: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8880a7d7ad00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
==================================================================

Crashes (33):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/04/02 14:56 linux-next 05d08e2995cb dfd3394d .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2019/04/04 05:15 linux-next bf97b82f37c6 d6fc4177 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/04 00:14 linux-next bf97b82f37c6 d6fc4177 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/03 23:20 linux-next bf97b82f37c6 d6fc4177 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/03 17:30 linux-next bf97b82f37c6 dfd3394d .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/03 14:19 linux-next bf97b82f37c6 dfd3394d .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/03 10:30 linux-next bf97b82f37c6 dfd3394d .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/03 03:45 linux-next 05d08e2995cb dfd3394d .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/02 16:44 linux-next 05d08e2995cb dfd3394d .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/02 16:38 linux-next 05d08e2995cb dfd3394d .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/02 15:07 linux-next 05d08e2995cb dfd3394d .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/02 13:04 linux-next 05d08e2995cb dfd3394d .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/02 13:01 linux-next 05d08e2995cb dfd3394d .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/02 12:36 linux-next 05d08e2995cb dfd3394d .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/02 12:27 linux-next 05d08e2995cb dfd3394d .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/02 12:27 linux-next 05d08e2995cb dfd3394d .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/02 08:53 linux-next 05d08e2995cb a9ca43d4 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/02 08:18 linux-next 05d08e2995cb a9ca43d4 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/02 07:38 linux-next 05d08e2995cb a9ca43d4 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/02 06:22 linux-next 05d08e2995cb a9ca43d4 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/01 18:39 linux-next e3ecb83ee707 a9ca43d4 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/01 17:52 linux-next e3ecb83ee707 a9ca43d4 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/01 17:27 linux-next e3ecb83ee707 a9ca43d4 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/01 17:18 linux-next e3ecb83ee707 a9ca43d4 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/01 16:44 linux-next e3ecb83ee707 a9ca43d4 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/01 16:32 linux-next e3ecb83ee707 a9ca43d4 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/01 05:53 linux-next e3ecb83ee707 ccf2355a .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/01 05:52 linux-next e3ecb83ee707 ccf2355a .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/01 04:46 linux-next e3ecb83ee707 ccf2355a .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/01 04:41 linux-next e3ecb83ee707 ccf2355a .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/01 04:24 linux-next e3ecb83ee707 ccf2355a .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/01 04:12 linux-next e3ecb83ee707 ccf2355a .config console log report ci-upstream-linux-next-kasan-gce-root
2019/04/01 04:02 linux-next e3ecb83ee707 ccf2355a .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.