syzbot


KASAN: use-after-free Write in __vb2_cleanup_fileio

Status: upstream: reported C repro on 2019/10/06 01:28
Reported-by: syzbot+e76a7c3ee3b39853689e@syzkaller.appspotmail.com
First crash: 1724d, last: 1564d
Fix bisection: failed (error log, bisect log)
  
Similar bugs (2)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Write in __vb2_cleanup_fileio media C done inconclusive 2 2062d 2065d 13/27 fixed on 2019/11/07 18:45
linux-4.19 KASAN: use-after-free Write in __vb2_cleanup_fileio 2 1797d 1835d 0/1 auto-closed as invalid on 2019/11/21 17:15
Last patch testing requests (2)
Created Duration User Patch Repo Result
2022/12/07 17:31 9m retest repro linux-4.14.y report log
2022/08/27 18:27 10m retest repro linux-4.14.y report log
Fix bisection attempts (5)
Created Duration User Patch Repo Result
2020/04/12 11:19 20m bisect fix linux-4.14.y error job log (0)
2020/03/13 10:50 28m bisect fix linux-4.14.y job log (0) log
2020/02/12 10:23 27m bisect fix linux-4.14.y job log (0) log
2020/01/13 09:42 27m bisect fix linux-4.14.y job log (0) log
2019/12/14 09:15 27m bisect fix linux-4.14.y job log (0) log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __vb2_cleanup_fileio+0x134/0x150 drivers/media/v4l2-core/videobuf2-core.c:2315
Write of size 4 at addr ffff8880a1f92040 by task syz-executor042/7328

CPU: 0 PID: 7328 Comm: syz-executor042 Not tainted 4.14.151 #0
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+0x138/0x197 lib/dump_stack.c:53
 print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report mm/kasan/report.c:409 [inline]
 kasan_report.cold+0xa9/0x2af mm/kasan/report.c:393
 __asan_report_store4_noabort+0x17/0x20 mm/kasan/report.c:434
 __vb2_cleanup_fileio+0x134/0x150 drivers/media/v4l2-core/videobuf2-core.c:2315
 vb2_core_queue_release+0x1d/0x80 drivers/media/v4l2-core/videobuf2-core.c:2040
 vb2_queue_release drivers/media/v4l2-core/videobuf2-v4l2.c:669 [inline]
 _vb2_fop_release+0x1cf/0x2a0 drivers/media/v4l2-core/videobuf2-v4l2.c:840
 vb2_fop_release+0x75/0xc0 drivers/media/v4l2-core/videobuf2-v4l2.c:854
 vivid_fop_release+0x180/0x3f0 drivers/media/platform/vivid/vivid-core.c:486
 v4l2_release+0xf9/0x190 drivers/media/v4l2-core/v4l2-dev.c:446
 __fput+0x275/0x7a0 fs/file_table.c:210
 ____fput+0x16/0x20 fs/file_table.c:244
 task_work_run+0x114/0x190 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x1da/0x220 arch/x86/entry/common.c:164
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
 do_syscall_64+0x4bc/0x640 arch/x86/entry/common.c:297
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x44d059
RSP: 002b:00007fd168296ce8 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 00000000006e5a08 RCX: 000000000044d059
RDX: 000000000044d059 RSI: 0000000000000000 RDI: 0000000000000005
RBP: 00000000006e5a00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000006e5a0c
R13: 00007fffe975cc8f R14: 00007fd1682979c0 R15: 20c49ba5e353f7cf

Allocated by task 7329:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc mm/kasan/kasan.c:551 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
 kmem_cache_alloc_trace+0x152/0x790 mm/slab.c:3618
 kmalloc include/linux/slab.h:488 [inline]
 kzalloc include/linux/slab.h:661 [inline]
 __vb2_init_fileio+0x182/0xa90 drivers/media/v4l2-core/videobuf2-core.c:2224
 __vb2_perform_fileio+0x9f0/0xeb0 drivers/media/v4l2-core/videobuf2-core.c:2358
 vb2_read+0x3b/0x50 drivers/media/v4l2-core/videobuf2-core.c:2490
 vb2_fop_read+0x1f5/0x3e0 drivers/media/v4l2-core/videobuf2-v4l2.c:895
 v4l2_read+0x1a9/0x200 drivers/media/v4l2-core/v4l2-dev.c:309
 __vfs_read+0x105/0x6a0 fs/read_write.c:411
 vfs_read+0x137/0x350 fs/read_write.c:447
 SYSC_read fs/read_write.c:574 [inline]
 SyS_read+0xfd/0x230 fs/read_write.c:567
 do_syscall_64+0x1e8/0x640 arch/x86/entry/common.c:292
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 7329:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kfree+0xcc/0x270 mm/slab.c:3815
 __vb2_cleanup_fileio+0xfc/0x150 drivers/media/v4l2-core/videobuf2-core.c:2317
 vb2_core_queue_release+0x1d/0x80 drivers/media/v4l2-core/videobuf2-core.c:2040
 vb2_queue_release drivers/media/v4l2-core/videobuf2-v4l2.c:669 [inline]
 _vb2_fop_release+0x1cf/0x2a0 drivers/media/v4l2-core/videobuf2-v4l2.c:840
 vb2_fop_release+0x75/0xc0 drivers/media/v4l2-core/videobuf2-v4l2.c:854
 vivid_fop_release+0x180/0x3f0 drivers/media/platform/vivid/vivid-core.c:486
 v4l2_release+0xf9/0x190 drivers/media/v4l2-core/v4l2-dev.c:446
 __fput+0x275/0x7a0 fs/file_table.c:210
 ____fput+0x16/0x20 fs/file_table.c:244
 task_work_run+0x114/0x190 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:191 [inline]
 exit_to_usermode_loop+0x1da/0x220 arch/x86/entry/common.c:164
 prepare_exit_to_usermode arch/x86/entry/common.c:199 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:270 [inline]
 do_syscall_64+0x4bc/0x640 arch/x86/entry/common.c:297
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

The buggy address belongs to the object at ffff8880a1f92040
 which belongs to the cache kmalloc-1024 of size 1024
The buggy address is located 0 bytes inside of
 1024-byte region [ffff8880a1f92040, ffff8880a1f92440)
The buggy address belongs to the page:
page:ffffea000287e480 count:1 mapcount:0 mapping:ffff8880a1f92040 index:0x0 compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffff8880a1f92040 0000000000000000 0000000100000007
raw: ffffea00024b59a0 ffffea000272f420 ffff8880aa800ac0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a1f91f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880a1f91f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880a1f92000: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
                                           ^
 ffff8880a1f92080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a1f92100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/11/05 15:22 linux-4.14.y ddef1e8e3f6e af5c522d .config console log report syz C ci2-linux-4-14
2019/10/06 00:27 linux-4.14.y db1892238c55 f3f7d9c8 .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.