syzbot


KASAN: use-after-free Write in virtio_transport_recv_pkt

Status: upstream: reported C repro on 2024/04/04 06:14
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+32815254c2c59b9b3d88@syzkaller.appspotmail.com
First crash: 194d, last: 37d
Fix bisection: failed (error log, bisect log)
  
Bug presence (4)
Date Name Commit Repro Result
2024/04/04 lts (merge base) 6139f2a02fe0 C [report] KASAN: use-after-free Write in virtio_transport_recv_pkt
2024/10/15 lts (merge base) 3a5928702e71 C Failed due to an error; will retry later
2024/04/04 upstream (ToT) c85af715cac0 C [report] KASAN: slab-use-after-free Write in virtio_transport_recv_pkt
2024/10/15 upstream (ToT) eca631b8fe80 C Failed due to an error; will retry later
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
android-5-10 KASAN: use-after-free Write in virtio_transport_recv_pkt C inconclusive 1 2d14h 194d 0/2 upstream: reported C repro on 2024/04/03 23:46
android-6-1 KASAN: use-after-free Write in virtio_transport_recv_pkt origin:upstream C 3 15d 194d 0/2 upstream: reported C repro on 2024/04/03 23:05
upstream KMSAN: uninit-value in virtio_transport_recv_pkt net C 20713 340d 354d 25/28 fixed on 2023/12/21 03:45
Last patch testing requests (1)
Created Duration User Patch Repo Result
2024/04/18 09:52 11m retest repro android13-5.15-lts report log
Fix bisection attempts (5)
Created Duration User Patch Repo Result
2024/10/15 01:07 0m bisect fix android13-5.15-lts error job log
2024/09/07 15:13 42m bisect fix android13-5.15-lts OK (0) job log log
2024/08/03 21:17 47m bisect fix android13-5.15-lts OK (0) job log log
2024/06/26 23:11 41m bisect fix android13-5.15-lts OK (0) job log log
2024/05/21 03:17 36m bisect fix android13-5.15-lts OK (0) job log log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: use-after-free in atomic_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:511 [inline]
BUG: KASAN: use-after-free in queued_spin_lock include/asm-generic/qspinlock.h:82 [inline]
BUG: KASAN: use-after-free in do_raw_spin_lock include/linux/spinlock.h:187 [inline]
BUG: KASAN: use-after-free in __raw_spin_lock_bh include/linux/spinlock_api_smp.h:136 [inline]
BUG: KASAN: use-after-free in _raw_spin_lock_bh+0x97/0x1b0 kernel/locking/spinlock.c:178
Write of size 4 at addr ffff888122444308 by task kworker/1:1/39

CPU: 1 PID: 39 Comm: kworker/1:1 Not tainted 5.15.148-syzkaller-00718-g993bed180178 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024
Workqueue: vsock-loopback vsock_loopback_work
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x151/0x1b7 lib/dump_stack.c:106
 print_address_description+0x87/0x3b0 mm/kasan/report.c:248
 __kasan_report mm/kasan/report.c:427 [inline]
 kasan_report+0x179/0x1c0 mm/kasan/report.c:444
 kasan_check_range+0x293/0x2a0 mm/kasan/generic.c:189
 __kasan_check_write+0x14/0x20 mm/kasan/shadow.c:37
 instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
 atomic_try_cmpxchg_acquire include/linux/atomic/atomic-instrumented.h:511 [inline]
 queued_spin_lock include/asm-generic/qspinlock.h:82 [inline]
 do_raw_spin_lock include/linux/spinlock.h:187 [inline]
 __raw_spin_lock_bh include/linux/spinlock_api_smp.h:136 [inline]
 _raw_spin_lock_bh+0x97/0x1b0 kernel/locking/spinlock.c:178
 spin_lock_bh include/linux/spinlock.h:368 [inline]
 virtio_transport_space_update net/vmw_vsock/virtio_transport_common.c:1174 [inline]
 virtio_transport_recv_pkt+0x6d0/0x4160 net/vmw_vsock/virtio_transport_common.c:1310
 vsock_loopback_work+0x37d/0x3f0 net/vmw_vsock/vsock_loopback.c:137
 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2325
 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2472
 kthread+0x421/0x510 kernel/kthread.c:337
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298
 </TASK>

Allocated by task 18371:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track mm/kasan/common.c:45 [inline]
 set_alloc_info mm/kasan/common.c:433 [inline]
 ____kasan_kmalloc+0xdb/0x110 mm/kasan/common.c:512
 __kasan_kmalloc+0x9/0x10 mm/kasan/common.c:521
 kasan_kmalloc include/linux/kasan.h:227 [inline]
 kmem_cache_alloc_trace+0x115/0x210 mm/slub.c:3267
 kmalloc include/linux/slab.h:603 [inline]
 kzalloc include/linux/slab.h:733 [inline]
 virtio_transport_do_socket_init+0x56/0x2d0 net/vmw_vsock/virtio_transport_common.c:604
 vsock_assign_transport+0x473/0x5b0 net/vmw_vsock/af_vsock.c:496
 vsock_connect+0x5cf/0xd30 net/vmw_vsock/af_vsock.c:1340
 __sys_connect_file net/socket.c:1918 [inline]
 __sys_connect+0x38b/0x410 net/socket.c:1935
 __do_sys_connect net/socket.c:1945 [inline]
 __se_sys_connect net/socket.c:1942 [inline]
 __x64_sys_connect+0x7a/0x90 net/socket.c:1942
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 18371:
 kasan_save_stack mm/kasan/common.c:38 [inline]
 kasan_set_track+0x4b/0x70 mm/kasan/common.c:45
 kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
 ____kasan_slab_free+0x126/0x160 mm/kasan/common.c:365
 __kasan_slab_free+0x11/0x20 mm/kasan/common.c:373
 kasan_slab_free include/linux/kasan.h:193 [inline]
 slab_free_hook mm/slub.c:1723 [inline]
 slab_free_freelist_hook+0xbd/0x190 mm/slub.c:1749
 slab_free mm/slub.c:3519 [inline]
 kfree+0xc8/0x220 mm/slub.c:4579
 virtio_transport_destruct+0x3b/0x40 net/vmw_vsock/virtio_transport_common.c:818
 vsock_deassign_transport net/vmw_vsock/af_vsock.c:411 [inline]
 vsock_assign_transport+0x32b/0x5b0 net/vmw_vsock/af_vsock.c:479
 vsock_connect+0x5cf/0xd30 net/vmw_vsock/af_vsock.c:1340
 __sys_connect_file net/socket.c:1918 [inline]
 __sys_connect+0x38b/0x410 net/socket.c:1935
 __do_sys_connect net/socket.c:1945 [inline]
 __se_sys_connect net/socket.c:1942 [inline]
 __x64_sys_connect+0x7a/0x90 net/socket.c:1942
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb

The buggy address belongs to the object at ffff888122444300
 which belongs to the cache kmalloc-96 of size 96
The buggy address is located 8 bytes inside of
 96-byte region [ffff888122444300, ffff888122444360)
The buggy address belongs to the page:
page:ffffea0004891100 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x122444
flags: 0x4000000000000200(slab|zone=1)
raw: 4000000000000200 0000000000000000 0000001f00000001 ffff888100042900
raw: 0000000000000000 0000000000200020 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12cc0(GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY), pid 290, ts 29441834490, free_ts 29441365925
 set_page_owner include/linux/page_owner.h:33 [inline]
 post_alloc_hook+0x1a3/0x1b0 mm/page_alloc.c:2604
 prep_new_page+0x1b/0x110 mm/page_alloc.c:2610
 get_page_from_freelist+0x3550/0x35d0 mm/page_alloc.c:4484
 __alloc_pages+0x27e/0x8f0 mm/page_alloc.c:5776
 allocate_slab mm/slub.c:1932 [inline]
 new_slab+0x9a/0x4e0 mm/slub.c:1995
 ___slab_alloc+0x39e/0x830 mm/slub.c:3028
 __slab_alloc+0x4a/0x90 mm/slub.c:3115
 slab_alloc_node mm/slub.c:3206 [inline]
 slab_alloc mm/slub.c:3248 [inline]
 kmem_cache_alloc_trace+0x142/0x210 mm/slub.c:3265
 kmalloc include/linux/slab.h:603 [inline]
 kzalloc include/linux/slab.h:733 [inline]
 mmu_notifier_subscriptions_init include/linux/mmu_notifier.h:516 [inline]
 mm_init+0x39a/0x970 kernel/fork.c:1122
 dup_mm kernel/fork.c:1518 [inline]
 copy_mm+0x1e3/0x13e0 kernel/fork.c:1573
 copy_process+0x1149/0x3290 kernel/fork.c:2264
 kernel_clone+0x21e/0x9e0 kernel/fork.c:2662
 __do_sys_clone kernel/fork.c:2788 [inline]
 __se_sys_clone kernel/fork.c:2772 [inline]
 __x64_sys_clone+0x23f/0x290 kernel/fork.c:2772
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:26 [inline]
 free_pages_prepare mm/page_alloc.c:1471 [inline]
 free_pcp_prepare mm/page_alloc.c:1543 [inline]
 free_unref_page_prepare+0x7c8/0x7d0 mm/page_alloc.c:3533
 free_unref_page+0xe8/0x750 mm/page_alloc.c:3615
 free_the_page mm/page_alloc.c:804 [inline]
 __free_pages+0x61/0xf0 mm/page_alloc.c:5852
 __vunmap+0x7bc/0x8f0 mm/vmalloc.c:2652
 free_work+0x5b/0x80 mm/vmalloc.c:96
 process_one_work+0x6bb/0xc10 kernel/workqueue.c:2325
 worker_thread+0xad5/0x12a0 kernel/workqueue.c:2472
 kthread+0x421/0x510 kernel/kthread.c:337
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

Memory state around the buggy address:
 ffff888122444200: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff888122444280: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
>ffff888122444300: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
                      ^
 ffff888122444380: fa fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc
 ffff888122444400: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc
==================================================================

Crashes (1):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2024/04/04 06:12 android13-5.15-lts 993bed180178 51c4dcff .config console log report syz C [disk image] [vmlinux] [kernel image] ci2-android-5-15 KASAN: use-after-free Write in virtio_transport_recv_pkt
* Struck through repros no longer work on HEAD.