syzbot


KASAN: use-after-free Read in __list_del_entry_valid (4)

Status: fixed on 2020/05/10 10:41
Subsystems: rdma
[Documentation on labels]
Reported-by: syzbot+29ee8f76017ce6cf03da@syzkaller.appspotmail.com
Fix commit: 7c11910783a1 RDMA/ucma: Put a lock around every call to the rdma_cm layer
First crash: 2223d, last: 1534d
Cause bisection: the issue happens on the oldest tested release (bisect log)
Crash: WARNING in cma_cancel_operation (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 __list_del_entry_valid (4) 6 (8) 2018/08/23 17:17
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in __list_del_entry_valid (3) rdma C 15 2228d 2242d 22/26 closed as dup on 2018/03/22 15:31
upstream KASAN: use-after-free Read in __list_del_entry_valid (2) crypto C 11 2318d 2320d 3/26 fixed on 2018/01/11 01:23
Fix bisection attempts (4)
Created Duration User Patch Repo Result
2020/02/11 22:11 15m bisect fix upstream job log (0) log
2020/01/12 21:49 15m bisect fix upstream job log (0) log
2019/12/10 14:50 15m bisect fix upstream job log (0) log
2019/08/01 02:58 16m bisect fix upstream job log (0) log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __list_del_entry_valid+0x144/0x150 lib/list_debug.c:54
Read of size 8 at addr ffff8801b94cef60 by task syzkaller058671/4231

CPU: 0 PID: 4231 Comm: syzkaller058671 Not tainted 4.16.0-rc6+ #366
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x194/0x24d lib/dump_stack.c:53
 print_address_description+0x73/0x250 mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report+0x23c/0x360 mm/kasan/report.c:412
 __asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:433
 __list_del_entry_valid+0x144/0x150 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:1569 [inline]
 cma_cancel_operation+0x455/0xd60 drivers/infiniband/core/cma.c:1597
 rdma_destroy_id+0xff/0xda0 drivers/infiniband/core/cma.c:1661
 ucma_close+0x100/0x2f0 drivers/infiniband/core/ucma.c:1728
 __fput+0x327/0x7e0 fs/file_table.c:209
 ____fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x199/0x270 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x9bb/0x1ad0 kernel/exit.c:865
 do_group_exit+0x149/0x400 kernel/exit.c:968
 get_signal+0x73a/0x16d0 kernel/signal.c:2469
 do_signal+0x90/0x1e90 arch/x86/kernel/signal.c:809
 exit_to_usermode_loop+0x258/0x2f0 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+0x6ec/0x940 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x446a49
RSP: 002b:00007fb425dffda8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 00000000006e29fc RCX: 0000000000446a49
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 00000000006e29fc
RBP: 00000000006e29f8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 006d635f616d6472
R13: 2f646e6162696e69 R14: 666e692f7665642f R15: 0000000000000005

Allocated by task 4228:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:552
 kmem_cache_alloc_trace+0x136/0x740 mm/slab.c:3607
 kmalloc include/linux/slab.h:512 [inline]
 kzalloc include/linux/slab.h:701 [inline]
 rdma_create_id+0xd0/0x630 drivers/infiniband/core/cma.c:787
 ucma_create_id+0x35f/0x920 drivers/infiniband/core/ucma.c:480
 ucma_write+0x2d6/0x3d0 drivers/infiniband/core/ucma.c:1649
 __vfs_write+0xef/0x970 fs/read_write.c:480
 vfs_write+0x189/0x510 fs/read_write.c:544
 SYSC_write fs/read_write.c:589 [inline]
 SyS_write+0xef/0x220 fs/read_write.c:581
 do_syscall_64+0x281/0x940 arch/x86/entry/common.c:287
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 4231:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:520
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:527
 __cache_free mm/slab.c:3485 [inline]
 kfree+0xd9/0x260 mm/slab.c:3800
 rdma_destroy_id+0x821/0xda0 drivers/infiniband/core/cma.c:1691
 ucma_close+0x100/0x2f0 drivers/infiniband/core/ucma.c:1728
 __fput+0x327/0x7e0 fs/file_table.c:209
 ____fput+0x15/0x20 fs/file_table.c:243
 task_work_run+0x199/0x270 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x9bb/0x1ad0 kernel/exit.c:865
 do_group_exit+0x149/0x400 kernel/exit.c:968
 get_signal+0x73a/0x16d0 kernel/signal.c:2469
 do_signal+0x90/0x1e90 arch/x86/kernel/signal.c:809
 exit_to_usermode_loop+0x258/0x2f0 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+0x6ec/0x940 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8801b94ced80
 which belongs to the cache kmalloc-1024 of size 1024
The buggy address is located 480 bytes inside of
 1024-byte region [ffff8801b94ced80, ffff8801b94cf180)
The buggy address belongs to the page:
page:ffffea0006e53380 count:1 mapcount:0 mapping:ffff8801b94ce000 index:0x0 compound_mapcount: 0
flags: 0x2fffc0000008100(slab|head)
raw: 02fffc0000008100 ffff8801b94ce000 0000000000000000 0000000100000007
raw: ffffea0006e8ad20 ffff8801dac01848 ffff8801dac00ac0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8801b94cee00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801b94cee80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801b94cef00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff8801b94cef80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8801b94cf000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (16):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/03/26 04:05 upstream cb6416592bc2 e033c1f1 .config console log report syz C ci-upstream-kasan-gce
2018/03/26 03:42 upstream 3eb2ce825ea1 e033c1f1 .config console log report syz C ci-upstream-kasan-gce-root
2018/03/26 03:55 upstream cb6416592bc2 e033c1f1 .config console log report syz ci-upstream-kasan-gce-386
2018/03/24 20:37 upstream bcfc1f455466 2e9d9054 .config console log report syz ci-upstream-kasan-gce-386
2018/03/27 04:28 upstream 3eb2ce825ea1 0ca7878b .config console log report ci-upstream-kasan-gce-root
2018/03/26 03:25 upstream 3eb2ce825ea1 e033c1f1 .config console log report ci-upstream-kasan-gce-root
2018/04/01 09:31 upstream 10b84daddbec 0174c6c8 .config console log report ci-upstream-kasan-gce-386
2018/04/01 07:09 upstream 10b84daddbec 0174c6c8 .config console log report ci-upstream-kasan-gce-386
2018/04/01 01:57 upstream 10b84daddbec 0174c6c8 .config console log report ci-upstream-kasan-gce-386
2018/03/31 12:29 upstream b5dbc28762fd 8fbce0e4 .config console log report ci-upstream-kasan-gce-386
2018/03/30 04:02 upstream 0b412605ef5f d47f0ed6 .config console log report ci-upstream-kasan-gce-386
2018/03/29 11:28 upstream 0b412605ef5f d47f0ed6 .config console log report ci-upstream-kasan-gce-386
2018/03/29 06:04 upstream a2601d78b77a bf5e585c .config console log report ci-upstream-kasan-gce-386
2018/03/29 05:50 upstream a2601d78b77a bf5e585c .config console log report ci-upstream-kasan-gce-386
2018/03/29 04:31 upstream a2601d78b77a bf5e585c .config console log report ci-upstream-kasan-gce-386
2018/03/24 20:18 upstream bcfc1f455466 2e9d9054 .config console log report ci-upstream-kasan-gce-386
* Struck through repros no longer work on HEAD.