syzbot


KASAN: use-after-free Read in v4l2_release (3)

Status: upstream: reported C repro on 2020/01/08 20:24
Reported-by: syzbot+75287f75e2fedd69d680@syzkaller.appspotmail.com
First crash: 1124d, last: 568d

Cause bisection: failed (bisect log)

Fix bisection: failed (bisect log)
similar bugs (2):
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream KASAN: use-after-free Read in v4l2_release C 275 1288d 1392d 13/24 fixed on 2019/08/05 13:45
upstream KASAN: use-after-free Read in v4l2_release (2) 9 1153d 1231d 0/24 closed as dup on 2019/09/23 15:12
Last patch testing requests:
Created Duration User Patch Repo Result
2023/01/16 12:32 16m retest repro https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing OK log
2023/01/16 03:32 21m retest repro https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing OK log
2023/01/16 02:32 17m retest repro https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing OK log
2023/01/15 16:32 19m retest repro https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing OK log
2023/01/15 08:32 21m retest repro https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing OK log
2023/01/14 21:32 17m retest repro https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing OK log
2022/10/09 15:30 17m retest repro linux-next error
2022/09/30 05:30 15m retest repro upstream OK log
2022/09/04 22:27 16m retest repro https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing error
2022/09/04 21:27 16m retest repro https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing error
2020/01/24 12:41 12m andreyknvl@google.com patch https://github.com/google/kasan.git ae179410 report log

Sample crash report:
==================================================================
BUG: KASAN: use-after-free in v4l2_release+0x326/0x3b0 drivers/media/v4l2-core/v4l2-dev.c:453
Read of size 8 at addr ffff88802d4d4398 by task v4l_id/16073

CPU: 1 PID: 16073 Comm: v4l_id Tainted: G        W         5.14.0-rc1-next-20210715-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:105
 print_address_description.constprop.0.cold+0x6c/0x309 mm/kasan/report.c:233
 __kasan_report mm/kasan/report.c:419 [inline]
 kasan_report.cold+0x83/0xdf mm/kasan/report.c:436
 v4l2_release+0x326/0x3b0 drivers/media/v4l2-core/v4l2-dev.c:453
 __fput+0x288/0x920 fs/file_table.c:280
 task_work_run+0xdd/0x1a0 kernel/task_work.c:164
 tracehook_notify_resume include/linux/tracehook.h:189 [inline]
 exit_to_user_mode_loop kernel/entry/common.c:175 [inline]
 exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:209
 __syscall_exit_to_user_mode_work kernel/entry/common.c:291 [inline]
 syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:302
 do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7f1d926b2270
Code: 73 01 c3 48 8b 0d 38 7d 20 00 f7 d8 64 89 01 48 83 c8 ff c3 66 0f 1f 44 00 00 83 3d 59 c1 20 00 00 75 10 b8 03 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 31 c3 48 83 ec 08 e8 ee fb ff ff 48 89 04 24
RSP: 002b:00007ffeb7bbd158 EFLAGS: 00000246 ORIG_RAX: 0000000000000003
RAX: 0000000000000000 RBX: 0000000000000003 RCX: 00007f1d926b2270
RDX: 000000000000000a RSI: 00007f1d9269e760 RDI: 0000000000000003
RBP: 00007f1d92ce3698 R08: 00007f1d9269e760 R09: 00007f1d92ce3700
R10: 0000564494fe4ee3 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffeb7bbd2e0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 7:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track mm/kasan/common.c:46 [inline]
 set_alloc_info mm/kasan/common.c:434 [inline]
 ____kasan_kmalloc mm/kasan/common.c:513 [inline]
 ____kasan_kmalloc mm/kasan/common.c:472 [inline]
 __kasan_kmalloc+0x9b/0xd0 mm/kasan/common.c:522
 kmalloc include/linux/slab.h:591 [inline]
 kzalloc include/linux/slab.h:721 [inline]
 stk_camera_probe+0x7d/0xc50 drivers/media/usb/stkwebcam/stk-webcam.c:1281
 usb_probe_interface+0x315/0x7f0 drivers/usb/core/driver.c:396
 call_driver_probe drivers/base/dd.c:517 [inline]
 really_probe+0x23c/0xcd0 drivers/base/dd.c:595
 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:747
 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:777
 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:894
 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427
 __device_attach+0x228/0x4a0 drivers/base/dd.c:965
 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487
 device_add+0xc2f/0x2180 drivers/base/core.c:3356
 usb_set_configuration+0x113f/0x1910 drivers/usb/core/message.c:2170
 usb_generic_driver_probe+0xba/0x100 drivers/usb/core/generic.c:238
 usb_probe_device+0xd9/0x2c0 drivers/usb/core/driver.c:293
 call_driver_probe drivers/base/dd.c:517 [inline]
 really_probe+0x23c/0xcd0 drivers/base/dd.c:595
 __driver_probe_device+0x338/0x4d0 drivers/base/dd.c:747
 driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:777
 __device_attach_driver+0x20b/0x2f0 drivers/base/dd.c:894
 bus_for_each_drv+0x15f/0x1e0 drivers/base/bus.c:427
 __device_attach+0x228/0x4a0 drivers/base/dd.c:965
 bus_probe_device+0x1e4/0x290 drivers/base/bus.c:487
 device_add+0xc2f/0x2180 drivers/base/core.c:3356
 usb_new_device.cold+0x63f/0x108e drivers/usb/core/hub.c:2559
 hub_port_connect drivers/usb/core/hub.c:5300 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5440 [inline]
 port_event drivers/usb/core/hub.c:5586 [inline]
 hub_event+0x2357/0x4330 drivers/usb/core/hub.c:5668
 process_one_work+0x98d/0x1630 kernel/workqueue.c:2276
 worker_thread+0x658/0x11f0 kernel/workqueue.c:2422
 kthread+0x3e5/0x4d0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

Freed by task 5:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:38
 kasan_set_track+0x1c/0x30 mm/kasan/common.c:46
 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:360
 ____kasan_slab_free mm/kasan/common.c:366 [inline]
 ____kasan_slab_free mm/kasan/common.c:328 [inline]
 __kasan_slab_free+0xfb/0x130 mm/kasan/common.c:374
 kasan_slab_free include/linux/kasan.h:229 [inline]
 slab_free_hook mm/slub.c:1650 [inline]
 slab_free_freelist_hook+0xdf/0x240 mm/slub.c:1675
 slab_free mm/slub.c:3235 [inline]
 kfree+0xeb/0x650 mm/slub.c:4295
 usb_unbind_interface+0x1d8/0x8d0 drivers/usb/core/driver.c:458
 __device_release_driver+0x3bd/0x6f0 drivers/base/dd.c:1201
 device_release_driver_internal drivers/base/dd.c:1232 [inline]
 device_release_driver+0x26/0x40 drivers/base/dd.c:1255
 bus_remove_device+0x2eb/0x5a0 drivers/base/bus.c:529
 device_del+0x502/0xd40 drivers/base/core.c:3544
 usb_disable_device+0x35b/0x7b0 drivers/usb/core/message.c:1419
 usb_disconnect.cold+0x27a/0x78e drivers/usb/core/hub.c:2221
 hub_port_connect drivers/usb/core/hub.c:5151 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5440 [inline]
 port_event drivers/usb/core/hub.c:5586 [inline]
 hub_event+0x1c9c/0x4330 drivers/usb/core/hub.c:5668
 process_one_work+0x98d/0x1630 kernel/workqueue.c:2276
 worker_thread+0x658/0x11f0 kernel/workqueue.c:2422
 kthread+0x3e5/0x4d0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295

The buggy address belongs to the object at ffff88802d4d4000
 which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 920 bytes inside of
 4096-byte region [ffff88802d4d4000, ffff88802d4d5000)
The buggy address belongs to the page:
page:ffffea0000b53400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x2d4d0
head:ffffea0000b53400 order:3 compound_mapcount:0 compound_pincount:0
flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff)
raw: 00fff00000010200 dead000000000100 dead000000000122 ffff888010842140
raw: 0000000000000000 0000000000040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, ts 51952398454, free_ts 51935751628
 prep_new_page mm/page_alloc.c:2433 [inline]
 get_page_from_freelist+0xa72/0x2f80 mm/page_alloc.c:4166
 __alloc_pages+0x1b2/0x500 mm/page_alloc.c:5374
 alloc_pages+0x18c/0x2a0 mm/mempolicy.c:2244
 alloc_slab_page mm/slub.c:1713 [inline]
 allocate_slab+0x32b/0x4c0 mm/slub.c:1853
 new_slab mm/slub.c:1916 [inline]
 new_slab_objects mm/slub.c:2662 [inline]
 ___slab_alloc+0x4ba/0x820 mm/slub.c:2825
 __slab_alloc.constprop.0+0xa7/0xf0 mm/slub.c:2865
 slab_alloc_node mm/slub.c:2947 [inline]
 slab_alloc mm/slub.c:2989 [inline]
 __kmalloc+0x312/0x330 mm/slub.c:4133
 kmalloc include/linux/slab.h:596 [inline]
 tomoyo_realpath_from_path+0xc3/0x620 security/tomoyo/realpath.c:254
 tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
 tomoyo_path_perm+0x21b/0x400 security/tomoyo/file.c:822
 security_inode_getattr+0xcf/0x140 security/security.c:1332
 vfs_getattr fs/stat.c:139 [inline]
 vfs_statx+0x164/0x390 fs/stat.c:207
 vfs_fstatat fs/stat.c:225 [inline]
 vfs_lstat include/linux/fs.h:3387 [inline]
 __do_sys_newlstat+0x91/0x110 fs/stat.c:380
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
page last free stack trace:
 reset_page_owner include/linux/page_owner.h:24 [inline]
 free_pages_prepare mm/page_alloc.c:1343 [inline]
 free_pcp_prepare+0x312/0x7d0 mm/page_alloc.c:1394
 free_unref_page_prepare mm/page_alloc.c:3329 [inline]
 free_unref_page+0x19/0x690 mm/page_alloc.c:3408
 qlink_free mm/kasan/quarantine.c:146 [inline]
 qlist_free_all+0x5a/0xc0 mm/kasan/quarantine.c:165
 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:272
 __kasan_slab_alloc+0x8e/0xa0 mm/kasan/common.c:444
 kasan_slab_alloc include/linux/kasan.h:253 [inline]
 slab_post_alloc_hook mm/slab.h:512 [inline]
 slab_alloc_node mm/slub.c:2981 [inline]
 slab_alloc mm/slub.c:2989 [inline]
 kmem_cache_alloc+0x216/0x3a0 mm/slub.c:2994
 getname_flags.part.0+0x50/0x4f0 fs/namei.c:138
 getname_flags fs/namei.c:2747 [inline]
 user_path_at_empty+0xa1/0x100 fs/namei.c:2747
 user_path_at include/linux/namei.h:57 [inline]
 user_statfs+0x86/0x160 fs/statfs.c:103
 __do_sys_statfs+0x7a/0xf0 fs/statfs.c:195
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae

Memory state around the buggy address:
 ffff88802d4d4280: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88802d4d4300: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88802d4d4380: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                            ^
 ffff88802d4d4400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff88802d4d4480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (34):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-linux-next-kasan-gce-root 2021/07/17 20:01 linux-next c1a6d08348fc f115ae98 .config console log report syz KASAN: use-after-free Read in v4l2_release
ci2-upstream-usb 2020/07/06 07:12 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 768a07412843 ac5a135b .config console log report syz C
ci2-upstream-usb 2020/05/30 01:00 https://github.com/google/kasan.git usb-fuzzer 2089c6ed5a17 bed08304 .config console log report syz C
ci2-upstream-usb 2020/05/14 14:23 https://github.com/google/kasan.git usb-fuzzer 059e7e0ff26c 2d572622 .config console log report syz C
ci2-upstream-usb 2020/05/14 13:37 https://github.com/google/kasan.git usb-fuzzer 059e7e0ff26c 2d572622 .config console log report syz C
ci2-upstream-usb 2020/01/22 22:58 https://github.com/google/kasan.git usb-fuzzer 4cc301ee04d9 3334d684 .config console log report syz C
ci-upstream-kasan-gce-root 2021/05/28 06:57 upstream 97e5bf604b7a 858ea628 .config console log report syz KASAN: use-after-free Read in v4l2_release
ci2-upstream-usb 2020/12/15 01:13 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing a256e24021bf 97183ed7 .config console log report syz
ci2-upstream-usb 2021/02/05 13:10 https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing 23e32a595e11 23a562df .config console log report info KASAN: use-after-free Read in v4l2_release
ci-upstream-kasan-gce-386 2020/12/09 00:18 upstream 7d8761ba27fc a7f7f4a4 .config console log report info
ci2-upstream-usb 2020/05/14 22:28 https://github.com/google/kasan.git usb-fuzzer 059e7e0ff26c 2d572622 .config console log report
ci2-upstream-usb 2020/05/14 21:51 https://github.com/google/kasan.git usb-fuzzer 059e7e0ff26c 2d572622 .config console log report
ci2-upstream-usb 2020/05/14 17:32 https://github.com/google/kasan.git usb-fuzzer 059e7e0ff26c 2d572622 .config console log report
ci2-upstream-usb 2020/05/14 14:16 https://github.com/google/kasan.git usb-fuzzer 059e7e0ff26c 2d572622 .config console log report
ci2-upstream-usb 2020/05/14 12:12 https://github.com/google/kasan.git usb-fuzzer 059e7e0ff26c 2d572622 .config console log report
ci2-upstream-usb 2020/05/14 08:20 https://github.com/google/kasan.git usb-fuzzer 059e7e0ff26c a885920d .config console log report
ci2-upstream-usb 2020/02/07 13:56 https://github.com/google/kasan.git usb-fuzzer e5cd56e94edd 06150bf1 .config console log report
ci2-upstream-usb 2020/02/04 11:00 https://github.com/google/kasan.git usb-fuzzer cd234325a5f1 93e5e335 .config console log report
ci2-upstream-usb 2020/02/03 14:38 https://github.com/google/kasan.git usb-fuzzer cd234325a5f1 93e5e335 .config console log report
ci2-upstream-usb 2020/02/02 21:24 https://github.com/google/kasan.git usb-fuzzer cd234325a5f1 93e5e335 .config console log report
ci2-upstream-usb 2020/02/02 17:33 https://github.com/google/kasan.git usb-fuzzer cd234325a5f1 93e5e335 .config console log report
ci2-upstream-usb 2020/02/01 20:10 https://github.com/google/kasan.git usb-fuzzer cd234325a5f1 326d4c78 .config console log report
ci2-upstream-usb 2020/01/31 00:15 https://github.com/google/kasan.git usb-fuzzer cd234325a5f1 5ed23f9a .config console log report
ci2-upstream-usb 2020/01/30 15:48 https://github.com/google/kasan.git usb-fuzzer cd234325a5f1 5ed23f9a .config console log report
ci2-upstream-usb 2020/01/29 19:39 https://github.com/google/kasan.git usb-fuzzer cd234325a5f1 5ed23f9a .config console log report
ci2-upstream-usb 2020/01/29 16:46 https://github.com/google/kasan.git usb-fuzzer cd234325a5f1 5ed23f9a .config console log report
ci2-upstream-usb 2020/01/29 12:33 https://github.com/google/kasan.git usb-fuzzer cd234325a5f1 c8e81ce4 .config console log report
ci2-upstream-usb 2020/01/28 22:38 https://github.com/google/kasan.git usb-fuzzer cd234325a5f1 c8e81ce4 .config console log report
ci2-upstream-usb 2020/01/28 09:28 https://github.com/google/kasan.git usb-fuzzer cd234325a5f1 56cd6c9b .config console log report
ci2-upstream-usb 2020/01/22 00:53 https://github.com/google/kasan.git usb-fuzzer 4cc301ee04d9 8eda0b95 .config console log report
ci2-upstream-usb 2020/01/21 01:52 https://github.com/google/kasan.git usb-fuzzer 4cc301ee04d9 8eda0b95 .config console log report
ci2-upstream-usb 2020/01/15 13:20 https://github.com/google/kasan.git usb-fuzzer 4cc301ee04d9 fa12bd3c .config console log report
ci2-upstream-usb 2020/01/13 03:26 https://github.com/google/kasan.git usb-fuzzer ae1794106b94 53faa9fe .config console log report
ci2-upstream-usb 2020/01/08 14:41 https://github.com/google/kasan.git usb-fuzzer ae1794106b94 ddc3e859 .config console log report
* Struck through repros no longer work on HEAD.