syzbot


KASAN: use-after-free Read in rdma_listen

Status: fixed on 2019/03/28 12:00
Reported-by: syzbot+f3ce716af730c8f96637@syzkaller.appspotmail.com
Fix commit: 5fc01fb846bc RDMA/cma: Rollback source IP address if failing to acquire device
First crash: 1713d, last: 1353d
similar bugs (5):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream BUG: corrupted list in rdma_listen (2) C inconclusive 5 304d 370d 23/24 upstream: reported C repro on 2021/12/04 09:54
upstream KASAN: use-after-free Read in rdma_listen (3) 1 596d 588d 0/24 auto-closed as invalid on 2021/08/21 07:04
linux-4.14 KASAN: use-after-free Read in rdma_listen C 1305 1d18h 1279d 0/1 upstream: reported C repro on 2019/06/10 00:44
upstream KASAN: use-after-free Read in rdma_listen (2) C done 354 982d 1351d 17/24 fixed on 2020/05/10 10:42
linux-4.19 KASAN: use-after-free Read in rdma_listen syz done 143 971d 1283d 1/1 fixed on 2020/05/13 09:53

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __list_add_valid+0x9a/0xa0 lib/list_debug.c:26
Read of size 8 at addr ffff888095fccb20 by task syz-executor083/10269

CPU: 1 PID: 10269 Comm: syz-executor083 Not tainted 5.0.0-rc7+ #85
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:135
 __list_add_valid+0x9a/0xa0 lib/list_debug.c:26
 __list_add include/linux/list.h:60 [inline]
 list_add_tail include/linux/list.h:93 [inline]
 cma_listen_on_all drivers/infiniband/core/cma.c:2477 [inline]
 rdma_listen+0x63b/0x8e0 drivers/infiniband/core/cma.c:3492
 ucma_listen+0x14d/0x1c0 drivers/infiniband/core/ucma.c:1100
 ucma_write+0x2da/0x3c0 drivers/infiniband/core/ucma.c:1689
 __vfs_write+0x116/0x8e0 fs/read_write.c:485
 vfs_write+0x20c/0x580 fs/read_write.c:549
 ksys_write+0xea/0x1f0 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+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x440f59
Code: e8 cc ab 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 bb 0a fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007ffca358d798 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000440f59
RDX: 0000000000000010 RSI: 00000000200001c0 RDI: 0000000000000003
RBP: 00000000000123b2 R08: 00000000004002c8 R09: 00000000004002c8
R10: 00000000004002c8 R11: 0000000000000246 R12: 0000000000401ea0
R13: 0000000000401f30 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 8083:
 save_stack+0x45/0xd0 mm/kasan/common.c:73
 set_track mm/kasan/common.c:85 [inline]
 __kasan_kmalloc mm/kasan/common.c:495 [inline]
 __kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:468
 kasan_kmalloc+0x9/0x10 mm/kasan/common.c:509
 kmem_cache_alloc_trace+0x151/0x760 mm/slab.c:3615
 kmalloc include/linux/slab.h:545 [inline]
 kzalloc include/linux/slab.h:740 [inline]
 __rdma_create_id+0x5f/0x4e0 drivers/infiniband/core/cma.c:879
 ucma_create_id+0x1de/0x640 drivers/infiniband/core/ucma.c:506
 ucma_write+0x2da/0x3c0 drivers/infiniband/core/ucma.c:1689
 __vfs_write+0x116/0x8e0 fs/read_write.c:485
 vfs_write+0x20c/0x580 fs/read_write.c:549
 ksys_write+0xea/0x1f0 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+0x103/0x610 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 8083:
 save_stack+0x45/0xd0 mm/kasan/common.c:73
 set_track mm/kasan/common.c:85 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/common.c:457
 kasan_slab_free+0xe/0x10 mm/kasan/common.c:465
 __cache_free mm/slab.c:3494 [inline]
 kfree+0xcf/0x230 mm/slab.c:3811
 rdma_destroy_id+0x723/0xab0 drivers/infiniband/core/cma.c:1849
 ucma_close+0x115/0x320 drivers/infiniband/core/ucma.c:1770
 __fput+0x2df/0x8d0 fs/file_table.c:278
 ____fput+0x16/0x20 fs/file_table.c:309
 task_work_run+0x14a/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:166
 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:268 [inline]
 do_syscall_64+0x52d/0x610 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff888095fcc940
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 480 bytes inside of
 2048-byte region [ffff888095fcc940, ffff888095fcd140)
The buggy address belongs to the page:
page:ffffea000257f300 count:1 mapcount:0 mapping:ffff88812c3f0c40 index:0x0 compound_mapcount: 0
flags: 0x1fffc0000010200(slab|head)
raw: 01fffc0000010200 ffffea0002027b88 ffffea0002565a08 ffff88812c3f0c40
raw: 0000000000000000 ffff888095fcc0c0 0000000100000003 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888095fcca00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888095fcca80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888095fccb00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                               ^
 ffff888095fccb80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888095fccc00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1548):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Title
ci-upstream-kasan-gce-selinux-root 2019/02/24 06:35 upstream e60b5f79bd75 7a06e792 .config log report syz C
ci-upstream-kasan-gce-smack-root 2019/02/24 06:34 upstream e60b5f79bd75 7a06e792 .config log report syz C
ci-upstream-kasan-gce 2019/02/24 06:34 upstream e60b5f79bd75 7a06e792 .config log report syz C
ci-upstream-kasan-gce-root 2019/02/24 06:33 upstream e60b5f79bd75 7a06e792 .config log report syz C
ci-upstream-kasan-gce-smack-root 2019/02/02 17:29 upstream cd984a5be215 c198d5dd .config log report syz C
ci-upstream-kasan-gce-root 2019/02/02 17:25 upstream cd984a5be215 c198d5dd .config log report syz C
ci-upstream-kasan-gce-selinux-root 2019/02/02 17:22 upstream cd984a5be215 c198d5dd .config log report syz C
ci-upstream-kasan-gce 2019/02/02 16:45 upstream cd984a5be215 c198d5dd .config log report syz C
ci-upstream-kasan-gce 2018/04/01 19:59 upstream 10b84daddbec dc889257 .config log report syz C
ci-upstream-kasan-gce-root 2018/04/01 19:33 upstream 10b84daddbec dc889257 .config log report syz C
ci-upstream-kasan-gce-386 2019/02/24 06:35 upstream e60b5f79bd75 7a06e792 .config log report syz C
ci-upstream-kasan-gce-386 2019/02/02 17:03 upstream cd984a5be215 c198d5dd .config log report syz C
ci-upstream-kasan-gce-selinux-root 2019/03/03 16:44 upstream c027c7cf1577 1c0e457a .config log report syz
ci-upstream-kasan-gce 2019/03/03 16:32 upstream c027c7cf1577 1c0e457a .config log report syz
ci-upstream-kasan-gce-root 2019/03/03 16:31 upstream c027c7cf1577 1c0e457a .config log report syz
ci-upstream-kasan-gce-smack-root 2019/03/03 16:30 upstream c027c7cf1577 1c0e457a .config log report syz
ci-upstream-kasan-gce 2019/03/03 15:59 upstream c027c7cf1577 1c0e457a .config log report syz
ci-upstream-kasan-gce-selinux-root 2019/03/03 15:30 upstream c027c7cf1577 1c0e457a .config log report syz
ci-upstream-kasan-gce-smack-root 2019/03/03 15:29 upstream c027c7cf1577 1c0e457a .config log report syz
ci-upstream-kasan-gce-root 2019/03/03 15:29 upstream c027c7cf1577 1c0e457a .config log report syz
ci-upstream-kasan-gce-smack-root 2019/01/19 22:13 upstream 2339e91d0e66 8aa587b0 .config log report syz
ci-upstream-kasan-gce-selinux-root 2019/01/19 11:27 upstream 2339e91d0e66 2103a236 .config log report syz
ci-upstream-kasan-gce 2019/01/19 10:30 upstream 2339e91d0e66 2103a236 .config log report syz
ci-upstream-kasan-gce-root 2019/01/19 10:06 upstream 2339e91d0e66 2103a236 .config log report syz
ci-upstream-kasan-gce 2018/12/18 06:01 upstream 1a9430db2835 def91db3 .config log report syz
ci-upstream-kasan-gce-smack-root 2018/12/17 23:22 upstream 7566ec393f41 def91db3 .config log report syz
ci-upstream-kasan-gce-root 2018/12/17 20:56 upstream 7566ec393f41 def91db3 .config log report syz
ci-upstream-kasan-gce-selinux-root 2018/12/17 20:55 upstream 7566ec393f41 def91db3 .config log report syz
ci-upstream-kasan-gce 2018/12/17 20:14 upstream 7566ec393f41 def91db3 .config log report syz
ci-upstream-kasan-gce-root 2018/12/17 16:11 upstream 7566ec393f41 def91db3 .config log report syz
ci-upstream-kasan-gce-selinux-root 2018/12/17 16:05 upstream 7566ec393f41 def91db3 .config log report syz
ci-upstream-kasan-gce-smack-root 2018/12/17 16:04 upstream 7566ec393f41 def91db3 .config log report syz
ci-upstream-kasan-gce-386 2019/03/03 16:31 upstream c027c7cf1577 1c0e457a .config log report syz
ci-upstream-kasan-gce-386 2019/03/03 15:30 upstream c027c7cf1577 1c0e457a .config log report syz
ci-upstream-kasan-gce-386 2019/01/19 10:28 upstream 2339e91d0e66 2103a236 .config log report syz
ci-upstream-kasan-gce-386 2018/12/17 20:58 upstream 7566ec393f41 def91db3 .config log report syz
ci-upstream-kasan-gce-386 2018/12/17 16:06 upstream 7566ec393f41 def91db3 .config log report syz
ci-upstream-linux-next-kasan-gce-root 2019/03/03 17:05 linux-next c63e9e91a254 1c0e457a .config log report syz
ci-upstream-linux-next-kasan-gce-root 2019/03/03 15:30 linux-next c63e9e91a254 1c0e457a .config log report syz
ci-upstream-linux-next-kasan-gce-root 2019/01/19 11:29 linux-next 9673b4aa71ca 2103a236 .config log report syz
ci-upstream-linux-next-kasan-gce-root 2018/12/24 05:47 linux-next 6648e120dd1a e3bd7ab8 .config log report syz
ci-upstream-linux-next-kasan-gce-root 2018/12/24 02:47 linux-next 6648e120dd1a e3bd7ab8 .config log report syz
ci-upstream-linux-next-kasan-gce-root 2018/12/14 09:59 linux-next d14b746c6c1c fe7127be .config log report syz
ci-upstream-kasan-gce-root 2019/03/27 18:06 upstream 14c741de9386 4e668495 .config log report
ci-upstream-kasan-gce-smack-root 2019/03/19 18:24 upstream 9e98c678c2d6 e4549234 .config log report
ci-upstream-kasan-gce-smack-root 2019/03/16 11:53 upstream 9c7dc824d9a4 bab43553 .config log report
ci-upstream-kasan-gce-selinux-root 2019/03/11 15:19 upstream 12ad143e1b80 12365b99 .config log report
ci-upstream-kasan-gce 2019/03/10 00:11 upstream 38e7571c07be 12365b99 .config log report
ci-upstream-kasan-gce 2019/03/09 10:04 upstream 3601fe43e816 12365b99 .config log report
ci-upstream-kasan-gce-selinux-root 2019/03/09 08:14 upstream 3601fe43e816 12365b99 .config log report
ci-upstream-kasan-gce-selinux-root 2019/03/08 05:51 upstream 1fc1cd8399ab 4b69c3cb .config log report
ci-upstream-kasan-gce 2019/03/07 11:35 upstream f90d64483ebd 8c085c5e .config log report
ci-upstream-kasan-gce 2019/03/07 06:12 upstream afe6fe7036c6 18215b8d .config log report
ci-upstream-kasan-gce-smack-root 2019/03/06 22:33 upstream afe6fe7036c6 18215b8d .config log report
ci-upstream-kasan-gce 2019/03/06 17:18 upstream 3717f613f48d 05cf83bf .config log report
ci-upstream-kasan-gce-smack-root 2019/03/06 12:53 upstream 3717f613f48d 05cf83bf .config log report
ci-upstream-kasan-gce 2019/03/06 08:45 upstream 3717f613f48d 05cf83bf .config log report
ci-upstream-kasan-gce 2019/03/06 06:40 upstream 63bdf4284c38 16559f86 .config log report
ci-upstream-kasan-gce-smack-root 2019/03/05 07:53 upstream cd2a3bf02625 bb91cf81 .config log report
ci-upstream-kasan-gce 2019/03/04 19:38 upstream 1c163f4c7b3f 7c693b52 .config log report
ci-upstream-kasan-gce 2019/03/04 18:36 upstream 1c163f4c7b3f 7c693b52 .config log report
ci-upstream-kasan-gce 2019/03/04 16:16 upstream 1c163f4c7b3f 7c693b52 .config log report
ci-upstream-kasan-gce 2019/03/04 14:06 upstream 1c163f4c7b3f 7c693b52 .config log report
ci-upstream-kasan-gce 2019/03/04 00:21 upstream c027c7cf1577 1c0e457a .config log report
ci-upstream-kasan-gce-smack-root 2019/03/03 23:01 upstream c027c7cf1577 1c0e457a .config log report
ci-upstream-kasan-gce-selinux-root 2019/03/03 06:31 upstream c93d9218ea56 1c0e457a .config log report
ci-upstream-kasan-gce-root 2019/03/03 03:38 upstream c93d9218ea56 1c0e457a .config log report
ci-upstream-kasan-gce-smack-root 2019/03/02 21:33 upstream c93d9218ea56 1c0e457a .config log report
ci-upstream-kasan-gce 2019/03/02 20:08 upstream c93d9218ea56 1c0e457a .config log report
ci-upstream-kasan-gce 2019/03/02 18:51 upstream a215ce8f0e00 1c0e457a .config log report
ci-upstream-kasan-gce-root 2019/03/02 16:26 upstream a215ce8f0e00 1c0e457a .config log report
ci-upstream-kasan-gce 2019/03/02 05:20 upstream a215ce8f0e00 68d9e495 .config log report
ci-upstream-kasan-gce 2019/03/01 23:43 upstream 7d762d69145a 68d9e495 .config log report
ci-upstream-kasan-gce-selinux-root 2019/03/01 16:54 upstream 7d762d69145a 8a4b3a6b .config log report
ci-upstream-kasan-gce 2019/03/01 15:12 upstream 7d762d69145a 8a4b3a6b .config log report
ci-upstream-kasan-gce 2019/03/01 10:43 upstream 7d762d69145a 8a4b3a6b .config log report
ci-upstream-kasan-gce-selinux-root 2019/03/01 04:26 upstream 7d762d69145a 09aeeba4 .config log report
ci-upstream-kasan-gce 2019/02/28 19:15 upstream 7d762d69145a 09aeeba4 .config log report
ci-upstream-kasan-gce 2019/02/28 09:28 upstream 7d762d69145a 34ec456b .config log report
ci-upstream-kasan-gce 2019/02/28 03:50 upstream 7d762d69145a 34ec456b .config log report
ci-upstream-kasan-gce 2019/02/27 19:54 upstream 7d762d69145a 083cfd0e .config log report
ci-upstream-kasan-gce 2019/02/27 16:20 upstream 7d762d69145a 083cfd0e .config log report
ci-upstream-kasan-gce-root 2018/04/01 18:59 upstream 10b84daddbec dc889257 .config log report
ci-upstream-kasan-gce-386 2019/03/20 08:49 upstream b7a42146dca3 2458c1c6 .config log report
ci-upstream-kasan-gce-386 2019/03/11 17:48 upstream 12ad143e1b80 12365b99 .config log report
ci-upstream-kasan-gce-386 2019/03/08 23:27 upstream 610cd4eadec4 12365b99 .config log report
ci-upstream-kasan-gce-386 2019/03/06 12:51 upstream 3717f613f48d 05cf83bf .config log report
ci-upstream-kasan-gce-386 2019/02/28 20:26 upstream 7d762d69145a 09aeeba4 .config log report
ci-upstream-kasan-gce-386 2019/02/27 17:20 upstream 7d762d69145a 083cfd0e .config log report
ci-upstream-linux-next-kasan-gce-root 2019/03/27 20:33 linux-next a392ee45bae7 4e668495 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/03/27 11:04 linux-next a392ee45bae7 55684ce1 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/03/12 20:54 linux-next cf08baa29613 a71bfb62 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/03/10 13:01 linux-next cf08baa29613 12365b99 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/03/10 02:02 linux-next cf08baa29613 12365b99 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/03/09 04:58 linux-next cf08baa29613 12365b99 .config log report
ci-upstream-linux-next-kasan-gce-root 2019/03/01 01:14 linux-next 42fd8df9d1d9 09aeeba4 .config log report
* Struck through repros no longer work on HEAD.