====================================================== WARNING: possible circular locking dependency detected 5.15.153-syzkaller #0 Not tainted ------------------------------------------------------ syz-executor.4/4505 is trying to acquire lock: ffff88801c27e368 (&p->pi_lock){-.-.}-{2:2}, at: try_to_wake_up+0xae/0x1300 kernel/sched/core.c:4030 but task is already holding lock: ffffffff8c7fbf78 ((console_sem).lock){....}-{2:2}, at: up+0x19/0x90 kernel/locking/semaphore.c:186 which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #3 ((console_sem).lock){....}-{2:2}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162 down_trylock+0x1c/0xa0 kernel/locking/semaphore.c:138 __down_trylock_console_sem+0x105/0x250 kernel/printk/printk.c:239 console_trylock kernel/printk/printk.c:2569 [inline] console_trylock_spinning+0x8a/0x3f0 kernel/printk/printk.c:1867 vprintk_emit+0xa6/0x150 kernel/printk/printk.c:2267 _printk+0xd1/0x111 kernel/printk/printk.c:2293 debug_objects_oom+0xb4/0x370 lib/debugobjects.c:472 debug_object_activate+0x42d/0x4e0 lib/debugobjects.c:698 debug_rcu_head_queue kernel/rcu/rcu.h:176 [inline] kvfree_call_rcu+0xb6/0x8a0 kernel/rcu/tree.c:3587 trie_update_elem+0x808/0xc00 kernel/bpf/lpm_trie.c:384 bpf_map_update_value+0x5d7/0x6c0 kernel/bpf/syscall.c:221 generic_map_update_batch+0x54d/0x8b0 kernel/bpf/syscall.c:1421 bpf_map_do_batch+0x4d0/0x620 __sys_bpf+0x55c/0x670 __do_sys_bpf kernel/bpf/syscall.c:4755 [inline] __se_sys_bpf kernel/bpf/syscall.c:4753 [inline] __x64_sys_bpf+0x78/0x90 kernel/bpf/syscall.c:4753 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb -> #2 (&trie->lock){....}-{2:2}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162 trie_delete_elem+0x90/0x690 kernel/bpf/lpm_trie.c:450 0xffffffffa0028dfd bpf_dispatcher_nop_func include/linux/bpf.h:785 [inline] __bpf_prog_run include/linux/filter.h:628 [inline] bpf_prog_run include/linux/filter.h:635 [inline] __bpf_trace_run kernel/trace/bpf_trace.c:1880 [inline] bpf_trace_run3+0x1d1/0x380 kernel/trace/bpf_trace.c:1918 __traceiter_sched_switch+0x7d/0xb0 include/trace/events/sched.h:220 trace_sched_switch include/trace/events/sched.h:220 [inline] __schedule+0x1e8d/0x45b0 kernel/sched/core.c:6373 schedule+0x11b/0x1f0 kernel/sched/core.c:6459 freezable_schedule include/linux/freezer.h:172 [inline] do_nanosleep+0x1bc/0x7b0 kernel/time/hrtimer.c:2045 hrtimer_nanosleep+0x24d/0x490 kernel/time/hrtimer.c:2098 __do_sys_clock_nanosleep kernel/time/posix-timers.c:1313 [inline] __se_sys_clock_nanosleep+0x323/0x3b0 kernel/time/posix-timers.c:1290 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb -> #1 (&rq->__lock){-.-.}-{2:2}: lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 _raw_spin_lock_nested+0x2d/0x40 kernel/locking/spinlock.c:368 raw_spin_rq_lock_nested+0x26/0x140 kernel/sched/core.c:475 raw_spin_rq_lock kernel/sched/sched.h:1326 [inline] rq_lock kernel/sched/sched.h:1621 [inline] task_fork_fair+0x5d/0x350 kernel/sched/fair.c:11480 sched_cgroup_fork+0x2d3/0x330 kernel/sched/core.c:4466 copy_process+0x224a/0x3ef0 kernel/fork.c:2320 kernel_clone+0x210/0x960 kernel/fork.c:2604 kernel_thread+0x168/0x1e0 kernel/fork.c:2656 rest_init+0x21/0x330 init/main.c:704 start_kernel+0x48c/0x535 init/main.c:1138 secondary_startup_64_no_verify+0xb1/0xbb -> #0 (&p->pi_lock){-.-.}-{2:2}: check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162 try_to_wake_up+0xae/0x1300 kernel/sched/core.c:4030 up+0x6e/0x90 kernel/locking/semaphore.c:190 __up_console_sem+0x11a/0x1e0 kernel/printk/printk.c:256 console_unlock+0x1145/0x12b0 kernel/printk/printk.c:2754 vprintk_emit+0xbf/0x150 kernel/printk/printk.c:2268 _printk+0xd1/0x111 kernel/printk/printk.c:2293 handle_bad_sector block/blk-core.c:655 [inline] bio_check_eod block/blk-core.c:728 [inline] submit_bio_checks+0x10b1/0x1940 block/blk-core.c:812 __submit_bio+0x5a1/0x850 block/blk-core.c:911 __submit_bio_noacct_mq block/blk-core.c:997 [inline] submit_bio_noacct+0x955/0xb30 block/blk-core.c:1027 submit_bio+0x2dd/0x560 block/blk-core.c:1089 submit_bh fs/buffer.c:3062 [inline] block_read_full_page+0x93b/0xde0 fs/buffer.c:2341 do_read_cache_page+0x752/0x1040 read_mapping_page include/linux/pagemap.h:515 [inline] hfsplus_block_allocate+0xfa/0x8d0 fs/hfsplus/bitmap.c:37 hfsplus_file_extend+0xa4c/0x1b10 fs/hfsplus/extents.c:468 hfsplus_get_block+0x402/0x14e0 fs/hfsplus/extents.c:245 __block_write_begin_int+0x60b/0x1650 fs/buffer.c:2012 __block_write_begin fs/buffer.c:2062 [inline] block_write_begin fs/buffer.c:2122 [inline] cont_write_begin+0x5d6/0x840 fs/buffer.c:2471 hfsplus_write_begin+0x92/0xd0 fs/hfsplus/inode.c:53 cont_expand_zero fs/buffer.c:2431 [inline] cont_write_begin+0x654/0x840 fs/buffer.c:2461 hfsplus_write_begin+0x92/0xd0 fs/hfsplus/inode.c:53 generic_cont_expand_simple+0x144/0x230 fs/buffer.c:2362 hfsplus_setattr+0x169/0x280 fs/hfsplus/inode.c:261 notify_change+0xc6d/0xf50 fs/attr.c:505 do_truncate+0x21c/0x300 fs/open.c:65 do_sys_ftruncate+0x2eb/0x390 fs/open.c:193 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb other info that might help us debug this: Chain exists of: &p->pi_lock --> &trie->lock --> (console_sem).lock Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock((console_sem).lock); lock(&trie->lock); lock((console_sem).lock); lock(&p->pi_lock); *** DEADLOCK *** 5 locks held by syz-executor.4/4505: #0: ffff88806020a460 (sb_writers#17){.+.+}-{0:0}, at: do_sys_ftruncate+0x25a/0x390 fs/open.c:190 #1: ffff8880770809c0 (&sb->s_type->i_mutex_key#23){+.+.}-{3:3}, at: inode_lock include/linux/fs.h:789 [inline] #1: ffff8880770809c0 (&sb->s_type->i_mutex_key#23){+.+.}-{3:3}, at: do_truncate+0x208/0x300 fs/open.c:63 #2: ffff8880770807c8 (&hip->extents_lock){+.+.}-{3:3}, at: hfsplus_file_extend+0x1d2/0x1b10 fs/hfsplus/extents.c:457 #3: ffff8880757668f8 (&sbi->alloc_mutex){+.+.}-{3:3}, at: hfsplus_block_allocate+0x8a/0x8d0 fs/hfsplus/bitmap.c:35 #4: ffffffff8c7fbf78 ((console_sem).lock){....}-{2:2}, at: up+0x19/0x90 kernel/locking/semaphore.c:186 stack backtrace: CPU: 1 PID: 4505 Comm: syz-executor.4 Not tainted 5.15.153-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/27/2024 Call Trace: __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106 check_noncircular+0x2f8/0x3b0 kernel/locking/lockdep.c:2133 check_prev_add kernel/locking/lockdep.c:3053 [inline] check_prevs_add kernel/locking/lockdep.c:3172 [inline] validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788 __lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012 lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162 try_to_wake_up+0xae/0x1300 kernel/sched/core.c:4030 up+0x6e/0x90 kernel/locking/semaphore.c:190 __up_console_sem+0x11a/0x1e0 kernel/printk/printk.c:256 console_unlock+0x1145/0x12b0 kernel/printk/printk.c:2754 vprintk_emit+0xbf/0x150 kernel/printk/printk.c:2268 _printk+0xd1/0x111 kernel/printk/printk.c:2293 handle_bad_sector block/blk-core.c:655 [inline] bio_check_eod block/blk-core.c:728 [inline] submit_bio_checks+0x10b1/0x1940 block/blk-core.c:812 __submit_bio+0x5a1/0x850 block/blk-core.c:911 __submit_bio_noacct_mq block/blk-core.c:997 [inline] submit_bio_noacct+0x955/0xb30 block/blk-core.c:1027 submit_bio+0x2dd/0x560 block/blk-core.c:1089 submit_bh fs/buffer.c:3062 [inline] block_read_full_page+0x93b/0xde0 fs/buffer.c:2341 do_read_cache_page+0x752/0x1040 read_mapping_page include/linux/pagemap.h:515 [inline] hfsplus_block_allocate+0xfa/0x8d0 fs/hfsplus/bitmap.c:37 hfsplus_file_extend+0xa4c/0x1b10 fs/hfsplus/extents.c:468 hfsplus_get_block+0x402/0x14e0 fs/hfsplus/extents.c:245 __block_write_begin_int+0x60b/0x1650 fs/buffer.c:2012 __block_write_begin fs/buffer.c:2062 [inline] block_write_begin fs/buffer.c:2122 [inline] cont_write_begin+0x5d6/0x840 fs/buffer.c:2471 hfsplus_write_begin+0x92/0xd0 fs/hfsplus/inode.c:53 cont_expand_zero fs/buffer.c:2431 [inline] cont_write_begin+0x654/0x840 fs/buffer.c:2461 hfsplus_write_begin+0x92/0xd0 fs/hfsplus/inode.c:53 generic_cont_expand_simple+0x144/0x230 fs/buffer.c:2362 hfsplus_setattr+0x169/0x280 fs/hfsplus/inode.c:261 notify_change+0xc6d/0xf50 fs/attr.c:505 do_truncate+0x21c/0x300 fs/open.c:65 do_sys_ftruncate+0x2eb/0x390 fs/open.c:193 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x61/0xcb RIP: 0033:0x7f4ca0504e69 Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 00 00 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 b0 ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f4c9ea770c8 EFLAGS: 00000246 ORIG_RAX: 000000000000004d RAX: ffffffffffffffda RBX: 00007f4ca0632f80 RCX: 00007f4ca0504e69 RDX: 0000000000000000 RSI: 0000000000000800 RDI: 0000000000000004 RBP: 00007f4ca055147a R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000 R13: 000000000000000b R14: 00007f4ca0632f80 R15: 00007ffe3378c6b8 Buffer I/O error on dev loop4, logical block 100663296, async page read attempt to access beyond end of device loop4: rw=0, want=201326594, limit=1024 Buffer I/O error on dev loop4, logical block 100663296, async page read