syzbot


KASAN: use-after-free Write in __vb2_cleanup_fileio

Status: auto-closed as invalid on 2019/11/21 17:15
Reported-by: syzbot+5e99a821fd7364422b3a@syzkaller.appspotmail.com
First crash: 1784d, last: 1746d
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 2011d 2014d 13/26 fixed on 2019/11/07 18:45
linux-4.14 KASAN: use-after-free Write in __vb2_cleanup_fileio C error 2 1513d 1673d 0/1 upstream: reported C repro on 2019/10/06 01:28

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in __vb2_cleanup_fileio+0x149/0x170 drivers/media/common/videobuf2/videobuf2-core.c:2341
Write of size 4 at addr ffff8880a39acd80 by task syz-executor.3/20912

CPU: 1 PID: 20912 Comm: syz-executor.3 Not tainted 4.19.60 #33
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:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report mm/kasan/report.c:412 [inline]
 kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396
 __asan_report_store4_noabort+0x17/0x20 mm/kasan/report.c:437
 __vb2_cleanup_fileio+0x149/0x170 drivers/media/common/videobuf2/videobuf2-core.c:2341
 vb2_core_queue_release+0x20/0x80 drivers/media/common/videobuf2/videobuf2-core.c:2066
 vb2_queue_release drivers/media/common/videobuf2/videobuf2-v4l2.c:671 [inline]
 _vb2_fop_release+0x1cf/0x2a0 drivers/media/common/videobuf2/videobuf2-v4l2.c:842
 vb2_fop_release+0x75/0xc0 drivers/media/common/videobuf2/videobuf2-v4l2.c:856
 vivid_fop_release+0x18e/0x430 drivers/media/platform/vivid/vivid-core.c:474
 v4l2_release+0xf9/0x1a0 drivers/media/v4l2-core/v4l2-dev.c:448
 __fput+0x2dd/0x8b0 fs/file_table.c:278
 ____fput+0x16/0x20 fs/file_table.c:309
 task_work_run+0x145/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x273/0x2c0 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+0x53d/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x413511
Code: 75 14 b8 03 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 04 1b 00 00 c3 48 83 ec 08 e8 0a fc ff ff 48 89 04 24 b8 03 00 00 00 0f 05 <48> 8b 3c 24 48 89 c2 e8 53 fc ff ff 48 89 d0 48 83 c4 08 48 3d 01
RSP: 002b:00007ffe1c14c240 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000004 RCX: 0000000000413511
RDX: 0000001b31920000 RSI: 0000000000000000 RDI: 0000000000000003
RBP: 0000000000000001 R08: 00000000ffd1b30d R09: 00000000ffd1b311
R10: 00007ffe1c14c320 R11: 0000000000000293 R12: 000000000075bf20
R13: 0000000000065150 R14: 0000000000760140 R15: ffffffffffffffff

Allocated by task 20914:
 save_stack+0x45/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc mm/kasan/kasan.c:553 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:531
 kmem_cache_alloc_trace+0x152/0x760 mm/slab.c:3625
 kmalloc include/linux/slab.h:515 [inline]
 kzalloc include/linux/slab.h:709 [inline]
 __vb2_init_fileio+0x1cb/0xbe0 drivers/media/common/videobuf2/videobuf2-core.c:2250
 __vb2_perform_fileio+0xc9a/0x1170 drivers/media/common/videobuf2/videobuf2-core.c:2390
 vb2_read+0x3b/0x50 drivers/media/common/videobuf2/videobuf2-core.c:2522
 vb2_fop_read+0x212/0x410 drivers/media/common/videobuf2/videobuf2-v4l2.c:897
 v4l2_read+0x1cc/0x230 drivers/media/v4l2-core/v4l2-dev.c:317
 __vfs_read+0x114/0x800 fs/read_write.c:416
 vfs_read+0x194/0x3d0 fs/read_write.c:452
 ksys_read+0x14f/0x2d0 fs/read_write.c:579
kobject: (00000000b32f973b): dynamic_kobj_release
 __do_sys_read fs/read_write.c:589 [inline]
 __se_sys_read fs/read_write.c:587 [inline]
 __x64_sys_read+0x73/0xb0 fs/read_write.c:587
 do_syscall_64+0xfd/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 20911:
 save_stack+0x45/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3503 [inline]
 kfree+0xcf/0x220 mm/slab.c:3822
 __vb2_cleanup_fileio+0x100/0x170 drivers/media/common/videobuf2/videobuf2-core.c:2343
kobject: 'brif': free name
 vb2_core_queue_release+0x20/0x80 drivers/media/common/videobuf2/videobuf2-core.c:2066
 vb2_queue_release drivers/media/common/videobuf2/videobuf2-v4l2.c:671 [inline]
 _vb2_fop_release+0x1cf/0x2a0 drivers/media/common/videobuf2/videobuf2-v4l2.c:842
 vb2_fop_release+0x75/0xc0 drivers/media/common/videobuf2/videobuf2-v4l2.c:856
 vivid_fop_release+0x18e/0x430 drivers/media/platform/vivid/vivid-core.c:474
 v4l2_release+0xf9/0x1a0 drivers/media/v4l2-core/v4l2-dev.c:448
 __fput+0x2dd/0x8b0 fs/file_table.c:278
 ____fput+0x16/0x20 fs/file_table.c:309
kobject: 'loop1' (00000000d8d996a0): kobject_uevent_env
 task_work_run+0x145/0x1c0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:193 [inline]
 exit_to_usermode_loop+0x273/0x2c0 arch/x86/entry/common.c:167
kobject: 'loop1' (00000000d8d996a0): fill_kobj_path: path = '/devices/virtual/block/loop1'
 prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
 do_syscall_64+0x53d/0x620 arch/x86/entry/common.c:296
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880a39acd80
 which belongs to the cache kmalloc-1024 of size 1024
The buggy address is located 0 bytes inside of
 1024-byte region [ffff8880a39acd80, ffff8880a39ad180)
The buggy address belongs to the page:
page:ffffea00028e6b00 count:1 mapcount:0 mapping:ffff88812c3f0ac0 index:0xffff8880a39ac480 compound_mapcount: 0
flags: 0x1fffc0000008100(slab|head)
raw: 01fffc0000008100 ffffea0002256f08 ffffea0002a4bb08 ffff88812c3f0ac0
raw: ffff8880a39ac480 ffff8880a39ac000 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a39acc80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
kobject: 'loop5' (00000000ef135566): kobject_uevent_env
 ffff8880a39acd00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880a39acd80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff8880a39ace00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff8880a39ace80: 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/07/24 17:14 linux-4.19.y be9b6782a9eb 32329ceb .config console log report ci2-linux-4-19
2019/06/17 01:26 linux-4.19.y 7aa823a959e1 442206d7 .config console log report ci2-linux-4-19
* Struck through repros no longer work on HEAD.