syzbot


KASAN: use-after-free Read in rdma_listen

Status: fixed on 2020/05/13 09:53
Reported-by: syzbot+f7c4563f141eafeca5b5@syzkaller.appspotmail.com
Fix commit: abc4ea7f1345 RDMA/ucma: Put a lock around every call to the rdma_cm layer
First crash: 1995d, last: 1683d
Fix bisection: fixed by (bisect log) :
commit abc4ea7f1345398261295345fd9b30243e4f4f8e
Author: Jason Gunthorpe <jgg@mellanox.com>
Date: Tue Feb 18 19:45:38 2020 +0000

  RDMA/ucma: Put a lock around every call to the rdma_cm layer

  
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream BUG: corrupted list in rdma_listen (2) rdma C inconclusive 5 1016d 1083d 22/28 fixed on 2023/02/24 13:50
upstream KASAN: use-after-free Read in rdma_listen (3) rdma 1 1308d 1300d 0/28 auto-closed as invalid on 2021/08/21 07:04
linux-4.14 KASAN: use-after-free Read in rdma_listen C 1358 625d 1991d 0/1 upstream: reported C repro on 2019/06/10 00:44
upstream KASAN: use-after-free Read in rdma_listen (2) rdma C done 354 1694d 2063d 15/28 fixed on 2020/05/10 10:42
upstream KASAN: use-after-free Read in rdma_listen rdma C 1548 2065d 2425d 11/28 fixed on 2019/03/28 12:00

Sample crash report:
IPv6: ADDRCONF(NETDEV_UP): batadv_slave_1: link is not ready
batman_adv: batadv0: Interface activated: batadv_slave_1
IPv6: ADDRCONF(NETDEV_CHANGE): batadv_slave_1: link becomes ready
IPv6: ADDRCONF(NETDEV_CHANGE): veth1_to_batadv: link becomes ready
==================================================================
BUG: KASAN: use-after-free in __list_add_valid+0x93/0xa0 lib/list_debug.c:26
Read of size 8 at addr ffff88808acd6460 by task syz-executor.0/6717

CPU: 1 PID: 6717 Comm: syz-executor.0 Not tainted 4.19.114-syzkaller #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+0x188/0x20d lib/dump_stack.c:118
 print_address_description.cold+0x7c/0x212 mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report mm/kasan/report.c:412 [inline]
 kasan_report.cold+0x88/0x2b9 mm/kasan/report.c:396
 __list_add_valid+0x93/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:2380 [inline]
 rdma_listen+0x609/0x880 drivers/infiniband/core/cma.c:3408
 ucma_listen+0x14d/0x1c0 drivers/infiniband/core/ucma.c:1100
 ucma_write+0x285/0x350 drivers/infiniband/core/ucma.c:1689
 __vfs_write+0xf7/0x760 fs/read_write.c:485
 vfs_write+0x206/0x550 fs/read_write.c:549
 ksys_write+0x12b/0x2a0 fs/read_write.c:599
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45c889
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:00007f4439047c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00007f44390486d4 RCX: 000000000045c889
RDX: 0000000000000010 RSI: 0000000020000040 RDI: 0000000000000003
RBP: 000000000076bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 0000000000000cc2 R14: 00000000004ceeb6 R15: 000000000076bf0c

Allocated by task 6709:
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc mm/kasan/kasan.c:553 [inline]
 kasan_kmalloc+0xbf/0xe0 mm/kasan/kasan.c:531
 kmem_cache_alloc_trace+0x14d/0x7a0 mm/slab.c:3625
 kmalloc include/linux/slab.h:515 [inline]
 kzalloc include/linux/slab.h:709 [inline]
 __rdma_create_id+0x5b/0x630 drivers/infiniband/core/cma.c:784
 ucma_create_id+0x1cb/0x5a0 drivers/infiniband/core/ucma.c:506
 ucma_write+0x285/0x350 drivers/infiniband/core/ucma.c:1689
 __vfs_write+0xf7/0x760 fs/read_write.c:485
 vfs_write+0x206/0x550 fs/read_write.c:549
 ksys_write+0x12b/0x2a0 fs/read_write.c:599
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 6708:
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0xf7/0x140 mm/kasan/kasan.c:521
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xce/0x220 mm/slab.c:3822
 ucma_close+0x10b/0x320 drivers/infiniband/core/ucma.c:1770
 __fput+0x2cd/0x890 fs/file_table.c:278
 task_work_run+0x13f/0x1b0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x25a/0x2b0 arch/x86/entry/common.c:167
 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
 do_syscall_64+0x538/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff88808acd6280
 which belongs to the cache kmalloc-2048 of size 2048
The buggy address is located 480 bytes inside of
 2048-byte region [ffff88808acd6280, ffff88808acd6a80)
The buggy address belongs to the page:
page:ffffea00022b3580 count:1 mapcount:0 mapping:ffff88812c3dcc40 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffffea0002118088 ffffea0002212b08 ffff88812c3dcc40
raw: 0000000000000000 ffff88808acd6280 0000000100000003 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88808acd6300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88808acd6380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88808acd6400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                                                       ^
 ffff88808acd6480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88808acd6500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (143):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/04/13 02:39 linux-4.19.y dda0e2920330 17a986e5 .config console log report syz ci2-linux-4-19
2020/04/11 20:37 linux-4.19.y dda0e2920330 a8c6a3f8 .config console log report syz ci2-linux-4-19
2020/04/10 01:08 linux-4.19.y dda0e2920330 a8c6a3f8 .config console log report syz ci2-linux-4-19
2020/04/08 17:52 linux-4.19.y dda0e2920330 db9bcd4b .config console log report syz ci2-linux-4-19
2020/04/08 05:45 linux-4.19.y dda0e2920330 db9bcd4b .config console log report syz ci2-linux-4-19
2020/04/07 21:06 linux-4.19.y dda0e2920330 db9bcd4b .config console log report syz ci2-linux-4-19
2020/04/03 15:38 linux-4.19.y dda0e2920330 5ed396e6 .config console log report syz ci2-linux-4-19
2020/04/03 08:04 linux-4.19.y dda0e2920330 a34e2c33 .config console log report syz ci2-linux-4-19
2020/04/03 05:34 linux-4.19.y dda0e2920330 a34e2c33 .config console log report syz ci2-linux-4-19
2020/04/02 20:42 linux-4.19.y dda0e2920330 a34e2c33 .config console log report syz ci2-linux-4-19
2020/04/02 00:21 linux-4.19.y 54b4fa6d3955 a34e2c33 .config console log report syz ci2-linux-4-19
2020/03/31 05:53 linux-4.19.y 54b4fa6d3955 c8d1cc20 .config console log report syz ci2-linux-4-19
2020/03/30 20:48 linux-4.19.y 54b4fa6d3955 c8d1cc20 .config console log report syz ci2-linux-4-19
2020/03/30 18:40 linux-4.19.y 54b4fa6d3955 c8d1cc20 .config console log report syz ci2-linux-4-19
2020/03/30 02:39 linux-4.19.y 54b4fa6d3955 05736b29 .config console log report syz ci2-linux-4-19
2020/03/29 23:42 linux-4.19.y 54b4fa6d3955 05736b29 .config console log report syz ci2-linux-4-19
2020/03/29 20:43 linux-4.19.y 54b4fa6d3955 05736b29 .config console log report syz ci2-linux-4-19
2020/03/29 17:06 linux-4.19.y 54b4fa6d3955 05736b29 .config console log report syz ci2-linux-4-19
2020/03/29 05:45 linux-4.19.y 54b4fa6d3955 05736b29 .config console log report syz ci2-linux-4-19
2020/03/29 04:36 linux-4.19.y 54b4fa6d3955 05736b29 .config console log report syz ci2-linux-4-19
2020/03/28 08:47 linux-4.19.y 54b4fa6d3955 831e9a81 .config console log report syz ci2-linux-4-19
2020/03/27 22:09 linux-4.19.y 54b4fa6d3955 831e9a81 .config console log report syz ci2-linux-4-19
2020/03/27 17:14 linux-4.19.y 54b4fa6d3955 831e9a81 .config console log report syz ci2-linux-4-19
2020/03/26 22:02 linux-4.19.y 54b4fa6d3955 6d25c5a0 .config console log report syz ci2-linux-4-19
2020/03/26 05:50 linux-4.19.y 54b4fa6d3955 e8e6c7d2 .config console log report syz ci2-linux-4-19
2020/03/26 01:03 linux-4.19.y 54b4fa6d3955 e8e6c7d2 .config console log report syz ci2-linux-4-19
2020/03/25 23:28 linux-4.19.y 54b4fa6d3955 e8e6c7d2 .config console log report syz ci2-linux-4-19
2020/03/25 18:18 linux-4.19.y 54b4fa6d3955 e8e6c7d2 .config console log report syz ci2-linux-4-19
2020/03/24 22:20 linux-4.19.y 14cfdbd39e31 68660b21 .config console log report syz ci2-linux-4-19
2020/03/24 07:43 linux-4.19.y 14cfdbd39e31 33e14df3 .config console log report syz ci2-linux-4-19
2020/03/23 20:46 linux-4.19.y 14cfdbd39e31 84f999d6 .config console log report syz ci2-linux-4-19
2020/03/23 14:18 linux-4.19.y 14cfdbd39e31 78267cec .config console log report syz ci2-linux-4-19
2020/03/22 07:27 linux-4.19.y 14cfdbd39e31 78267cec .config console log report syz ci2-linux-4-19
2020/03/21 15:12 linux-4.19.y 14cfdbd39e31 aa6c6a55 .config console log report syz ci2-linux-4-19
2020/03/21 10:32 linux-4.19.y 14cfdbd39e31 aa6c6a55 .config console log report syz ci2-linux-4-19
2020/03/21 05:57 linux-4.19.y 14cfdbd39e31 2c31c529 .config console log report syz ci2-linux-4-19
2020/03/19 06:58 linux-4.19.y 93556fb211fa 2c31c529 .config console log report syz ci2-linux-4-19
2020/03/04 19:37 linux-4.19.y a083db76118d 712198ac .config console log report syz ci2-linux-4-19
2020/02/26 11:27 linux-4.19.y f25804f38984 4f588111 .config console log report syz ci2-linux-4-19
2020/02/25 21:42 linux-4.19.y f25804f38984 4c886d6a .config console log report syz ci2-linux-4-19
2020/02/25 09:57 linux-4.19.y f25804f38984 59b57593 .config console log report syz ci2-linux-4-19
2020/02/25 04:27 linux-4.19.y f25804f38984 59b57593 .config console log report syz ci2-linux-4-19
2019/06/05 19:43 linux-4.19.y e109a984cf38 bfb4a51e .config console log report syz ci2-linux-4-19
2020/04/12 15:32 linux-4.19.y dda0e2920330 36b0b050 .config console log report ci2-linux-4-19
2020/04/10 00:39 linux-4.19.y dda0e2920330 a8c6a3f8 .config console log report ci2-linux-4-19
2020/04/09 12:26 linux-4.19.y dda0e2920330 a8c6a3f8 .config console log report ci2-linux-4-19
2020/04/07 21:01 linux-4.19.y dda0e2920330 db9bcd4b .config console log report ci2-linux-4-19
2020/04/07 16:28 linux-4.19.y dda0e2920330 99a96044 .config console log report ci2-linux-4-19
2020/04/01 01:43 linux-4.19.y 54b4fa6d3955 a34e2c33 .config console log report ci2-linux-4-19
2020/03/24 07:34 linux-4.19.y 14cfdbd39e31 33e14df3 .config console log report ci2-linux-4-19
2020/03/23 13:25 linux-4.19.y 14cfdbd39e31 78267cec .config console log report ci2-linux-4-19
2020/03/23 06:22 linux-4.19.y 14cfdbd39e31 78267cec .config console log report ci2-linux-4-19
2020/03/22 19:51 linux-4.19.y 14cfdbd39e31 78267cec .config console log report ci2-linux-4-19
2020/03/19 12:34 linux-4.19.y 93556fb211fa 2c31c529 .config console log report ci2-linux-4-19
2020/03/19 05:59 linux-4.19.y 93556fb211fa 2c31c529 .config console log report ci2-linux-4-19
2020/03/18 14:49 linux-4.19.y 93556fb211fa 0a96a13c .config console log report ci2-linux-4-19
2020/03/16 10:30 linux-4.19.y 339485c9a80f 749688d2 .config console log report ci2-linux-4-19
2020/03/12 22:20 linux-4.19.y 569209711609 d850e9d0 .config console log report ci2-linux-4-19
2020/03/06 20:39 linux-4.19.y 7472c4028e23 7fb694ef .config console log report ci2-linux-4-19
2020/03/04 05:19 linux-4.19.y a083db76118d 1f73b64b .config console log report ci2-linux-4-19
2020/03/01 02:15 linux-4.19.y a083db76118d c88c7b75 .config console log report ci2-linux-4-19
2020/02/23 13:57 linux-4.19.y 4fccc2503536 2c36e7a7 .config console log report ci2-linux-4-19
2020/02/09 21:53 linux-4.19.y b499cf4b3a90 35f5e45e .config console log report ci2-linux-4-19
2020/02/09 04:45 linux-4.19.y b499cf4b3a90 06150bf1 .config console log report ci2-linux-4-19
2020/02/07 11:13 linux-4.19.y b499cf4b3a90 06150bf1 .config console log report ci2-linux-4-19
2020/01/31 13:09 linux-4.19.y 7cdefde351b6 5ed23f9a .config console log report ci2-linux-4-19
2020/01/31 08:41 linux-4.19.y 7cdefde351b6 5ed23f9a .config console log report ci2-linux-4-19
2020/01/31 06:01 linux-4.19.y 7cdefde351b6 5ed23f9a .config console log report ci2-linux-4-19
2020/01/30 12:47 linux-4.19.y 7cdefde351b6 5ed23f9a .config console log report ci2-linux-4-19
2020/01/27 15:46 linux-4.19.y 88d6de67e390 56cd6c9b .config console log report ci2-linux-4-19
2020/01/26 23:41 linux-4.19.y d183c8e2647a dd56146d .config console log report ci2-linux-4-19
2020/01/26 02:29 linux-4.19.y d183c8e2647a f4e7270e .config console log report ci2-linux-4-19
2020/01/24 12:14 linux-4.19.y d183c8e2647a 2e95ab33 .config console log report ci2-linux-4-19
2020/01/22 23:34 linux-4.19.y dc4ba5be1bab 3334d684 .config console log report ci2-linux-4-19
2020/01/20 04:44 linux-4.19.y dc4ba5be1bab 0342f8c7 .config console log report ci2-linux-4-19
2020/01/16 20:19 linux-4.19.y db5b9190ff82 3de7aabb .config console log report ci2-linux-4-19
2020/01/13 01:09 linux-4.19.y dcd888983542 53faa9fe .config console log report ci2-linux-4-19
2020/01/12 14:56 linux-4.19.y dcd888983542 31290a45 .config console log report ci2-linux-4-19
2020/01/11 04:00 linux-4.19.y cb1f9a169a0e 4c04afaa .config console log report ci2-linux-4-19
2020/01/08 13:09 linux-4.19.y 3d40d7117e35 ddc3e859 .config console log report ci2-linux-4-19
2020/01/08 00:45 linux-4.19.y 3d40d7117e35 6738e0b3 .config console log report ci2-linux-4-19
2020/01/05 00:01 linux-4.19.y 3d40d7117e35 68256974 .config console log report ci2-linux-4-19
2019/12/16 16:50 linux-4.19.y 312017a460d5 0ae38e44 .config console log report ci2-linux-4-19
2019/12/14 05:25 linux-4.19.y 312017a460d5 a5c1ab05 .config console log report ci2-linux-4-19
* Struck through repros no longer work on HEAD.