------------[ cut here ]------------
======================================================
WARNING: possible circular locking dependency detected
6.7.0-rc4-syzkaller-00358-gf2e8a57ee903 #0 Not tainted
------------------------------------------------------
swapper/0/0 is trying to acquire lock:
ffffffff8ceb5480 (console_owner){....}-{0:0}, at: console_lock_spinning_enable kernel/printk/printk.c:1854 [inline]
ffffffff8ceb5480 (console_owner){....}-{0:0}, at: console_emit_next_record kernel/printk/printk.c:2895 [inline]
ffffffff8ceb5480 (console_owner){....}-{0:0}, at: console_flush_all+0x49a/0xd60 kernel/printk/printk.c:2967
but task is already holding lock:
ffff8880b983c758 (&rq->__lock){-.-.}-{2:2}, at: raw_spin_rq_lock_nested+0x29/0x130 kernel/sched/core.c:558
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #4 (&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:1349 [inline]
rq_lock kernel/sched/sched.h:1663 [inline]
task_fork_fair+0x70/0x240 kernel/sched/fair.c:12586
sched_cgroup_fork+0x3cf/0x510 kernel/sched/core.c:4812
copy_process+0x4c86/0x73f0 kernel/fork.c:2609
kernel_clone+0xfd/0x930 kernel/fork.c:2907
user_mode_thread+0xb4/0xf0 kernel/fork.c:2985
rest_init+0x27/0x2b0 init/main.c:695
arch_call_rest_init+0x13/0x30 init/main.c:827
start_kernel+0x39f/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+0x166/0x16b
-> #3 (&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:518 [inline]
try_to_wake_up+0xb0/0x13d0 kernel/sched/core.c:4226
__wake_up_common+0x129/0x1d0 kernel/sched/wait.c:89
__wake_up_common_lock kernel/sched/wait.c:106 [inline]
__wake_up+0x31/0x50 kernel/sched/wait.c:127
tty_port_default_wakeup+0x2a/0x40 drivers/tty/tty_port.c:69
serial8250_tx_chars+0x542/0x890 drivers/tty/serial/8250/8250_port.c:1835
serial8250_handle_irq+0x5be/0x760 drivers/tty/serial/8250/8250_port.c:1942
serial8250_default_handle_irq+0x94/0x210 drivers/tty/serial/8250/8250_port.c:1962
serial8250_interrupt+0xfc/0x200 drivers/tty/serial/8250/8250_core.c:127
__handle_irq_event_percpu+0x22a/0x750 kernel/irq/handle.c:158
handle_irq_event_percpu kernel/irq/handle.c:193 [inline]
handle_irq_event+0xab/0x1e0 kernel/irq/handle.c:210
handle_edge_irq+0x261/0xcf0 kernel/irq/chip.c:831
generic_handle_irq_desc include/linux/irqdesc.h:161 [inline]
handle_irq arch/x86/kernel/irq.c:238 [inline]
__common_interrupt+0xdb/0x240 arch/x86/kernel/irq.c:257
common_interrupt+0xab/0xd0 arch/x86/kernel/irq.c:247
asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:640
bytes_is_nonzero mm/kasan/generic.c:85 [inline]
memory_is_nonzero mm/kasan/generic.c:102 [inline]
memory_is_poisoned_n mm/kasan/generic.c:127 [inline]
memory_is_poisoned mm/kasan/generic.c:159 [inline]
check_region_inline mm/kasan/generic.c:178 [inline]
kasan_check_range+0x10d/0x190 mm/kasan/generic.c:187
instrument_atomic_read include/linux/instrumented.h:68 [inline]
atomic_read include/linux/atomic/atomic-instrumented.h:32 [inline]
page_table_check_set mm/page_table_check.c:121 [inline]
page_table_check_set+0x49d/0x9a0 mm/page_table_check.c:97
__page_table_check_ptes_set+0x1cc/0x220 mm/page_table_check.c:196
page_table_check_ptes_set include/linux/page_table_check.h:74 [inline]
set_ptes include/linux/pgtable.h:234 [inline]
set_pte_range+0x5a6/0xa10 mm/memory.c:4420
filemap_map_order0_folio mm/filemap.c:3501 [inline]
filemap_map_pages+0x458/0x1290 mm/filemap.c:3547
do_fault_around mm/memory.c:4587 [inline]
do_read_fault mm/memory.c:4620 [inline]
do_fault mm/memory.c:4763 [inline]
do_pte_missing mm/memory.c:3731 [inline]
handle_pte_fault mm/memory.c:5039 [inline]
__handle_mm_fault+0x25ac/0x3d70 mm/memory.c:5180
handle_mm_fault+0x47a/0xa10 mm/memory.c:5345
do_user_addr_fault+0x30b/0x1000 arch/x86/mm/fault.c:1364
handle_page_fault arch/x86/mm/fault.c:1505 [inline]
exc_page_fault+0x5d/0xc0 arch/x86/mm/fault.c:1561
asm_exc_page_fault+0x26/0x30 arch/x86/include/asm/idtentry.h:570
-> #2 (&tty->write_wait){-.-.}-{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
__wake_up_common_lock kernel/sched/wait.c:105 [inline]
__wake_up+0x1c/0x50 kernel/sched/wait.c:127
tty_port_default_wakeup+0x2a/0x40 drivers/tty/tty_port.c:69
serial8250_tx_chars+0x542/0x890 drivers/tty/serial/8250/8250_port.c:1835
serial8250_handle_irq+0x5be/0x760 drivers/tty/serial/8250/8250_port.c:1942
serial8250_default_handle_irq+0x94/0x210 drivers/tty/serial/8250/8250_port.c:1962
serial8250_interrupt+0xfc/0x200 drivers/tty/serial/8250/8250_core.c:127
__handle_irq_event_percpu+0x22a/0x750 kernel/irq/handle.c:158
handle_irq_event_percpu kernel/irq/handle.c:193 [inline]
handle_irq_event+0xab/0x1e0 kernel/irq/handle.c:210
handle_edge_irq+0x261/0xcf0 kernel/irq/chip.c:831
generic_handle_irq_desc include/linux/irqdesc.h:161 [inline]
handle_irq arch/x86/kernel/irq.c:238 [inline]
__common_interrupt+0xdb/0x240 arch/x86/kernel/irq.c:257
common_interrupt+0xab/0xd0 arch/x86/kernel/irq.c:247
asm_common_interrupt+0x26/0x40 arch/x86/include/asm/idtentry.h:640
__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
_raw_spin_unlock_irqrestore+0x31/0x70 kernel/locking/spinlock.c:194
spin_unlock_irqrestore include/linux/spinlock.h:406 [inline]
uart_port_unlock_irqrestore include/linux/serial_core.h:667 [inline]
uart_write+0x316/0x5b0 drivers/tty/serial/serial_core.c:617
process_output_block drivers/tty/n_tty.c:574 [inline]
n_tty_write+0x422/0x1130 drivers/tty/n_tty.c:2379
iterate_tty_write drivers/tty/tty_io.c:1021 [inline]
file_tty_write.constprop.0+0x519/0x9b0 drivers/tty/tty_io.c:1092
tty_write drivers/tty/tty_io.c:1113 [inline]
redirected_tty_write drivers/tty/tty_io.c:1136 [inline]
redirected_tty_write+0xa6/0xc0 drivers/tty/tty_io.c:1116
call_write_iter include/linux/fs.h:2020 [inline]
new_sync_write fs/read_write.c:491 [inline]
vfs_write+0x64f/0xdf0 fs/read_write.c:584
ksys_write+0x12f/0x250 fs/read_write.c:637
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+0x63/0x6b
-> #1 (&port_lock_key){-.-.}-{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
uart_port_lock_irqsave include/linux/serial_core.h:616 [inline]
serial8250_console_write+0xa7c/0x1060 drivers/tty/serial/8250/8250_port.c:3403
console_emit_next_record kernel/printk/printk.c:2901 [inline]
console_flush_all+0x4d5/0xd60 kernel/printk/printk.c:2967
console_unlock+0x10c/0x260 kernel/printk/printk.c:3036
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
register_console+0xa74/0x1060 kernel/printk/printk.c:3542
univ8250_console_init+0x35/0x50 drivers/tty/serial/8250/8250_core.c:717
console_init+0xba/0x5d0 kernel/printk/printk.c:3688
start_kernel+0x25a/0x480 init/main.c:1008
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+0x166/0x16b
-> #0 (console_owner){....}-{0:0}:
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+0x2433/0x3b20 kernel/locking/lockdep.c:5137
lock_acquire kernel/locking/lockdep.c:5754 [inline]
lock_acquire+0x1ae/0x520 kernel/locking/lockdep.c:5719
console_lock_spinning_enable kernel/printk/printk.c:1854 [inline]
console_emit_next_record kernel/printk/printk.c:2895 [inline]
console_flush_all+0x4af/0xd60 kernel/printk/printk.c:2967
console_unlock+0x10c/0x260 kernel/printk/printk.c:3036
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
__report_bug lib/bug.c:195 [inline]
report_bug+0x492/0x580 lib/bug.c:219
handle_bug+0x3d/0x70 arch/x86/kernel/traps.c:237
exc_invalid_op+0x17/0x40 arch/x86/kernel/traps.c:258
asm_exc_invalid_op+0x1a/0x20 arch/x86/include/asm/idtentry.h:568
__phys_addr+0xd4/0x140 arch/x86/mm/physaddr.c:28
build_cr3+0xc/0x40 arch/x86/mm/tlb.c:160
load_new_mm_cr3+0x14/0x80 arch/x86/mm/tlb.c:289
switch_mm_irqs_off+0x672/0xb60 arch/x86/mm/tlb.c:643
context_switch kernel/sched/core.c:5360 [inline]
__schedule+0xcf1/0x5af0 kernel/sched/core.c:6688
schedule_idle+0x5b/0x90 kernel/sched/core.c:6804
do_idle+0x28c/0x400 kernel/sched/idle.c:310
cpu_startup_entry+0x50/0x60 kernel/sched/idle.c:380
rest_init+0x16f/0x2b0 init/main.c:730
arch_call_rest_init+0x13/0x30 init/main.c:827
start_kernel+0x39f/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+0x166/0x16b
other info that might help us debug this:
Chain exists of:
console_owner --> &p->pi_lock --> &rq->__lock
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock(&rq->__lock);
lock(&p->pi_lock);
lock(&rq->__lock);
lock(console_owner);
*** DEADLOCK ***
3 locks held by swapper/0/0:
#0: ffff8880b983c758 (&rq->__lock){-.-.}-{2:2}, at: raw_spin_rq_lock_nested+0x29/0x130 kernel/sched/core.c:558
#1: ffffffff8cf958c0 (console_lock){+.+.}-{0:0}, at: console_trylock_spinning kernel/printk/printk.c:1923 [inline]
#1: ffffffff8cf958c0 (console_lock){+.+.}-{0:0}, at: vprintk_emit+0x162/0x5f0 kernel/printk/printk.c:2302
#2: ffffffff8cf95930 (console_srcu){....}-{0:0}, at: rcu_lock_acquire include/linux/rcupdate.h:301 [inline]
#2: ffffffff8cf95930 (console_srcu){....}-{0:0}, at: srcu_read_lock_nmisafe include/linux/srcu.h:232 [inline]
#2: ffffffff8cf95930 (console_srcu){....}-{0:0}, at: console_srcu_read_lock kernel/printk/printk.c:286 [inline]
#2: ffffffff8cf95930 (console_srcu){....}-{0:0}, at: console_flush_all+0x12a/0xd60 kernel/printk/printk.c:2959
stack backtrace:
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.7.0-rc4-syzkaller-00358-gf2e8a57ee903 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
Call Trace:
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
check_noncircular+0x317/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+0x2433/0x3b20 kernel/locking/lockdep.c:5137
lock_acquire kernel/locking/lockdep.c:5754 [inline]
lock_acquire+0x1ae/0x520 kernel/locking/lockdep.c:5719
console_lock_spinning_enable kernel/printk/printk.c:1854 [inline]
console_emit_next_record kernel/printk/printk.c:2895 [inline]
console_flush_all+0x4af/0xd60 kernel/printk/printk.c:2967
console_unlock+0x10c/0x260 kernel/printk/printk.c:3036
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
__report_bug lib/bug.c:195 [inline]
report_bug+0x492/0x580 lib/bug.c:219
handle_bug+0x3d/0x70 arch/x86/kernel/traps.c:237
exc_invalid_op+0x17/0x40 arch/x86/kernel/traps.c:258
asm_exc_invalid_op+0x1a/0x20 arch/x86/include/asm/idtentry.h:568
RIP: 0010:__phys_addr+0xd4/0x140 arch/x86/mm/physaddr.c:28
Code: 89 d8 31 ff 48 d3 e8 48 89 c5 48 89 c6 e8 e4 42 4b 00 48 85 ed 75 0d e8 4a 47 4b 00 48 89 d8 5b 5d 41 5c c3 e8 3d 47 4b 00 90 <0f> 0b e8 35 47 4b 00 48 c7 c0 10 00 da 8c 48 ba 00 00 00 00 00 fc
RSP: 0018:ffffffff8cc07bb0 EFLAGS: 00010012
RAX: 0000000040000000 RBX: 0000778100040048 RCX: ffffffff813b38a0
RDX: ffffffff8cc95900 RSI: ffffffff813b3923 RDI: 0000000000000006
RBP: 0000000180040048 R08: 0000000000000006 R09: 0000000180040048
R10: 0000778100040048 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000100040048 R14: ffff88807d48d600 R15: 0000000200000001
build_cr3+0xc/0x40 arch/x86/mm/tlb.c:160
load_new_mm_cr3+0x14/0x80 arch/x86/mm/tlb.c:289
switch_mm_irqs_off+0x672/0xb60 arch/x86/mm/tlb.c:643
context_switch kernel/sched/core.c:5360 [inline]
__schedule+0xcf1/0x5af0 kernel/sched/core.c:6688
schedule_idle+0x5b/0x90 kernel/sched/core.c:6804
do_idle+0x28c/0x400 kernel/sched/idle.c:310
cpu_startup_entry+0x50/0x60 kernel/sched/idle.c:380
rest_init+0x16f/0x2b0 init/main.c:730
arch_call_rest_init+0x13/0x30 init/main.c:827
start_kernel+0x39f/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+0x166/0x16b
kernel BUG at arch/x86/mm/physaddr.c:28!
invalid opcode: 0000 [#1] PREEMPT SMP KASAN
CPU: 0 PID: 0 Comm: swapper/0 Not tainted 6.7.0-rc4-syzkaller-00358-gf2e8a57ee903 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
RIP: 0010:__phys_addr+0xd4/0x140 arch/x86/mm/physaddr.c:28
Code: 89 d8 31 ff 48 d3 e8 48 89 c5 48 89 c6 e8 e4 42 4b 00 48 85 ed 75 0d e8 4a 47 4b 00 48 89 d8 5b 5d 41 5c c3 e8 3d 47 4b 00 90 <0f> 0b e8 35 47 4b 00 48 c7 c0 10 00 da 8c 48 ba 00 00 00 00 00 fc
RSP: 0018:ffffffff8cc07bb0 EFLAGS: 00010012
RAX: 0000000040000000 RBX: 0000778100040048 RCX: ffffffff813b38a0
RDX: ffffffff8cc95900 RSI: ffffffff813b3923 RDI: 0000000000000006
RBP: 0000000180040048 R08: 0000000000000006 R09: 0000000180040048
R10: 0000778100040048 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000100040048 R14: ffff88807d48d600 R15: 0000000200000001
FS: 0000000000000000(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffe7b6b3000 CR3: 000000001fbdc000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
build_cr3+0xc/0x40 arch/x86/mm/tlb.c:160
load_new_mm_cr3+0x14/0x80 arch/x86/mm/tlb.c:289
switch_mm_irqs_off+0x672/0xb60 arch/x86/mm/tlb.c:643
context_switch kernel/sched/core.c:5360 [inline]
__schedule+0xcf1/0x5af0 kernel/sched/core.c:6688
schedule_idle+0x5b/0x90 kernel/sched/core.c:6804
do_idle+0x28c/0x400 kernel/sched/idle.c:310
cpu_startup_entry+0x50/0x60 kernel/sched/idle.c:380
rest_init+0x16f/0x2b0 init/main.c:730
arch_call_rest_init+0x13/0x30 init/main.c:827
start_kernel+0x39f/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+0x166/0x16b
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__phys_addr+0xd4/0x140 arch/x86/mm/physaddr.c:28
Code: 89 d8 31 ff 48 d3 e8 48 89 c5 48 89 c6 e8 e4 42 4b 00 48 85 ed 75 0d e8 4a 47 4b 00 48 89 d8 5b 5d 41 5c c3 e8 3d 47 4b 00 90 <0f> 0b e8 35 47 4b 00 48 c7 c0 10 00 da 8c 48 ba 00 00 00 00 00 fc
RSP: 0018:ffffffff8cc07bb0 EFLAGS: 00010012
RAX: 0000000040000000 RBX: 0000778100040048 RCX: ffffffff813b38a0
RDX: ffffffff8cc95900 RSI: ffffffff813b3923 RDI: 0000000000000006
RBP: 0000000180040048 R08: 0000000000000006 R09: 0000000180040048
R10: 0000778100040048 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000100040048 R14: ffff88807d48d600 R15: 0000000200000001
FS: 0000000000000000(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffe7b6b3000 CR3: 000000001fbdc000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400