------------[ cut here ]------------
======================================================
WARNING: possible circular locking dependency detected
6.7.0-rc5-next-20231214-syzkaller #0 Not tainted
------------------------------------------------------
udevadm/25226 is trying to acquire lock:
ffffffff8d199e58 ((console_sem).lock){-.-.}-{2:2}, at: down_trylock+0x12/0x70 kernel/locking/semaphore.c:139
but task is already holding lock:
ffffffff8dc791f8 (pool_rwlock){----}-{2:2}, at: stack_depot_put lib/stackdepot.c:621 [inline]
ffffffff8dc791f8 (pool_rwlock){----}-{2:2}, at: stack_depot_put+0x24/0x110 lib/stackdepot.c:613
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #3 (pool_rwlock){----}-{2:2}:
__raw_read_lock_irqsave include/linux/rwlock_api_smp.h:160 [inline]
_raw_read_lock_irqsave+0x46/0x90 kernel/locking/spinlock.c:236
stack_depot_save_flags+0x169/0x740 lib/stackdepot.c:508
kasan_save_stack+0x42/0x50 mm/kasan/common.c:48
__kasan_record_aux_stack+0xc2/0xd0 mm/kasan/generic.c:517
task_work_add+0x88/0x2a0 kernel/task_work.c:48
task_tick_numa kernel/sched/fair.c:3512 [inline]
task_tick_fair+0x5a5/0xc30 kernel/sched/fair.c:12599
scheduler_tick+0x210/0x650 kernel/sched/core.c:5674
update_process_times+0x19e/0x220 kernel/time/timer.c:2076
tick_sched_handle+0x8e/0x170 kernel/time/tick-sched.c:255
tick_nohz_highres_handler+0xe9/0x110 kernel/time/tick-sched.c:1516
__run_hrtimer kernel/time/hrtimer.c:1688 [inline]
__hrtimer_run_queues+0x654/0xc20 kernel/time/hrtimer.c:1752
hrtimer_interrupt+0x31b/0x800 kernel/time/hrtimer.c:1814
local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1065 [inline]
__sysvec_apic_timer_interrupt+0x10c/0x410 arch/x86/kernel/apic/apic.c:1082
sysvec_apic_timer_interrupt+0x90/0xb0 arch/x86/kernel/apic/apic.c:1076
asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:649
percpu_counter_add_batch+0xe6/0x1f0 lib/percpu_counter.c:102
percpu_counter_add include/linux/percpu_counter.h:71 [inline]
add_mm_counter include/linux/mm.h:2579 [inline]
set_pte_range+0x3b0/0xa10 mm/memory.c:4517
filemap_map_order0_folio mm/filemap.c:3501 [inline]
filemap_map_pages+0x458/0x1290 mm/filemap.c:3547
do_fault_around mm/memory.c:4687 [inline]
do_read_fault mm/memory.c:4720 [inline]
do_fault mm/memory.c:4859 [inline]
do_pte_missing mm/memory.c:3738 [inline]
handle_pte_fault mm/memory.c:5135 [inline]
__handle_mm_fault+0x31be/0x48f0 mm/memory.c:5276
handle_mm_fault+0x476/0xa00 mm/memory.c:5441
do_user_addr_fault+0x309/0x1000 arch/x86/mm/fault.c:1364
handle_page_fault arch/x86/mm/fault.c:1505 [inline]
exc_page_fault+0x5c/0xc0 arch/x86/mm/fault.c:1561
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570
-> #2 (&rq->__lock){-.-.}-{2:2}:
_raw_spin_lock_nested+0x31/0x40 kernel/locking/spinlock.c:378
raw_spin_rq_lock_nested+0x29/0x130 kernel/sched/core.c:558
raw_spin_rq_lock kernel/sched/sched.h:1385 [inline]
rq_lock kernel/sched/sched.h:1699 [inline]
task_fork_fair+0x70/0x240 kernel/sched/fair.c:12619
sched_cgroup_fork+0x3cf/0x510 kernel/sched/core.c:4835
copy_process+0x6a38/0x9770 kernel/fork.c:2601
kernel_clone+0xfd/0x940 kernel/fork.c:2899
user_mode_thread+0xb4/0xf0 kernel/fork.c:2977
rest_init+0x27/0x2b0 init/main.c:695
arch_call_rest_init+0x13/0x30 init/main.c:827
start_kernel+0x39e/0x480 init/main.c:1072
x86_64_start_reservations+0x18/0x30 arch/x86/kernel/head64.c:555
x86_64_start_kernel+0xb2/0xc0 arch/x86/kernel/head64.c:536
secondary_startup_64_no_verify+0x15e/0x16b
-> #1 (&p->pi_lock){-.-.}-{2:2}:
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0x3a/0x50 kernel/locking/spinlock.c:162
class_raw_spinlock_irqsave_constructor include/linux/spinlock.h:522 [inline]
try_to_wake_up+0x9a/0x13d0 kernel/sched/core.c:4252
up+0x79/0xb0 kernel/locking/semaphore.c:191
__up_console_sem kernel/printk/printk.c:340 [inline]
__console_unlock kernel/printk/printk.c:2706 [inline]
console_unlock+0x1cf/0x260 kernel/printk/printk.c:3038
vprintk_emit+0x17f/0x5f0 kernel/printk/printk.c:2303
vprintk+0x7b/0x90 kernel/printk/printk_safe.c:45
_printk+0xc8/0x100 kernel/printk/printk.c:2328
kauditd_printk_skb kernel/audit.c:546 [inline]
kauditd_hold_skb+0x1fb/0x240 kernel/audit.c:581
kauditd_send_queue+0x229/0x280 kernel/audit.c:766
kauditd_thread+0x61e/0xa80 kernel/audit.c:890
kthread+0x2c1/0x3a0 kernel/kthread.c:389
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242
-> #0 ((console_sem).lock){-.-.}-{2:2}:
check_prev_add kernel/locking/lockdep.c:3134 [inline]
check_prevs_add kernel/locking/lockdep.c:3253 [inline]
validate_chain kernel/locking/lockdep.c:3869 [inline]
__lock_acquire+0x246e/0x3b30 kernel/locking/lockdep.c:5137
lock_acquire kernel/locking/lockdep.c:5754 [inline]
lock_acquire+0x1b1/0x530 kernel/locking/lockdep.c:5719
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0x3a/0x50 kernel/locking/spinlock.c:162
down_trylock+0x12/0x70 kernel/locking/semaphore.c:139
__down_trylock_console_sem+0x40/0x140 kernel/printk/printk.c:323
console_trylock+0x73/0x130 kernel/printk/printk.c:2659
console_trylock_spinning kernel/printk/printk.c:1923 [inline]
vprintk_emit+0x162/0x5f0 kernel/printk/printk.c:2302
vprintk+0x7b/0x90 kernel/printk/printk_safe.c:45
_printk+0xc8/0x100 kernel/printk/printk.c:2328
__warn_printk+0x158/0x350 kernel/panic.c:721
refcount_warn_saturate+0x149/0x210 lib/refcount.c:28
__refcount_sub_and_test include/linux/refcount.h:283 [inline]
__refcount_dec_and_test include/linux/refcount.h:315 [inline]
refcount_dec_and_test include/linux/refcount.h:333 [inline]
stack_depot_put lib/stackdepot.c:627 [inline]
stack_depot_put+0xe4/0x110 lib/stackdepot.c:613
qlink_free mm/kasan/quarantine.c:158 [inline]
qlist_free_all+0x16d/0x1e0 mm/kasan/quarantine.c:194
kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:301
__kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:306
kasan_slab_alloc include/linux/kasan.h:188 [inline]
slab_post_alloc_hook mm/slub.c:3817 [inline]
slab_alloc_node mm/slub.c:3864 [inline]
__do_kmalloc_node mm/slub.c:3984 [inline]
__kmalloc+0x1bd/0x440 mm/slub.c:3998
kmalloc include/linux/slab.h:594 [inline]
tomoyo_realpath_from_path+0xb9/0x710 security/tomoyo/realpath.c:251
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_perm+0x26f/0x450 security/tomoyo/file.c:822
security_inode_getattr+0xf1/0x150 security/security.c:2237
vfs_getattr fs/stat.c:173 [inline]
vfs_fstat+0x4f/0xc0 fs/stat.c:198
vfs_fstatat+0x130/0x140 fs/stat.c:300
__do_sys_newfstatat+0x98/0x110 fs/stat.c:468
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x62/0x6a
other info that might help us debug this:
Chain exists of:
(console_sem).lock --> &rq->__lock --> pool_rwlock
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(pool_rwlock);
lock(&rq->__lock);
lock(pool_rwlock);
lock((console_sem).lock);
*** DEADLOCK ***
3 locks held by udevadm/25226:
#0: ffffffff8db051d0 (tomoyo_ss){.+.+}-{0:0}, at: srcu_lock_acquire include/linux/srcu.h:116 [inline]
#0: ffffffff8db051d0 (tomoyo_ss){.+.+}-{0:0}, at: srcu_read_lock include/linux/srcu.h:215 [inline]
#0: ffffffff8db051d0 (tomoyo_ss){.+.+}-{0:0}, at: tomoyo_read_lock security/tomoyo/common.h:1108 [inline]
#0: ffffffff8db051d0 (tomoyo_ss){.+.+}-{0:0}, at: tomoyo_path_perm+0x25b/0x450 security/tomoyo/file.c:821
#1: ffffffff8d347290 (remove_cache_srcu){.+.+}-{0:0}, at: srcu_lock_acquire include/linux/srcu.h:116 [inline]
#1: ffffffff8d347290 (remove_cache_srcu){.+.+}-{0:0}, at: srcu_read_lock include/linux/srcu.h:215 [inline]
#1: ffffffff8d347290 (remove_cache_srcu){.+.+}-{0:0}, at: kasan_quarantine_reduce+0x81/0x1d0 mm/kasan/quarantine.c:274
#2: ffffffff8dc791f8 (pool_rwlock){----}-{2:2}, at: stack_depot_put lib/stackdepot.c:621 [inline]
#2: ffffffff8dc791f8 (pool_rwlock){----}-{2:2}, at: stack_depot_put+0x24/0x110 lib/stackdepot.c:613
stack backtrace:
CPU: 0 PID: 25226 Comm: udevadm Not tainted 6.7.0-rc5-next-20231214-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
check_noncircular+0x316/0x400 kernel/locking/lockdep.c:2187
check_prev_add kernel/locking/lockdep.c:3134 [inline]
check_prevs_add kernel/locking/lockdep.c:3253 [inline]
validate_chain kernel/locking/lockdep.c:3869 [inline]
__lock_acquire+0x246e/0x3b30 kernel/locking/lockdep.c:5137
lock_acquire kernel/locking/lockdep.c:5754 [inline]
lock_acquire+0x1b1/0x530 kernel/locking/lockdep.c:5719
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0x3a/0x50 kernel/locking/spinlock.c:162
down_trylock+0x12/0x70 kernel/locking/semaphore.c:139
__down_trylock_console_sem+0x40/0x140 kernel/printk/printk.c:323
console_trylock+0x73/0x130 kernel/printk/printk.c:2659
console_trylock_spinning kernel/printk/printk.c:1923 [inline]
vprintk_emit+0x162/0x5f0 kernel/printk/printk.c:2302
vprintk+0x7b/0x90 kernel/printk/printk_safe.c:45
_printk+0xc8/0x100 kernel/printk/printk.c:2328
__warn_printk+0x158/0x350 kernel/panic.c:721
refcount_warn_saturate+0x149/0x210 lib/refcount.c:28
__refcount_sub_and_test include/linux/refcount.h:283 [inline]
__refcount_dec_and_test include/linux/refcount.h:315 [inline]
refcount_dec_and_test include/linux/refcount.h:333 [inline]
stack_depot_put lib/stackdepot.c:627 [inline]
stack_depot_put+0xe4/0x110 lib/stackdepot.c:613
qlink_free mm/kasan/quarantine.c:158 [inline]
qlist_free_all+0x16d/0x1e0 mm/kasan/quarantine.c:194
kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:301
__kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:306
kasan_slab_alloc include/linux/kasan.h:188 [inline]
slab_post_alloc_hook mm/slub.c:3817 [inline]
slab_alloc_node mm/slub.c:3864 [inline]
__do_kmalloc_node mm/slub.c:3984 [inline]
__kmalloc+0x1bd/0x440 mm/slub.c:3998
kmalloc include/linux/slab.h:594 [inline]
tomoyo_realpath_from_path+0xb9/0x710 security/tomoyo/realpath.c:251
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_perm+0x26f/0x450 security/tomoyo/file.c:822
security_inode_getattr+0xf1/0x150 security/security.c:2237
vfs_getattr fs/stat.c:173 [inline]
vfs_fstat+0x4f/0xc0 fs/stat.c:198
vfs_fstatat+0x130/0x140 fs/stat.c:300
__do_sys_newfstatat+0x98/0x110 fs/stat.c:468
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x62/0x6a
RIP: 0033:0x7f8d7a9165f4
Code: 64 c7 00 09 00 00 00 83 c8 ff c3 48 89 f2 b9 00 01 00 00 48 89 fe bf 9c ff ff ff e9 00 00 00 00 41 89 ca b8 06 01 00 00 0f 05 <45> 31 c0 3d 00 f0 ff ff 76 10 48 8b 15 03 a8 0d 00 f7 d8 41 83 c8
RSP: 002b:00007fffd076bf88 EFLAGS: 00000206 ORIG_RAX: 0000000000000106
RAX: ffffffffffffffda RBX: 00007f8d7a9ee460 RCX: 00007f8d7a9165f4
RDX: 00007fffd076bf90 RSI: 00007f8d7a9b3130 RDI: 0000000000000005
RBP: 0000561f17c3e2a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000001000 R11: 0000000000000206 R12: 0000000000000000
R13: 0000000000003fff R14: 00007fffd076c528 R15: 000000000000000a
refcount_t: underflow; use-after-free.
WARNING: CPU: 0 PID: 25226 at lib/refcount.c:28 refcount_warn_saturate+0x14a/0x210 lib/refcount.c:28
Modules linked in:
CPU: 0 PID: 25226 Comm: udevadm Not tainted 6.7.0-rc5-next-20231214-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023
RIP: 0010:refcount_warn_saturate+0x14a/0x210 lib/refcount.c:28
Code: ff 89 de e8 f8 16 20 fd 84 db 0f 85 66 ff ff ff e8 bb 1b 20 fd c6 05 1d 29 bc 0a 01 90 48 c7 c7 40 11 2f 8b e8 d7 0a e6 fc 90 <0f> 0b 90 90 e9 43 ff ff ff e8 98 1b 20 fd 0f b6 1d f8 28 bc 0a 31
RSP: 0018:ffffc900169d7980 EFLAGS: 00010086
RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff814e0269
RDX: ffff888033b7d940 RSI: ffffffff814e0276 RDI: 0000000000000001
RBP: ffff88801c5f177c R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: fffffffffffe4898 R12: ffffed100576254a
R13: ffff888024d6a000 R14: 0000000000000000 R15: ffff88802bb12a50
FS: 00007f8d7ada4c80(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020011000 CR3: 0000000026cb8000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
__refcount_sub_and_test include/linux/refcount.h:283 [inline]
__refcount_dec_and_test include/linux/refcount.h:315 [inline]
refcount_dec_and_test include/linux/refcount.h:333 [inline]
stack_depot_put lib/stackdepot.c:627 [inline]
stack_depot_put+0xe4/0x110 lib/stackdepot.c:613
qlink_free mm/kasan/quarantine.c:158 [inline]
qlist_free_all+0x16d/0x1e0 mm/kasan/quarantine.c:194
kasan_quarantine_reduce+0x18e/0x1d0 mm/kasan/quarantine.c:301
__kasan_slab_alloc+0x65/0x90 mm/kasan/common.c:306
kasan_slab_alloc include/linux/kasan.h:188 [inline]
slab_post_alloc_hook mm/slub.c:3817 [inline]
slab_alloc_node mm/slub.c:3864 [inline]
__do_kmalloc_node mm/slub.c:3984 [inline]
__kmalloc+0x1bd/0x440 mm/slub.c:3998
kmalloc include/linux/slab.h:594 [inline]
tomoyo_realpath_from_path+0xb9/0x710 security/tomoyo/realpath.c:251
tomoyo_get_realpath security/tomoyo/file.c:151 [inline]
tomoyo_path_perm+0x26f/0x450 security/tomoyo/file.c:822
security_inode_getattr+0xf1/0x150 security/security.c:2237
vfs_getattr fs/stat.c:173 [inline]
vfs_fstat+0x4f/0xc0 fs/stat.c:198
vfs_fstatat+0x130/0x140 fs/stat.c:300
__do_sys_newfstatat+0x98/0x110 fs/stat.c:468
do_syscall_x64 arch/x86/entry/common.c:52 [inline]
do_syscall_64+0x40/0x110 arch/x86/entry/common.c:83
entry_SYSCALL_64_after_hwframe+0x62/0x6a
RIP: 0033:0x7f8d7a9165f4
Code: 64 c7 00 09 00 00 00 83 c8 ff c3 48 89 f2 b9 00 01 00 00 48 89 fe bf 9c ff ff ff e9 00 00 00 00 41 89 ca b8 06 01 00 00 0f 05 <45> 31 c0 3d 00 f0 ff ff 76 10 48 8b 15 03 a8 0d 00 f7 d8 41 83 c8
RSP: 002b:00007fffd076bf88 EFLAGS: 00000206 ORIG_RAX: 0000000000000106
RAX: ffffffffffffffda RBX: 00007f8d7a9ee460 RCX: 00007f8d7a9165f4
RDX: 00007fffd076bf90 RSI: 00007f8d7a9b3130 RDI: 0000000000000005
RBP: 0000561f17c3e2a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000001000 R11: 0000000000000206 R12: 0000000000000000
R13: 0000000000003fff R14: 00007fffd076c528 R15: 000000000000000a