bisecting fixing commit since e4e453434a199cdfa1e1e5cc723d8736f522354a building syzkaller on 1ba81399e2d03b53a7e631c4ab05f25af1fb1911 testing commit e4e453434a199cdfa1e1e5cc723d8736f522354a compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 0392d9a0cb8a7bd6e7caf02a40250239cae5fbcafa3ed99e59e334b81587921a run #0: crashed: KASAN: use-after-free Read in v4l2_fh_init run #1: crashed: KASAN: use-after-free Read in v4l2_fh_init run #2: crashed: KASAN: use-after-free Read in v4l2_fh_init run #3: crashed: KASAN: use-after-free Read in v4l2_fh_init run #4: crashed: KASAN: use-after-free Read in v4l2_fh_init run #5: crashed: KASAN: use-after-free Read in v4l2_fh_init run #6: crashed: KASAN: use-after-free Read in v4l2_fh_init run #7: crashed: KASAN: use-after-free Read in v4l2_fh_init run #8: crashed: KASAN: use-after-free Read in v4l2_fh_init run #9: crashed: KASAN: use-after-free Read in v4l2_fh_init run #10: crashed: KASAN: use-after-free Read in v4l2_fh_init run #11: crashed: KASAN: use-after-free Read in v4l2_fh_init run #12: crashed: KASAN: use-after-free Read in v4l2_fh_init run #13: crashed: KASAN: use-after-free Read in v4l2_fh_init run #14: crashed: KASAN: use-after-free Read in v4l2_fh_init run #15: crashed: BUG: sleeping function called from invalid context in lock_sock_nested run #16: crashed: KASAN: use-after-free Read in v4l2_fh_init run #17: crashed: KASAN: use-after-free Read in v4l2_fh_init run #18: crashed: KASAN: use-after-free Read in v4l2_fh_init run #19: crashed: KASAN: use-after-free Read in v4l2_fh_init testing current HEAD 72a8e05d4f66b5af7854df4490e3135168694b6b testing commit 72a8e05d4f66b5af7854df4490e3135168694b6b compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 9633551ab370a8065092439a3d5c0c99647ef18bf20231f7bb649030087069f0 run #0: basic kernel testing failed: BUG: program execution failed: executor NUM: exit status NUM run #1: crashed: INFO: rcu detected stall in corrupted run #2: crashed: INFO: rcu detected stall in corrupted run #3: crashed: INFO: rcu detected stall in corrupted run #4: crashed: INFO: rcu detected stall in corrupted run #5: crashed: INFO: rcu detected stall in corrupted run #6: crashed: KASAN: use-after-free Read in v4l2_fh_init run #7: crashed: KASAN: use-after-free Read in v4l2_fh_init run #8: crashed: KASAN: use-after-free Read in v4l2_fh_init run #9: crashed: KASAN: use-after-free Read in v4l2_fh_init revisions tested: 2, total time: 20m46.552101877s (build: 12m58.542467618s, test: 7m7.538982495s) the crash still happens on HEAD commit msg: Merge tag 'ovl-fixes-5.19-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/mszeredi/vfs crash: KASAN: use-after-free Read in v4l2_fh_init ================================================================== BUG: KASAN: use-after-free in v4l2_fh_init+0x274/0x2c0 drivers/media/v4l2-core/v4l2-fh.c:25 Read of size 8 at addr ffff888077314838 by task v4l_id/4400 CPU: 1 PID: 4400 Comm: v4l_id Not tainted 5.19.0-rc6-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/29/2022 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x57/0x7d lib/dump_stack.c:106 print_address_description.constprop.0.cold+0xeb/0x495 mm/kasan/report.c:313 print_report mm/kasan/report.c:429 [inline] kasan_report.cold+0xf4/0x1c6 mm/kasan/report.c:491 v4l2_fh_init+0x274/0x2c0 drivers/media/v4l2-core/v4l2-fh.c:25 v4l2_fh_open+0x78/0xb0 drivers/media/v4l2-core/v4l2-fh.c:63 em28xx_v4l2_open+0xd6/0x430 drivers/media/usb/em28xx/em28xx-video.c:2163 v4l2_open+0x1e3/0x370 drivers/media/v4l2-core/v4l2-dev.c:427 chrdev_open+0x20f/0x650 fs/char_dev.c:414 do_dentry_open+0x414/0xfe0 fs/open.c:848 do_open fs/namei.c:3520 [inline] path_openat+0x9cf/0x2360 fs/namei.c:3653 do_filp_open+0x199/0x3d0 fs/namei.c:3680 do_sys_openat2+0x11e/0x3f0 fs/open.c:1278 do_sys_open fs/open.c:1294 [inline] __do_sys_openat fs/open.c:1310 [inline] __se_sys_openat fs/open.c:1305 [inline] __x64_sys_openat+0x11b/0x1d0 fs/open.c:1305 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd RIP: 0033:0x7f021f925697 Code: 25 00 00 41 00 3d 00 00 41 00 74 37 64 8b 04 25 18 00 00 00 85 c0 75 5b 44 89 e2 48 89 ee bf 9c ff ff ff b8 01 01 00 00 0f 05 <48> 3d 00 f0 ff ff 0f 87 85 00 00 00 48 83 c4 68 5d 41 5c c3 0f 1f RSP: 002b:00007ffd106a0b30 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 000055d29ce2fc40 RCX: 00007f021f925697 RDX: 0000000000000000 RSI: 00007ffd106a1f1f RDI: 00000000ffffff9c RBP: 00007ffd106a1f1f R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 3713: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track mm/kasan/common.c:45 [inline] set_alloc_info mm/kasan/common.c:436 [inline] ____kasan_kmalloc mm/kasan/common.c:515 [inline] ____kasan_kmalloc mm/kasan/common.c:474 [inline] __kasan_kmalloc+0xa9/0xd0 mm/kasan/common.c:524 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] em28xx_v4l2_init drivers/media/usb/em28xx/em28xx-video.c:2542 [inline] em28xx_v4l2_init.cold+0x91/0x2d76 drivers/media/usb/em28xx/em28xx-video.c:2520 em28xx_init_extension+0x106/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1126 process_one_work+0x865/0x13d0 kernel/workqueue.c:2289 process_scheduled_works kernel/workqueue.c:2352 [inline] worker_thread+0x6f1/0xec0 kernel/workqueue.c:2441 kthread+0x299/0x340 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 Freed by task 3713: kasan_save_stack+0x1e/0x40 mm/kasan/common.c:38 kasan_set_track+0x21/0x30 mm/kasan/common.c:45 kasan_set_free_info+0x20/0x30 mm/kasan/generic.c:370 ____kasan_slab_free mm/kasan/common.c:366 [inline] ____kasan_slab_free+0x166/0x1a0 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:200 [inline] slab_free_hook mm/slub.c:1754 [inline] slab_free_freelist_hook+0x8b/0x1c0 mm/slub.c:1780 slab_free mm/slub.c:3536 [inline] kfree+0xd6/0x4d0 mm/slub.c:4584 em28xx_v4l2_init drivers/media/usb/em28xx/em28xx-video.c:2911 [inline] em28xx_v4l2_init.cold+0x24a/0x2d76 drivers/media/usb/em28xx/em28xx-video.c:2520 em28xx_init_extension+0x106/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1126 process_one_work+0x865/0x13d0 kernel/workqueue.c:2289 process_scheduled_works kernel/workqueue.c:2352 [inline] worker_thread+0x6f1/0xec0 kernel/workqueue.c:2441 kthread+0x299/0x340 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 The buggy address belongs to the object at ffff888077314000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 2104 bytes inside of 8192-byte region [ffff888077314000, ffff888077316000) The buggy address belongs to the physical page: page:ffffea0001dcc400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x77310 head:ffffea0001dcc400 order:3 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 0000000000000000 dead000000000122 ffff888010042280 raw: 0000000000000000 0000000080020002 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 0x1d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL), pid 3713, tgid 3713 (kworker/1:4), ts 95164001641, free_ts 95135365292 prep_new_page mm/page_alloc.c:2456 [inline] get_page_from_freelist+0x19d3/0x3b30 mm/page_alloc.c:4198 __alloc_pages+0x1c7/0x510 mm/page_alloc.c:5426 alloc_slab_page mm/slub.c:1824 [inline] allocate_slab+0x26c/0x3c0 mm/slub.c:1969 new_slab mm/slub.c:2029 [inline] ___slab_alloc+0x9bc/0xe10 mm/slub.c:3031 __slab_alloc.constprop.0+0x4d/0xa0 mm/slub.c:3118 slab_alloc_node mm/slub.c:3209 [inline] slab_alloc mm/slub.c:3251 [inline] kmem_cache_alloc_trace+0x310/0x3f0 mm/slub.c:3282 kmalloc include/linux/slab.h:600 [inline] kzalloc include/linux/slab.h:733 [inline] em28xx_v4l2_init drivers/media/usb/em28xx/em28xx-video.c:2542 [inline] em28xx_v4l2_init.cold+0x91/0x2d76 drivers/media/usb/em28xx/em28xx-video.c:2520 em28xx_init_extension+0x106/0x1c0 drivers/media/usb/em28xx/em28xx-core.c:1126 process_one_work+0x865/0x13d0 kernel/workqueue.c:2289 process_scheduled_works kernel/workqueue.c:2352 [inline] worker_thread+0x6f1/0xec0 kernel/workqueue.c:2441 kthread+0x299/0x340 kernel/kthread.c:376 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:306 page last free stack trace: reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1371 [inline] free_pcp_prepare+0x549/0xd20 mm/page_alloc.c:1421 free_unref_page_prepare mm/page_alloc.c:3343 [inline] free_unref_page+0x19/0x6a0 mm/page_alloc.c:3438 __unfreeze_partials+0x17c/0x1a0 mm/slub.c:2548 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x6a/0x170 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0xa2/0xc0 mm/kasan/common.c:446 kasan_slab_alloc include/linux/kasan.h:224 [inline] slab_post_alloc_hook mm/slab.h:750 [inline] slab_alloc_node mm/slub.c:3243 [inline] slab_alloc mm/slub.c:3251 [inline] __kmem_cache_alloc_lru mm/slub.c:3258 [inline] kmem_cache_alloc+0x204/0x3b0 mm/slub.c:3268 getname_flags.part.0+0x4a/0x440 fs/namei.c:139 do_sys_openat2+0xd2/0x3f0 fs/open.c:1272 do_sys_open fs/open.c:1294 [inline] __do_sys_openat fs/open.c:1310 [inline] __se_sys_openat fs/open.c:1305 [inline] __x64_sys_openat+0x11b/0x1d0 fs/open.c:1305 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x63/0xcd Memory state around the buggy address: ffff888077314700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888077314780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff888077314800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff888077314880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff888077314900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================