syzbot


KASAN: use-after-free Read in rdma_resolve_route

Status: auto-obsoleted due to no activity on 2024/01/01 19:36
Reported-by: syzbot+cdeb4c27df2484bb5317@syzkaller.appspotmail.com
First crash: 426d, last: 426d
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.14 general protection fault in rdma_resolve_route C error 9 915d 1874d 0/1 upstream: reported C repro on 2019/10/06 23:21
upstream KASAN: slab-use-after-free Read in rdma_resolve_route rdma 1 277d 273d 0/28 auto-obsoleted due to no activity on 2024/05/05 10:09

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in compare_netdev_and_ip drivers/infiniband/core/cma.c:473 [inline]
BUG: KASAN: use-after-free in cma_add_id_to_tree drivers/infiniband/core/cma.c:513 [inline]
BUG: KASAN: use-after-free in rdma_resolve_route+0x1d5c/0x2924 drivers/infiniband/core/cma.c:3355
Read of size 4 at addr ffff0000c908e184 by task syz-executor.0/8325

CPU: 1 PID: 8325 Comm: syz-executor.0 Not tainted 6.1.55-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 08/04/2023
Call trace:
 dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
 show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
 print_address_description mm/kasan/report.c:284 [inline]
 print_report+0x174/0x4c0 mm/kasan/report.c:395
 kasan_report+0xd4/0x130 mm/kasan/report.c:495
 __asan_report_load4_noabort+0x2c/0x38 mm/kasan/report_generic.c:350
 compare_netdev_and_ip drivers/infiniband/core/cma.c:473 [inline]
 cma_add_id_to_tree drivers/infiniband/core/cma.c:513 [inline]
 rdma_resolve_route+0x1d5c/0x2924 drivers/infiniband/core/cma.c:3355
 ucma_resolve_route+0x22c/0x428 drivers/infiniband/core/ucma.c:746
 ucma_write+0x324/0x47c drivers/infiniband/core/ucma.c:1744
 vfs_write+0x2a4/0x914 fs/read_write.c:582
 ksys_write+0x15c/0x26c fs/read_write.c:637
 __do_sys_write fs/read_write.c:649 [inline]
 __se_sys_write fs/read_write.c:646 [inline]
 __arm64_sys_write+0x7c/0x90 fs/read_write.c:646
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

Allocated by task 8314:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505
 ____kasan_kmalloc mm/kasan/common.c:374 [inline]
 __kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383
 kasan_kmalloc include/linux/kasan.h:211 [inline]
 kmalloc_trace+0x7c/0x94 mm/slab_common.c:1050
 kmalloc include/linux/slab.h:553 [inline]
 kzalloc include/linux/slab.h:689 [inline]
 __rdma_create_id+0x74/0x478 drivers/infiniband/core/cma.c:972
 rdma_create_user_id+0x88/0xc8 drivers/infiniband/core/cma.c:1028
 ucma_create_id+0x2cc/0x5dc drivers/infiniband/core/ucma.c:464
 ucma_write+0x324/0x47c drivers/infiniband/core/ucma.c:1744
 vfs_write+0x2a4/0x914 fs/read_write.c:582
 ksys_write+0x15c/0x26c fs/read_write.c:637
 __do_sys_write fs/read_write.c:649 [inline]
 __se_sys_write fs/read_write.c:646 [inline]
 __arm64_sys_write+0x7c/0x90 fs/read_write.c:646
 __invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
 invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
 el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
 do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
 el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

Freed by task 8308:
 kasan_save_stack mm/kasan/common.c:45 [inline]
 kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
 kasan_save_free_info+0x38/0x5c mm/kasan/generic.c:516
 ____kasan_slab_free+0x144/0x1c0 mm/kasan/common.c:236
 __kasan_slab_free+0x18/0x28 mm/kasan/common.c:244
 kasan_slab_free include/linux/kasan.h:177 [inline]
 slab_free_hook mm/slub.c:1724 [inline]
 slab_free_freelist_hook mm/slub.c:1750 [inline]
 slab_free mm/slub.c:3661 [inline]
 __kmem_cache_free+0x2c0/0x4b4 mm/slub.c:3674
 kfree+0xcc/0x1b8 mm/slab_common.c:1007
 _destroy_id+0xc2c/0xf08 drivers/infiniband/core/cma.c:2039
 destroy_id_handler_unlock+0xe0/0x17c drivers/infiniband/core/cma.c:2066
 rdma_destroy_id+0x2c/0x3c drivers/infiniband/core/cma.c:2075
 ucma_close_id+0xac/0x10c drivers/infiniband/core/ucma.c:187
 ucma_destroy_private_ctx+0xd0/0x940 drivers/infiniband/core/ucma.c:579
 ucma_close+0xfc/0x16c drivers/infiniband/core/ucma.c:1809
 __fput+0x30c/0x7bc fs/file_table.c:320
 ____fput+0x20/0x30 fs/file_table.c:348
 task_work_run+0x240/0x2f0 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 do_notify_resume+0x2144/0x3470 arch/arm64/kernel/signal.c:1132
 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
 exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
 el0_svc+0x9c/0x168 arch/arm64/kernel/entry-common.c:638
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

Last potentially related work creation:
 kasan_save_stack+0x40/0x70 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:486
 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:496
 insert_work+0x64/0x384 kernel/workqueue.c:1361
 __queue_work+0xd48/0x136c kernel/workqueue.c:1520
 queue_work_on+0xc0/0x16c kernel/workqueue.c:1548
 queue_work include/linux/workqueue.h:504 [inline]
 io_ring_ctx_wait_and_kill+0x290/0x2f4 io_uring/io_uring.c:2866
 io_uring_release+0x5c/0x74 io_uring/io_uring.c:2874
 __fput+0x30c/0x7bc fs/file_table.c:320
 ____fput+0x20/0x30 fs/file_table.c:348
 task_work_run+0x240/0x2f0 kernel/task_work.c:179
 exit_task_work include/linux/task_work.h:38 [inline]
 do_exit+0x554/0x1a88 kernel/exit.c:869
 do_group_exit+0x194/0x22c kernel/exit.c:1019
 get_signal+0x14a0/0x158c kernel/signal.c:2862
 do_signal arch/arm64/kernel/signal.c:1076 [inline]
 do_notify_resume+0x3ac/0x3470 arch/arm64/kernel/signal.c:1129
 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
 exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
 el0_svc+0x9c/0x168 arch/arm64/kernel/entry-common.c:638
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

Second to last potentially related work creation:
 kasan_save_stack+0x40/0x70 mm/kasan/common.c:45
 __kasan_record_aux_stack+0xcc/0xe8 mm/kasan/generic.c:486
 kasan_record_aux_stack_noalloc+0x14/0x20 mm/kasan/generic.c:496
 call_rcu+0xfc/0xa40 kernel/rcu/tree.c:2799
 netlink_release+0x11d0/0x16e0 net/netlink/af_netlink.c:815
 __sock_release net/socket.c:652 [inline]
 sock_close+0xb8/0x1fc net/socket.c:1370
 __fput+0x30c/0x7bc fs/file_table.c:320
 ____fput+0x20/0x30 fs/file_table.c:348
 task_work_run+0x240/0x2f0 kernel/task_work.c:179
 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
 do_notify_resume+0x2144/0x3470 arch/arm64/kernel/signal.c:1132
 prepare_exit_to_user_mode arch/arm64/kernel/entry-common.c:137 [inline]
 exit_to_user_mode arch/arm64/kernel/entry-common.c:142 [inline]
 el0_svc+0x9c/0x168 arch/arm64/kernel/entry-common.c:638
 el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
 el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

The buggy address belongs to the object at ffff0000c908e000
 which belongs to the cache kmalloc-2k of size 2048
The buggy address is located 388 bytes inside of
 2048-byte region [ffff0000c908e000, ffff0000c908e800)

The buggy address belongs to the physical page:
page:00000000cec606a1 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x109088
head:00000000cec606a1 order:3 compound_mapcount:0 compound_pincount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 dead000000000100 dead000000000122 ffff0000c0002900
raw: 0000000000000000 0000000000080008 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff0000c908e080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000c908e100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff0000c908e180: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff0000c908e200: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff0000c908e280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/09/23 19:35 linux-6.1.y d23900f974e0 0b6a67ac .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 KASAN: use-after-free Read in rdma_resolve_route
* Struck through repros no longer work on HEAD.