====================================================== WARNING: possible circular locking dependency detected 6.13.0-rc7-syzkaller-00149-g9bffa1ad25b8 #0 Not tainted ------------------------------------------------------ syz.2.171/6756 is trying to acquire lock: ffffe8ffac438ff0 (&per_cpu_ptr(pool->acomp_ctx, cpu)->mutex){+.+.}-{4:4}, at: acomp_ctx_get_cpu_lock mm/zswap.c:899 [inline] ffffe8ffac438ff0 (&per_cpu_ptr(pool->acomp_ctx, cpu)->mutex){+.+.}-{4:4}, at: zswap_compress mm/zswap.c:931 [inline] ffffe8ffac438ff0 (&per_cpu_ptr(pool->acomp_ctx, cpu)->mutex){+.+.}-{4:4}, at: zswap_store_page mm/zswap.c:1456 [inline] ffffe8ffac438ff0 (&per_cpu_ptr(pool->acomp_ctx, cpu)->mutex){+.+.}-{4:4}, at: zswap_store+0x910/0x2600 mm/zswap.c:1563 but task is already holding lock: ffffffff8df4f160 (fs_reclaim){+.+.}-{0:0}, at: __perform_reclaim mm/page_alloc.c:3926 [inline] ffffffff8df4f160 (fs_reclaim){+.+.}-{0:0}, at: __alloc_pages_direct_reclaim mm/page_alloc.c:3951 [inline] ffffffff8df4f160 (fs_reclaim){+.+.}-{0:0}, at: __alloc_pages_slowpath mm/page_alloc.c:4382 [inline] ffffffff8df4f160 (fs_reclaim){+.+.}-{0:0}, at: __alloc_pages_noprof+0xa8b/0x25b0 mm/page_alloc.c:4766 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (fs_reclaim){+.+.}-{0:0}: __fs_reclaim_acquire mm/page_alloc.c:3853 [inline] fs_reclaim_acquire+0x102/0x150 mm/page_alloc.c:3867 might_alloc include/linux/sched/mm.h:318 [inline] slab_pre_alloc_hook mm/slub.c:4070 [inline] slab_alloc_node mm/slub.c:4148 [inline] __kmalloc_cache_node_noprof+0x55/0x3f0 mm/slub.c:4337 kmalloc_node_noprof include/linux/slab.h:924 [inline] zswap_cpu_comp_prepare+0xc9/0x470 mm/zswap.c:828 cpuhp_invoke_callback+0x20c/0xa10 kernel/cpu.c:204 cpuhp_issue_call+0x1c0/0x980 kernel/cpu.c:2375 __cpuhp_state_add_instance_cpuslocked+0x1a4/0x3c0 kernel/cpu.c:2437 __cpuhp_state_add_instance+0xd7/0x2e0 kernel/cpu.c:2458 cpuhp_state_add_instance include/linux/cpuhotplug.h:386 [inline] zswap_pool_create+0x41c/0x710 mm/zswap.c:291 __zswap_pool_create_fallback mm/zswap.c:359 [inline] zswap_setup+0x402/0x810 mm/zswap.c:1811 zswap_init+0x2c/0x40 mm/zswap.c:1847 do_one_initcall+0x128/0x630 init/main.c:1266 do_initcall_level init/main.c:1328 [inline] do_initcalls init/main.c:1344 [inline] do_basic_setup init/main.c:1363 [inline] kernel_init_freeable+0x58f/0x8b0 init/main.c:1577 kernel_init+0x1c/0x2b0 init/main.c:1466 ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244 -> #0 (&per_cpu_ptr(pool->acomp_ctx, cpu)->mutex){+.+.}-{4:4}: check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x249e/0x3c40 kernel/locking/lockdep.c:5226 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5849 __mutex_lock_common kernel/locking/mutex.c:585 [inline] __mutex_lock+0x19b/0xa60 kernel/locking/mutex.c:735 acomp_ctx_get_cpu_lock mm/zswap.c:899 [inline] zswap_compress mm/zswap.c:931 [inline] zswap_store_page mm/zswap.c:1456 [inline] zswap_store+0x910/0x2600 mm/zswap.c:1563 swap_writepage+0x3b6/0x1120 mm/page_io.c:279 pageout+0x3b2/0xaa0 mm/vmscan.c:696 shrink_folio_list+0x3025/0x42d0 mm/vmscan.c:1374 evict_folios+0x6e7/0x1a50 mm/vmscan.c:4600 try_to_shrink_lruvec+0x61e/0xa80 mm/vmscan.c:4799 shrink_one+0x3e3/0x7b0 mm/vmscan.c:4844 shrink_many mm/vmscan.c:4907 [inline] lru_gen_shrink_node mm/vmscan.c:4985 [inline] shrink_node+0xbf0/0x3f20 mm/vmscan.c:5966 shrink_zones mm/vmscan.c:6225 [inline] do_try_to_free_pages+0x35f/0x1a30 mm/vmscan.c:6287 try_to_free_pages+0x2ae/0x6b0 mm/vmscan.c:6537 __perform_reclaim mm/page_alloc.c:3929 [inline] __alloc_pages_direct_reclaim mm/page_alloc.c:3951 [inline] __alloc_pages_slowpath mm/page_alloc.c:4382 [inline] __alloc_pages_noprof+0xb0c/0x25b0 mm/page_alloc.c:4766 alloc_pages_mpol_noprof+0x2c8/0x620 mm/mempolicy.c:2269 vm_area_alloc_pages mm/vmalloc.c:3591 [inline] __vmalloc_area_node mm/vmalloc.c:3669 [inline] __vmalloc_node_range_noprof+0x724/0x1530 mm/vmalloc.c:3846 __kvmalloc_node_noprof+0x14f/0x1a0 mm/util.c:667 __v4l2_ctrl_modify_dimensions+0x1c7/0x650 drivers/media/v4l2-core/v4l2-ctrls-api.c:1004 v4l2_ctrl_modify_dimensions include/media/v4l2-ctrls.h:1013 [inline] vivid_update_format_cap+0x127b/0x2530 drivers/media/test-drivers/vivid/vivid-vid-cap.c:457 vivid_s_fmt_vid_cap+0x1a17/0x3310 drivers/media/test-drivers/vivid/vivid-vid-cap.c:759 fmt_sp2mp_func+0xb2/0x3e0 drivers/media/test-drivers/vivid/vivid-vid-common.c:901 vidioc_s_fmt_vid_cap+0xa0/0xe0 drivers/media/test-drivers/vivid/vivid-vid-cap.c:851 vivid_s_fmt_cap+0x76/0xc0 drivers/media/test-drivers/vivid/vivid-core.c:550 v4l_s_fmt+0x383/0xbc0 drivers/media/v4l2-core/v4l2-ioctl.c:1752 __video_do_ioctl+0xaf0/0xf00 drivers/media/v4l2-core/v4l2-ioctl.c:3122 video_usercopy+0x427/0x1520 drivers/media/v4l2-core/v4l2-ioctl.c:3463 v4l2_ioctl+0x1ba/0x250 drivers/media/v4l2-core/v4l2-dev.c:366 v4l2_compat_ioctl32+0x214/0x2c0 drivers/media/v4l2-core/v4l2-compat-ioctl32.c:1200 __do_compat_sys_ioctl+0x1cb/0x2c0 fs/ioctl.c:1004 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(fs_reclaim); lock(&per_cpu_ptr(pool->acomp_ctx, cpu)->mutex); lock(fs_reclaim); lock(&per_cpu_ptr(pool->acomp_ctx, cpu)->mutex); *** DEADLOCK *** 3 locks held by syz.2.171/6756: #0: ffff8880265d5a58 (&dev->mutex#3){+.+.}-{4:4}, at: __video_do_ioctl+0x4a2/0xf00 drivers/media/v4l2-core/v4l2-ioctl.c:3090 #1: ffff8880265d06e0 (vivid_ctrls:1614:(hdl_user_gen)->_lock){+.+.}-{4:4}, at: v4l2_ctrl_lock include/media/v4l2-ctrls.h:572 [inline] #1: ffff8880265d06e0 (vivid_ctrls:1614:(hdl_user_gen)->_lock){+.+.}-{4:4}, at: v4l2_ctrl_modify_dimensions include/media/v4l2-ctrls.h:1012 [inline] #1: ffff8880265d06e0 (vivid_ctrls:1614:(hdl_user_gen)->_lock){+.+.}-{4:4}, at: vivid_update_format_cap+0x126e/0x2530 drivers/media/test-drivers/vivid/vivid-vid-cap.c:457 #2: ffffffff8df4f160 (fs_reclaim){+.+.}-{0:0}, at: __perform_reclaim mm/page_alloc.c:3926 [inline] #2: ffffffff8df4f160 (fs_reclaim){+.+.}-{0:0}, at: __alloc_pages_direct_reclaim mm/page_alloc.c:3951 [inline] #2: ffffffff8df4f160 (fs_reclaim){+.+.}-{0:0}, at: __alloc_pages_slowpath mm/page_alloc.c:4382 [inline] #2: ffffffff8df4f160 (fs_reclaim){+.+.}-{0:0}, at: __alloc_pages_noprof+0xa8b/0x25b0 mm/page_alloc.c:4766 stack backtrace: CPU: 2 UID: 0 PID: 6756 Comm: syz.2.171 Not tainted 6.13.0-rc7-syzkaller-00149-g9bffa1ad25b8 #0 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:94 [inline] dump_stack_lvl+0x116/0x1f0 lib/dump_stack.c:120 print_circular_bug+0x41c/0x610 kernel/locking/lockdep.c:2074 check_noncircular+0x31a/0x400 kernel/locking/lockdep.c:2206 check_prev_add kernel/locking/lockdep.c:3161 [inline] check_prevs_add kernel/locking/lockdep.c:3280 [inline] validate_chain kernel/locking/lockdep.c:3904 [inline] __lock_acquire+0x249e/0x3c40 kernel/locking/lockdep.c:5226 lock_acquire.part.0+0x11b/0x380 kernel/locking/lockdep.c:5849 __mutex_lock_common kernel/locking/mutex.c:585 [inline] __mutex_lock+0x19b/0xa60 kernel/locking/mutex.c:735 acomp_ctx_get_cpu_lock mm/zswap.c:899 [inline] zswap_compress mm/zswap.c:931 [inline] zswap_store_page mm/zswap.c:1456 [inline] zswap_store+0x910/0x2600 mm/zswap.c:1563 swap_writepage+0x3b6/0x1120 mm/page_io.c:279 pageout+0x3b2/0xaa0 mm/vmscan.c:696 shrink_folio_list+0x3025/0x42d0 mm/vmscan.c:1374 evict_folios+0x6e7/0x1a50 mm/vmscan.c:4600 try_to_shrink_lruvec+0x61e/0xa80 mm/vmscan.c:4799 shrink_one+0x3e3/0x7b0 mm/vmscan.c:4844 shrink_many mm/vmscan.c:4907 [inline] lru_gen_shrink_node mm/vmscan.c:4985 [inline] shrink_node+0xbf0/0x3f20 mm/vmscan.c:5966 shrink_zones mm/vmscan.c:6225 [inline] do_try_to_free_pages+0x35f/0x1a30 mm/vmscan.c:6287 try_to_free_pages+0x2ae/0x6b0 mm/vmscan.c:6537 __perform_reclaim mm/page_alloc.c:3929 [inline] __alloc_pages_direct_reclaim mm/page_alloc.c:3951 [inline] __alloc_pages_slowpath mm/page_alloc.c:4382 [inline] __alloc_pages_noprof+0xb0c/0x25b0 mm/page_alloc.c:4766 alloc_pages_mpol_noprof+0x2c8/0x620 mm/mempolicy.c:2269 vm_area_alloc_pages mm/vmalloc.c:3591 [inline] __vmalloc_area_node mm/vmalloc.c:3669 [inline] __vmalloc_node_range_noprof+0x724/0x1530 mm/vmalloc.c:3846 __kvmalloc_node_noprof+0x14f/0x1a0 mm/util.c:667 __v4l2_ctrl_modify_dimensions+0x1c7/0x650 drivers/media/v4l2-core/v4l2-ctrls-api.c:1004 v4l2_ctrl_modify_dimensions include/media/v4l2-ctrls.h:1013 [inline] vivid_update_format_cap+0x127b/0x2530 drivers/media/test-drivers/vivid/vivid-vid-cap.c:457 vivid_s_fmt_vid_cap+0x1a17/0x3310 drivers/media/test-drivers/vivid/vivid-vid-cap.c:759 fmt_sp2mp_func+0xb2/0x3e0 drivers/media/test-drivers/vivid/vivid-vid-common.c:901 vidioc_s_fmt_vid_cap+0xa0/0xe0 drivers/media/test-drivers/vivid/vivid-vid-cap.c:851 vivid_s_fmt_cap+0x76/0xc0 drivers/media/test-drivers/vivid/vivid-core.c:550 v4l_s_fmt+0x383/0xbc0 drivers/media/v4l2-core/v4l2-ioctl.c:1752 __video_do_ioctl+0xaf0/0xf00 drivers/media/v4l2-core/v4l2-ioctl.c:3122 video_usercopy+0x427/0x1520 drivers/media/v4l2-core/v4l2-ioctl.c:3463 v4l2_ioctl+0x1ba/0x250 drivers/media/v4l2-core/v4l2-dev.c:366 v4l2_compat_ioctl32+0x214/0x2c0 drivers/media/v4l2-core/v4l2-compat-ioctl32.c:1200 __do_compat_sys_ioctl+0x1cb/0x2c0 fs/ioctl.c:1004 do_syscall_32_irqs_on arch/x86/entry/common.c:165 [inline] __do_fast_syscall_32+0x73/0x120 arch/x86/entry/common.c:386 do_fast_syscall_32+0x32/0x80 arch/x86/entry/common.c:411 entry_SYSENTER_compat_after_hwframe+0x84/0x8e RIP: 0023:0xf711e579 Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00 RSP: 002b:00000000f50ef55c EFLAGS: 00000296 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 0000000000000008 RCX: 00000000c0d05605 RDX: 0000000020000080 RSI: 0000000000000000 RDI: 0000000000000000 RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000296 R12: 0000000000000000 R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000 syz.2.171 (6756) used greatest stack depth: 20520 bytes left ---------------- Code disassembly (best guess), 2 bytes skipped: 0: 10 06 adc %al,(%rsi) 2: 03 74 b4 01 add 0x1(%rsp,%rsi,4),%esi 6: 10 07 adc %al,(%rdi) 8: 03 74 b0 01 add 0x1(%rax,%rsi,4),%esi c: 10 08 adc %cl,(%rax) e: 03 74 d8 01 add 0x1(%rax,%rbx,8),%esi 1e: 00 51 52 add %dl,0x52(%rcx) 21: 55 push %rbp 22: 89 e5 mov %esp,%ebp 24: 0f 34 sysenter 26: cd 80 int $0x80 * 28: 5d pop %rbp <-- trapping instruction 29: 5a pop %rdx 2a: 59 pop %rcx 2b: c3 ret 2c: 90 nop 2d: 90 nop 2e: 90 nop 2f: 90 nop 30: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi 37: 8d b4 26 00 00 00 00 lea 0x0(%rsi,%riz,1),%esi