syzbot


KASAN: use-after-free Read in cma_cancel_operation

Status: fixed on 2020/05/10 10:42
Subsystems: rdma
[Documentation on labels]
Reported-by: syzbot+6956235342b7317ec564@syzkaller.appspotmail.com
Fix commit: 7c11910783a1 RDMA/ucma: Put a lock around every call to the rdma_cm layer
First crash: 2201d, last: 1521d
Cause bisection: the issue happens on the oldest tested release (bisect log)
Crash: WARNING in rdma_listen (log)
Repro: C syz .config
  
Discussions (11)
Title Replies (including bot) Last reply
[PATCH 4.19 00/54] 4.19.115-rc1 review 70 (70) 2020/05/27 20:33
[PATCH AUTOSEL 5.4 001/108] net: wan: wanxl: use allow to pass CROSS_COMPILE_M68k for rebuilding firmware 111 (111) 2020/04/17 17:18
[PATCH AUTOSEL 5.6 001/149] net: hns3: drop the WQ_MEM_RECLAIM flag when allocating WQ 152 (152) 2020/04/17 17:06
[PATCH 5.6 00/38] 5.6.4-rc1 review 44 (44) 2020/04/14 10:36
[PATCH 5.5 00/44] 5.5.17-rc1 review 48 (48) 2020/04/14 10:36
[PATCH 5.4 00/41] 5.4.32-rc1 review 45 (45) 2020/04/14 10:36
[PATCH AUTOSEL 5.5 001/121] net: wan: wanxl: use allow to pass CROSS_COMPILE_M68k for rebuilding firmware 122 (122) 2020/04/12 01:16
[PATCH AUTOSEL 4.19 01/66] net: wan: wanxl: use allow to pass CROSS_COMPILE_M68k for rebuilding firmware 67 (67) 2020/04/12 01:16
Reminder: 11 open syzbot bugs in RDMA subsystem 1 (1) 2019/07/24 01:48
Reminder: 11 open syzbot bugs in RDMA subsystem 1 (1) 2019/06/25 05:48
KASAN: use-after-free Read in cma_cancel_operation 1 (2) 2019/02/20 15:29
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 KASAN: use-after-free Read in cma_cancel_operation C done 6 1472d 1623d 1/1 fixed on 2020/05/01 08:27
linux-4.14 KASAN: use-after-free Read in cma_cancel_operation C inconclusive 55 466d 1575d 0/1 upstream: reported C repro on 2019/12/19 22:41
Fix bisection attempts (3)
Created Duration User Patch Repo Result
2020/02/12 13:05 18m bisect fix upstream job log (0) log
2019/12/31 00:35 17m bisect fix upstream job log (0) log
2019/08/13 20:16 18m bisect fix upstream job log (0) log

Sample crash report:
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
==================================================================
BUG: KASAN: use-after-free in __list_del_entry_valid+0xe7/0xf3 lib/list_debug.c:54
Read of size 8 at addr ffff8801aca794e0 by task syz-executor589/4566

CPU: 0 PID: 4566 Comm: syz-executor589 Not tainted 4.17.0-rc6+ #61
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+0x1b9/0x294 lib/dump_stack.c:113
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0x242/0x2fe mm/kasan/report.c:412
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 __list_del_entry_valid+0xe7/0xf3 lib/list_debug.c:54
 __list_del_entry include/linux/list.h:117 [inline]
 list_del include/linux/list.h:125 [inline]
 cma_cancel_listens drivers/infiniband/core/cma.c:1553 [inline]
 cma_cancel_operation+0x457/0xe90 drivers/infiniband/core/cma.c:1581
 rdma_destroy_id+0xff/0xe50 drivers/infiniband/core/cma.c:1645
 ucma_close+0x100/0x300 drivers/infiniband/core/ucma.c:1755
 __fput+0x34d/0x890 fs/file_table.c:209
 ____fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x1e4/0x290 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x1aee/0x2730 kernel/exit.c:865
 do_group_exit+0x16f/0x430 kernel/exit.c:968
 get_signal+0x886/0x1960 kernel/signal.c:2482
 do_signal+0x98/0x2040 arch/x86/kernel/signal.c:810
 exit_to_usermode_loop+0x28a/0x310 arch/x86/entry/common.c:162
 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:265 [inline]
 do_syscall_64+0x6ac/0x800 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x445dc9
RSP: 002b:00007fc7a40a9da8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00000000006dbc3c RCX: 0000000000445dc9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000006dbc3c
RBP: 00000000006dbc38 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 006d635f616d6472
R13: 2f646e6162696e69 R14: 666e692f7665642f R15: 0000000000000005

Allocated by task 4563:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
 kmem_cache_alloc_trace+0x152/0x780 mm/slab.c:3620
 kmalloc include/linux/slab.h:512 [inline]
 kzalloc include/linux/slab.h:701 [inline]
 __rdma_create_id+0xd7/0x710 drivers/infiniband/core/cma.c:753
 ucma_create_id+0x385/0x9b0 drivers/infiniband/core/ucma.c:502
 ucma_write+0x328/0x410 drivers/infiniband/core/ucma.c:1676
 __vfs_write+0x10b/0x960 fs/read_write.c:485
 vfs_write+0x1f8/0x560 fs/read_write.c:549
 ksys_write+0xf9/0x250 fs/read_write.c:598
 __do_sys_write fs/read_write.c:610 [inline]
 __se_sys_write fs/read_write.c:607 [inline]
 __x64_sys_write+0x73/0xb0 fs/read_write.c:607
 do_syscall_64+0x1b1/0x800 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 4566:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xd9/0x260 mm/slab.c:3813
 rdma_destroy_id+0x8c5/0xe50 drivers/infiniband/core/cma.c:1676
 ucma_close+0x100/0x300 drivers/infiniband/core/ucma.c:1755
 __fput+0x34d/0x890 fs/file_table.c:209
 ____fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x1e4/0x290 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x1aee/0x2730 kernel/exit.c:865
 do_group_exit+0x16f/0x430 kernel/exit.c:968
 get_signal+0x886/0x1960 kernel/signal.c:2482
 do_signal+0x98/0x2040 arch/x86/kernel/signal.c:810
 exit_to_usermode_loop+0x28a/0x310 arch/x86/entry/common.c:162
 prepare_exit_to_usermode arch/x86/entry/common.c:196 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:265 [inline]
 do_syscall_64+0x6ac/0x800 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8801aca79300
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 480 bytes inside of
 2048-byte region [ffff8801aca79300, ffff8801aca79b00)
The buggy address belongs to the page:
page:ffffea0006b29e00 count:1 mapcount:0 mapping:ffff8801aca78200 index:0x0 compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffff8801aca78200 0000000000000000 0000000100000003
raw: ffffea0006b29220 ffff8801da801948 ffff8801da800c40 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801aca79380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801aca79400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801aca79480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff8801aca79500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801aca79580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (617):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/05/21 07:57 upstream 771c577c23ba f48c20b8 .config console log report syz C ci-upstream-kasan-gce-root
2018/05/21 07:24 upstream 771c577c23ba f48c20b8 .config console log report syz C ci-upstream-kasan-gce
2018/04/03 02:40 upstream 86bbbebac193 676bd07e .config console log report syz C ci-upstream-kasan-gce
2018/04/03 02:39 upstream 86bbbebac193 676bd07e .config console log report syz C ci-upstream-kasan-gce-root
2020/01/06 13:15 linux-next 7ddd09fc4b74 438e1227 .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2018/05/21 07:47 upstream 771c577c23ba f48c20b8 .config console log report syz ci-upstream-kasan-gce-386
2018/04/03 02:26 upstream 86bbbebac193 676bd07e .config console log report syz ci-upstream-kasan-gce-386
2020/01/13 12:35 upstream b3a987b0264d 99565c1a .config console log report ci-upstream-kasan-gce-selinux-root
2019/11/30 17:13 upstream 81b6b96475ac 3a75be00 .config console log report ci-upstream-kasan-gce-root
2019/11/24 21:18 upstream 6b8a79467876 598ca6c8 .config console log report ci-upstream-kasan-gce-selinux-root
2019/03/09 09:50 upstream 3601fe43e816 12365b99 .config console log report ci-upstream-kasan-gce
2019/03/09 05:35 upstream 3601fe43e816 12365b99 .config console log report ci-upstream-kasan-gce
2019/03/08 16:20 upstream 610cd4eadec4 12365b99 .config console log report ci-upstream-kasan-gce-selinux-root
2019/03/07 18:31 upstream f90d64483ebd 8c085c5e .config console log report ci-upstream-kasan-gce
2019/03/07 16:22 upstream f90d64483ebd 8c085c5e .config console log report ci-upstream-kasan-gce-selinux-root
2019/03/06 18:21 upstream 3717f613f48d 05cf83bf .config console log report ci-upstream-kasan-gce-smack-root
2019/03/06 07:00 upstream 63bdf4284c38 16559f86 .config console log report ci-upstream-kasan-gce
2019/03/04 06:36 upstream 1c163f4c7b3f 1c0e457a .config console log report ci-upstream-kasan-gce
2019/03/03 23:37 upstream c027c7cf1577 1c0e457a .config console log report ci-upstream-kasan-gce-smack-root
2019/03/03 20:29 upstream c027c7cf1577 1c0e457a .config console log report ci-upstream-kasan-gce
2019/03/03 03:41 upstream c93d9218ea56 1c0e457a .config console log report ci-upstream-kasan-gce-selinux-root
2019/03/02 16:27 upstream a215ce8f0e00 1c0e457a .config console log report ci-upstream-kasan-gce-smack-root
2019/02/26 17:52 upstream 7d762d69145a a36ecd98 .config console log report ci-upstream-kasan-gce
2019/02/26 08:34 upstream 7d762d69145a 8022bafd .config console log report ci-upstream-kasan-gce
2019/02/24 07:55 upstream e60b5f79bd75 7a06e792 .config console log report ci-upstream-kasan-gce-root
2019/02/24 03:23 upstream e60b5f79bd75 7a06e792 .config console log report ci-upstream-kasan-gce-smack-root
2019/02/24 01:39 upstream e60b5f79bd75 7a06e792 .config console log report ci-upstream-kasan-gce
2019/02/22 16:33 upstream 8a61716ff2ab 6a5fcca4 .config console log report ci-upstream-kasan-gce-root
2019/02/22 11:06 upstream 8a61716ff2ab 7ff74a98 .config console log report ci-upstream-kasan-gce-root
2019/02/22 07:57 upstream 8a61716ff2ab 7ff74a98 .config console log report ci-upstream-kasan-gce-root
2019/02/20 03:04 upstream 40e196a906d9 4df543c9 .config console log report ci-upstream-kasan-gce-smack-root
2019/02/18 19:25 upstream a3b22b9f11d9 59f36113 .config console log report ci-upstream-kasan-gce-root
2019/02/18 16:12 upstream 2fee036af043 59f36113 .config console log report ci-upstream-kasan-gce
2019/02/18 14:10 upstream 2fee036af043 59f36113 .config console log report ci-upstream-kasan-gce-selinux-root
2019/02/17 07:36 upstream 64c0133eb88a f42dee6d .config console log report ci-upstream-kasan-gce
2019/02/17 02:21 upstream 5ded5871030e f42dee6d .config console log report ci-upstream-kasan-gce-root
2019/02/16 23:52 upstream 5ded5871030e f42dee6d .config console log report ci-upstream-kasan-gce-smack-root
2019/02/16 07:45 upstream 5ded5871030e f42dee6d .config console log report ci-upstream-kasan-gce-selinux-root
2019/02/14 02:51 upstream 1f947a7a011f 0a49c954 .config console log report ci-upstream-kasan-gce-root
2019/02/11 12:26 upstream d13937116f1e 73f5f452 .config console log report ci-upstream-kasan-gce
2019/02/09 07:13 upstream 46c291e277f9 fa6c7b70 .config console log report ci-upstream-kasan-gce
2019/02/09 00:36 upstream 74e96711e337 fa6c7b70 .config console log report ci-upstream-kasan-gce-selinux-root
2019/02/08 20:50 upstream 74e96711e337 fa6c7b70 .config console log report ci-upstream-kasan-gce
2019/02/08 04:17 upstream d47e3da17592 aa4feb03 .config console log report ci-upstream-kasan-gce
2019/02/07 21:22 upstream b0314565da2b aa4feb03 .config console log report ci-upstream-kasan-gce-selinux-root
2019/02/07 06:34 upstream 8834f5600cf3 d25487bc .config console log report ci-upstream-kasan-gce-root
2019/02/06 10:29 upstream 8834f5600cf3 d672172c .config console log report ci-upstream-kasan-gce-root
2019/02/06 08:53 upstream 8834f5600cf3 d672172c .config console log report ci-upstream-kasan-gce-root
2019/03/04 17:03 upstream 1c163f4c7b3f 7c693b52 .config console log report ci-upstream-kasan-gce-386
2019/02/23 12:59 upstream cb268d806972 18107ce0 .config console log report ci-upstream-kasan-gce-386
2019/02/16 17:41 upstream 5ded5871030e f42dee6d .config console log report ci-upstream-kasan-gce-386
2019/02/16 16:30 upstream 5ded5871030e f42dee6d .config console log report ci-upstream-kasan-gce-386
2019/02/11 17:47 upstream d13937116f1e 73f5f452 .config console log report ci-upstream-kasan-gce-386
2019/02/10 15:11 upstream e8b50608f666 b4f792e4 .config console log report ci-upstream-kasan-gce-386
2019/02/07 23:16 upstream b0314565da2b aa4feb03 .config console log report ci-upstream-kasan-gce-386
2018/04/03 02:11 upstream 86bbbebac193 676bd07e .config console log report ci-upstream-kasan-gce-386
2019/03/07 06:13 linux-next cf08baa29613 18215b8d .config console log report ci-upstream-linux-next-kasan-gce-root
2019/02/14 14:53 linux-next b3418f8bddf4 6a46f448 .config console log report ci-upstream-linux-next-kasan-gce-root
2019/02/09 13:42 linux-next a46228f6598a fa6c7b70 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.