bisecting fixing commit since 4010a528219e01dd02e768b22168f7f0e78365ce building syzkaller on 9a4781d43abfb86fe8521cb6fb084519e237454c testing commit 4010a528219e01dd02e768b22168f7f0e78365ce compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 7520e60c5c04275fa150e9a532958d3be1a1abec6090ea9d48759736e986fd97 run #0: basic kernel testing failed: BUG: sleeping function called from invalid context in lock_sock_nested 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: BUG: sleeping function called from invalid context in lock_sock_nested 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: KASAN: use-after-free Read in v4l2_fh_init 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 e8a4e1c1bb697b1d9fc48f0e56dc0f50bc024bee testing commit e8a4e1c1bb697b1d9fc48f0e56dc0f50bc024bee compiler: gcc (GCC) 10.2.1 20210217, GNU ld (GNU Binutils for Debian) 2.35.2 kernel signature: 3cbf89da6c0a6254ceb457721b0073a8fe3e78c12c0db321bf0f85f88814c11a 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: INFO: rcu detected stall in corrupted run #3: crashed: KASAN: use-after-free Read in v4l2_fh_init run #4: crashed: INFO: rcu detected stall in corrupted run #5: crashed: KASAN: use-after-free Read in v4l2_fh_init run #6: crashed: INFO: rcu detected stall in corrupted 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: 21m15.923511117s (build: 13m22.332306277s, test: 7m3.736587866s) the crash still happens on HEAD commit msg: Merge tag 'loongarch-fixes-5.19-4' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson 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 ffff88807c5d8838 by task v4l_id/4448 CPU: 0 PID: 4448 Comm: v4l_id Not tainted 5.19.0-rc5-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/0x467 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+0x46/0xb0 RIP: 0033:0x7f8329125697 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:00007ffd2e227e90 EFLAGS: 00000246 ORIG_RAX: 0000000000000101 RAX: ffffffffffffffda RBX: 000055f5bd58bc40 RCX: 00007f8329125697 RDX: 0000000000000000 RSI: 00007ffd2e229f1f RDI: 00000000ffffff9c RBP: 00007ffd2e229f1f R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 Allocated by task 26: 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+0xa6/0xd0 mm/kasan/common.c:524 kasan_kmalloc include/linux/kasan.h:234 [inline] kmem_cache_alloc_trace+0x1ea/0x4a0 mm/slab.c:3569 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:302 Freed by task 26: 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+0x13d/0x180 mm/kasan/common.c:328 kasan_slab_free include/linux/kasan.h:200 [inline] __cache_free mm/slab.c:3425 [inline] kfree+0x113/0x310 mm/slab.c:3796 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:302 The buggy address belongs to the object at ffff88807c5d8000 which belongs to the cache kmalloc-8k of size 8192 The buggy address is located 2104 bytes inside of 8192-byte region [ffff88807c5d8000, ffff88807c5da000) The buggy address belongs to the physical page: page:ffffea0001f17600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x7c5d8 head:ffffea0001f17600 order:2 compound_mapcount:0 compound_pincount:0 flags: 0xfff00000010200(slab|head|node=0|zone=1|lastcpupid=0x7ff) raw: 00fff00000010200 ffffea0001b8ce08 ffffea0001b8c908 ffff888010040a00 raw: 0000000000000000 ffff88807c5d8000 0000000100000001 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 2, migratetype Unmovable, gfp_mask 0x3d20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC|__GFP_HARDWALL|__GFP_THISNODE), pid 3220, tgid 3220 (dhcpcd), ts 63270511399, free_ts 63199334466 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_pages_node include/linux/gfp.h:587 [inline] kmem_getpages mm/slab.c:1363 [inline] cache_grow_begin+0x75/0x350 mm/slab.c:2569 cache_alloc_refill+0x27f/0x380 mm/slab.c:2942 ____cache_alloc mm/slab.c:3024 [inline] ____cache_alloc mm/slab.c:3007 [inline] slab_alloc_node mm/slab.c:3227 [inline] kmem_cache_alloc_node_trace+0x50d/0x5a0 mm/slab.c:3611 __do_kmalloc_node mm/slab.c:3633 [inline] __kmalloc_node_track_caller+0x38/0x60 mm/slab.c:3648 kmalloc_reserve net/core/skbuff.c:354 [inline] __alloc_skb+0x8a/0x270 net/core/skbuff.c:426 alloc_skb include/linux/skbuff.h:1426 [inline] netlink_dump+0x27a/0xb80 net/netlink/af_netlink.c:2242 netlink_recvmsg+0x847/0xbe0 net/netlink/af_netlink.c:2002 sock_recvmsg_nosec net/socket.c:995 [inline] sock_recvmsg net/socket.c:1013 [inline] sock_recvmsg net/socket.c:1009 [inline] ____sys_recvmsg+0x262/0x630 net/socket.c:2707 ___sys_recvmsg+0xe2/0x1a0 net/socket.c:2749 __sys_recvmsg+0xb6/0x140 net/socket.c:2779 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+0x46/0xb0 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 slab_destroy mm/slab.c:1615 [inline] slabs_destroy+0x89/0xc0 mm/slab.c:1635 cache_flusharray mm/slab.c:3397 [inline] ___cache_free+0x34e/0x670 mm/slab.c:3460 qlink_free mm/kasan/quarantine.c:168 [inline] qlist_free_all+0x4f/0x1b0 mm/kasan/quarantine.c:187 kasan_quarantine_reduce+0x180/0x200 mm/kasan/quarantine.c:294 __kasan_slab_alloc+0x97/0xb0 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 mm/slab.c:3302 [inline] __kmem_cache_alloc_lru mm/slab.c:3479 [inline] kmem_cache_alloc+0x265/0x560 mm/slab.c:3499 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+0x46/0xb0 Memory state around the buggy address: ffff88807c5d8700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807c5d8780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb >ffff88807c5d8800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ^ ffff88807c5d8880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ffff88807c5d8900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb ==================================================================