===================================================== WARNING: HARDIRQ-safe -> HARDIRQ-unsafe lock order detected 5.12.0-rc5-next-20210401-syzkaller #0 Not tainted ----------------------------------------------------- syz-executor.4/13690 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire: ffffc900017f2230 (&kvm->arch.pvclock_gtod_sync_lock){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:359 [inline] ffffc900017f2230 (&kvm->arch.pvclock_gtod_sync_lock){+.+.}-{2:2}, at: get_kvmclock_ns+0x25/0x390 arch/x86/kvm/x86.c:2623 and this task is already holding: ffff8880b9c352d8 (&rq->lock){-.-.}-{2:2}, at: rq_lock kernel/sched/sched.h:1329 [inline] ffff8880b9c352d8 (&rq->lock){-.-.}-{2:2}, at: __schedule+0x21c/0x2160 kernel/sched/core.c:4996 which would create a new lock dependency: (&rq->lock){-.-.}-{2:2} -> (&kvm->arch.pvclock_gtod_sync_lock){+.+.}-{2:2} but this new dependency connects a HARDIRQ-irq-safe lock: (&rq->lock){-.-.}-{2:2} ... which became HARDIRQ-irq-safe at: lock_acquire kernel/locking/lockdep.c:5512 [inline] lock_acquire+0x1ab/0x740 kernel/locking/lockdep.c:5477 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:151 rq_lock kernel/sched/sched.h:1329 [inline] scheduler_tick+0x9f/0x3d0 kernel/sched/core.c:4545 update_process_times+0x191/0x200 kernel/time/timer.c:1787 tick_periodic+0x79/0x230 kernel/time/tick-common.c:100 tick_handle_periodic+0x41/0x120 kernel/time/tick-common.c:112 timer_interrupt+0x3f/0x60 arch/x86/kernel/time.c:57 __handle_irq_event_percpu+0x303/0x8f0 kernel/irq/handle.c:156 handle_irq_event_percpu kernel/irq/handle.c:196 [inline] handle_irq_event+0x102/0x290 kernel/irq/handle.c:213 handle_edge_irq+0x25f/0xd00 kernel/irq/chip.c:819 generic_handle_irq_desc include/linux/irqdesc.h:158 [inline] handle_irq arch/x86/kernel/irq.c:231 [inline] __common_interrupt+0x9e/0x200 arch/x86/kernel/irq.c:250 common_interrupt+0x9f/0xd0 arch/x86/kernel/irq.c:240 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:623 __sanitizer_cov_trace_pc+0x0/0x60 kernel/kcov.c:917 console_unlock+0x7c9/0xc40 kernel/printk/printk.c:2653 vprintk_emit+0x1ca/0x560 kernel/printk/printk.c:2174 vprintk+0x8d/0x260 kernel/printk/printk_safe.c:392 printk+0xba/0xed kernel/printk/printk.c:2216 pid_idr_init+0x56/0xbd kernel/pid.c:618 start_kernel+0x402/0x496 init/main.c:1031 secondary_startup_64_no_verify+0xb0/0xbb to a HARDIRQ-irq-unsafe lock: (&kvm->arch.pvclock_gtod_sync_lock){+.+.}-{2:2} ... which became HARDIRQ-irq-unsafe at: ... lock_acquire kernel/locking/lockdep.c:5512 [inline] lock_acquire+0x1ab/0x740 kernel/locking/lockdep.c:5477 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:359 [inline] kvm_synchronize_tsc+0x459/0x1230 arch/x86/kvm/x86.c:2368 kvm_arch_vcpu_postcreate+0x73/0x180 arch/x86/kvm/x86.c:10241 kvm_vm_ioctl_create_vcpu arch/x86/kvm/../../../virt/kvm/kvm_main.c:3239 [inline] kvm_vm_ioctl+0x1b2d/0x2800 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3839 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl fs/ioctl.c:739 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xae other info that might help us debug this: Possible interrupt unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&kvm->arch.pvclock_gtod_sync_lock); local_irq_disable(); lock(&rq->lock); lock(&kvm->arch.pvclock_gtod_sync_lock); lock(&rq->lock); *** DEADLOCK *** 2 locks held by syz-executor.4/13690: #0: ffff88807f1980c8 (&vcpu->mutex){+.+.}-{3:3}, at: kvm_vcpu_ioctl+0x175/0xd90 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3293 #1: ffff8880b9c352d8 (&rq->lock){-.-.}-{2:2}, at: rq_lock kernel/sched/sched.h:1329 [inline] #1: ffff8880b9c352d8 (&rq->lock){-.-.}-{2:2}, at: __schedule+0x21c/0x2160 kernel/sched/core.c:4996 the dependencies between HARDIRQ-irq-safe lock and the holding lock: -> (&rq->lock){-.-.}-{2:2} { IN-HARDIRQ-W at: lock_acquire kernel/locking/lockdep.c:5512 [inline] lock_acquire+0x1ab/0x740 kernel/locking/lockdep.c:5477 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:151 rq_lock kernel/sched/sched.h:1329 [inline] scheduler_tick+0x9f/0x3d0 kernel/sched/core.c:4545 update_process_times+0x191/0x200 kernel/time/timer.c:1787 tick_periodic+0x79/0x230 kernel/time/tick-common.c:100 tick_handle_periodic+0x41/0x120 kernel/time/tick-common.c:112 timer_interrupt+0x3f/0x60 arch/x86/kernel/time.c:57 __handle_irq_event_percpu+0x303/0x8f0 kernel/irq/handle.c:156 handle_irq_event_percpu kernel/irq/handle.c:196 [inline] handle_irq_event+0x102/0x290 kernel/irq/handle.c:213 handle_edge_irq+0x25f/0xd00 kernel/irq/chip.c:819 generic_handle_irq_desc include/linux/irqdesc.h:158 [inline] handle_irq arch/x86/kernel/irq.c:231 [inline] __common_interrupt+0x9e/0x200 arch/x86/kernel/irq.c:250 common_interrupt+0x9f/0xd0 arch/x86/kernel/irq.c:240 asm_common_interrupt+0x1e/0x40 arch/x86/include/asm/idtentry.h:623 __sanitizer_cov_trace_pc+0x0/0x60 kernel/kcov.c:917 console_unlock+0x7c9/0xc40 kernel/printk/printk.c:2653 vprintk_emit+0x1ca/0x560 kernel/printk/printk.c:2174 vprintk+0x8d/0x260 kernel/printk/printk_safe.c:392 printk+0xba/0xed kernel/printk/printk.c:2216 pid_idr_init+0x56/0xbd kernel/pid.c:618 start_kernel+0x402/0x496 init/main.c:1031 secondary_startup_64_no_verify+0xb0/0xbb IN-SOFTIRQ-W at: lock_acquire kernel/locking/lockdep.c:5512 [inline] lock_acquire+0x1ab/0x740 kernel/locking/lockdep.c:5477 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:151 rq_lock kernel/sched/sched.h:1329 [inline] ttwu_queue kernel/sched/core.c:3193 [inline] try_to_wake_up+0x5fd/0x1580 kernel/sched/core.c:3473 call_timer_fn+0x1a5/0x6b0 kernel/time/timer.c:1417 expire_timers kernel/time/timer.c:1462 [inline] __run_timers.part.0+0x67c/0xa50 kernel/time/timer.c:1731 __run_timers kernel/time/timer.c:1712 [inline] run_timer_softirq+0xb3/0x1d0 kernel/time/timer.c:1744 __do_softirq+0x29b/0x9f6 kernel/softirq.c:559 invoke_softirq kernel/softirq.c:433 [inline] __irq_exit_rcu+0x136/0x200 kernel/softirq.c:637 irq_exit_rcu+0x5/0x20 kernel/softirq.c:649 sysvec_apic_timer_interrupt+0x93/0xc0 arch/x86/kernel/apic/apic.c:1100 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:632 native_safe_halt arch/x86/include/asm/irqflags.h:51 [inline] arch_safe_halt arch/x86/include/asm/irqflags.h:89 [inline] default_idle+0xe/0x10 arch/x86/kernel/process.c:683 default_idle_call+0x87/0xd0 kernel/sched/idle.c:112 cpuidle_idle_call kernel/sched/idle.c:194 [inline] do_idle+0x401/0x590 kernel/sched/idle.c:306 cpu_startup_entry+0x14/0x20 kernel/sched/idle.c:403 start_kernel+0x475/0x496 init/main.c:1064 secondary_startup_64_no_verify+0xb0/0xbb INITIAL USE at: lock_acquire kernel/locking/lockdep.c:5512 [inline] lock_acquire+0x1ab/0x740 kernel/locking/lockdep.c:5477 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline] _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:159 rq_attach_root+0x20/0x2e0 kernel/sched/topology.c:470 sched_init+0x6e8/0xbf3 kernel/sched/core.c:8220 start_kernel+0x18e/0x496 init/main.c:920 secondary_startup_64_no_verify+0xb0/0xbb } ... key at: [] __key.301+0x0/0x40 ... acquired at: lock_acquire kernel/locking/lockdep.c:5512 [inline] lock_acquire+0x1ab/0x740 kernel/locking/lockdep.c:5477 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:359 [inline] get_kvmclock_ns+0x25/0x390 arch/x86/kvm/x86.c:2623 kvm_xen_update_runstate+0x3d/0x2c0 arch/x86/kvm/xen.c:69 kvm_xen_update_runstate_guest+0x74/0x320 arch/x86/kvm/xen.c:100 kvm_xen_runstate_set_preempted arch/x86/kvm/xen.h:96 [inline] kvm_arch_vcpu_put+0x2d8/0x5a0 arch/x86/kvm/x86.c:4098 kvm_sched_out+0xbf/0x100 arch/x86/kvm/../../../virt/kvm/kvm_main.c:4876 __fire_sched_out_preempt_notifiers kernel/sched/core.c:3931 [inline] fire_sched_out_preempt_notifiers kernel/sched/core.c:3939 [inline] prepare_task_switch kernel/sched/core.c:4135 [inline] context_switch kernel/sched/core.c:4281 [inline] __schedule+0xef8/0x2160 kernel/sched/core.c:5079 preempt_schedule_common+0x45/0xc0 kernel/sched/core.c:5239 preempt_schedule_thunk+0x16/0x18 arch/x86/entry/thunk_64.S:35 vcpu_enter_guest+0x2ebf/0x4730 arch/x86/kvm/x86.c:9256 vcpu_run arch/x86/kvm/x86.c:9340 [inline] kvm_arch_vcpu_ioctl_run+0x47d/0x1990 arch/x86/kvm/x86.c:9568 kvm_vcpu_ioctl+0x467/0xd90 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3316 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl fs/ioctl.c:739 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xae the dependencies between the lock to be acquired and HARDIRQ-irq-unsafe lock: -> (&kvm->arch.pvclock_gtod_sync_lock){+.+.}-{2:2} { HARDIRQ-ON-W at: lock_acquire kernel/locking/lockdep.c:5512 [inline] lock_acquire+0x1ab/0x740 kernel/locking/lockdep.c:5477 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:359 [inline] kvm_synchronize_tsc+0x459/0x1230 arch/x86/kvm/x86.c:2368 kvm_arch_vcpu_postcreate+0x73/0x180 arch/x86/kvm/x86.c:10241 kvm_vm_ioctl_create_vcpu arch/x86/kvm/../../../virt/kvm/kvm_main.c:3239 [inline] kvm_vm_ioctl+0x1b2d/0x2800 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3839 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl fs/ioctl.c:739 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xae SOFTIRQ-ON-W at: lock_acquire kernel/locking/lockdep.c:5512 [inline] lock_acquire+0x1ab/0x740 kernel/locking/lockdep.c:5477 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:359 [inline] kvm_synchronize_tsc+0x459/0x1230 arch/x86/kvm/x86.c:2368 kvm_arch_vcpu_postcreate+0x73/0x180 arch/x86/kvm/x86.c:10241 kvm_vm_ioctl_create_vcpu arch/x86/kvm/../../../virt/kvm/kvm_main.c:3239 [inline] kvm_vm_ioctl+0x1b2d/0x2800 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3839 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl fs/ioctl.c:739 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xae INITIAL USE at: lock_acquire kernel/locking/lockdep.c:5512 [inline] lock_acquire+0x1ab/0x740 kernel/locking/lockdep.c:5477 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:359 [inline] kvm_synchronize_tsc+0x459/0x1230 arch/x86/kvm/x86.c:2368 kvm_arch_vcpu_postcreate+0x73/0x180 arch/x86/kvm/x86.c:10241 kvm_vm_ioctl_create_vcpu arch/x86/kvm/../../../virt/kvm/kvm_main.c:3239 [inline] kvm_vm_ioctl+0x1b2d/0x2800 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3839 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl fs/ioctl.c:739 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xae } ... key at: [] __key.4+0x0/0x40 ... acquired at: lock_acquire kernel/locking/lockdep.c:5512 [inline] lock_acquire+0x1ab/0x740 kernel/locking/lockdep.c:5477 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:359 [inline] get_kvmclock_ns+0x25/0x390 arch/x86/kvm/x86.c:2623 kvm_xen_update_runstate+0x3d/0x2c0 arch/x86/kvm/xen.c:69 kvm_xen_update_runstate_guest+0x74/0x320 arch/x86/kvm/xen.c:100 kvm_xen_runstate_set_preempted arch/x86/kvm/xen.h:96 [inline] kvm_arch_vcpu_put+0x2d8/0x5a0 arch/x86/kvm/x86.c:4098 kvm_sched_out+0xbf/0x100 arch/x86/kvm/../../../virt/kvm/kvm_main.c:4876 __fire_sched_out_preempt_notifiers kernel/sched/core.c:3931 [inline] fire_sched_out_preempt_notifiers kernel/sched/core.c:3939 [inline] prepare_task_switch kernel/sched/core.c:4135 [inline] context_switch kernel/sched/core.c:4281 [inline] __schedule+0xef8/0x2160 kernel/sched/core.c:5079 preempt_schedule_common+0x45/0xc0 kernel/sched/core.c:5239 preempt_schedule_thunk+0x16/0x18 arch/x86/entry/thunk_64.S:35 vcpu_enter_guest+0x2ebf/0x4730 arch/x86/kvm/x86.c:9256 vcpu_run arch/x86/kvm/x86.c:9340 [inline] kvm_arch_vcpu_ioctl_run+0x47d/0x1990 arch/x86/kvm/x86.c:9568 kvm_vcpu_ioctl+0x467/0xd90 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3316 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl fs/ioctl.c:739 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xae stack backtrace: CPU: 0 PID: 13690 Comm: syz-executor.4 Not tainted 5.12.0-rc5-next-20210401-syzkaller #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:79 [inline] dump_stack+0x141/0x1d7 lib/dump_stack.c:120 print_bad_irq_dependency kernel/locking/lockdep.c:2462 [inline] check_irq_usage.cold+0x4d6/0x6c5 kernel/locking/lockdep.c:2691 check_prev_add kernel/locking/lockdep.c:2942 [inline] check_prevs_add kernel/locking/lockdep.c:3061 [inline] validate_chain kernel/locking/lockdep.c:3676 [inline] __lock_acquire+0x2a2f/0x5230 kernel/locking/lockdep.c:4902 lock_acquire kernel/locking/lockdep.c:5512 [inline] lock_acquire+0x1ab/0x740 kernel/locking/lockdep.c:5477 __raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline] _raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:151 spin_lock include/linux/spinlock.h:359 [inline] get_kvmclock_ns+0x25/0x390 arch/x86/kvm/x86.c:2623 kvm_xen_update_runstate+0x3d/0x2c0 arch/x86/kvm/xen.c:69 kvm_xen_update_runstate_guest+0x74/0x320 arch/x86/kvm/xen.c:100 kvm_xen_runstate_set_preempted arch/x86/kvm/xen.h:96 [inline] kvm_arch_vcpu_put+0x2d8/0x5a0 arch/x86/kvm/x86.c:4098 kvm_sched_out+0xbf/0x100 arch/x86/kvm/../../../virt/kvm/kvm_main.c:4876 __fire_sched_out_preempt_notifiers kernel/sched/core.c:3931 [inline] fire_sched_out_preempt_notifiers kernel/sched/core.c:3939 [inline] prepare_task_switch kernel/sched/core.c:4135 [inline] context_switch kernel/sched/core.c:4281 [inline] __schedule+0xef8/0x2160 kernel/sched/core.c:5079 preempt_schedule_common+0x45/0xc0 kernel/sched/core.c:5239 preempt_schedule_thunk+0x16/0x18 arch/x86/entry/thunk_64.S:35 vcpu_enter_guest+0x2ebf/0x4730 arch/x86/kvm/x86.c:9256 vcpu_run arch/x86/kvm/x86.c:9340 [inline] kvm_arch_vcpu_ioctl_run+0x47d/0x1990 arch/x86/kvm/x86.c:9568 kvm_vcpu_ioctl+0x467/0xd90 arch/x86/kvm/../../../virt/kvm/kvm_main.c:3316 vfs_ioctl fs/ioctl.c:48 [inline] __do_sys_ioctl fs/ioctl.c:753 [inline] __se_sys_ioctl fs/ioctl.c:739 [inline] __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:739 do_syscall_64+0x2d/0x70 arch/x86/entry/common.c:46 entry_SYSCALL_64_after_hwframe+0x44/0xae RIP: 0033:0x466459 Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 00 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 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f6511440188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 000000000056bf60 RCX: 0000000000466459 RDX: 0000000000000000 RSI: 000000000000ae80 RDI: 0000000000000005 RBP: 00000000004bf9fb R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf60 R13: 00007ffce769411f R14: 00007f6511440300 R15: 0000000000022000