========================================================
WARNING: possible irq lock inversion dependency detected
6.7.0-rc1-next-20231117-syzkaller #0 Not tainted
--------------------------------------------------------
syz-executor.2/5105 just changed the state of lock:
ffff88801d02ebf8 (&new_timer->it_lock){-...}-{2:2}, at: posix_timer_fn+0x2d/0x3d0 kernel/time/posix-timers.c:318
but this lock took another, HARDIRQ-unsafe lock in the past:
 (&sighand->siglock){+.+.}-{2:2}


and interrupts could create inverse lock ordering between them.


other info that might help us debug this:
 Possible interrupt unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&sighand->siglock);
                               local_irq_disable();
                               lock(&new_timer->it_lock);
                               lock(&sighand->siglock);
  <Interrupt>
    lock(&new_timer->it_lock);

 *** DEADLOCK ***

7 locks held by syz-executor.2/5105:
 #0: ffffffff8d0af1b0 (dup_mmap_sem){.+.+}-{0:0}, at: dup_mmap kernel/fork.c:655 [inline]
 #0: ffffffff8d0af1b0 (dup_mmap_sem){.+.+}-{0:0}, at: dup_mm kernel/fork.c:1709 [inline]
 #0: ffffffff8d0af1b0 (dup_mmap_sem){.+.+}-{0:0}, at: copy_mm kernel/fork.c:1758 [inline]
 #0: ffffffff8d0af1b0 (dup_mmap_sem){.+.+}-{0:0}, at: copy_process+0x42a6/0x9770 kernel/fork.c:2520
 #1: ffff88807b66e0a0 (&mm->mmap_lock){++++}-{3:3}, at: mmap_write_lock_killable include/linux/mmap_lock.h:124 [inline]
 #1: ffff88807b66e0a0 (&mm->mmap_lock){++++}-{3:3}, at: dup_mmap kernel/fork.c:656 [inline]
 #1: ffff88807b66e0a0 (&mm->mmap_lock){++++}-{3:3}, at: dup_mm kernel/fork.c:1709 [inline]
 #1: ffff88807b66e0a0 (&mm->mmap_lock){++++}-{3:3}, at: copy_mm kernel/fork.c:1758 [inline]
 #1: ffff88807b66e0a0 (&mm->mmap_lock){++++}-{3:3}, at: copy_process+0x42cc/0x9770 kernel/fork.c:2520
 #2: ffff888028f181a0 (&mm->mmap_lock/1){+.+.}-{3:3}, at: mmap_write_lock_nested include/linux/mmap_lock.h:115 [inline]
 #2: ffff888028f181a0 (&mm->mmap_lock/1){+.+.}-{3:3}, at: dup_mmap kernel/fork.c:665 [inline]
 #2: ffff888028f181a0 (&mm->mmap_lock/1){+.+.}-{3:3}, at: dup_mm kernel/fork.c:1709 [inline]
 #2: ffff888028f181a0 (&mm->mmap_lock/1){+.+.}-{3:3}, at: copy_mm kernel/fork.c:1758 [inline]
 #2: ffff888028f181a0 (&mm->mmap_lock/1){+.+.}-{3:3}, at: copy_process+0x432c/0x9770 kernel/fork.c:2520
 #3: ffffffff8cfad060 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:301 [inline]
 #3: ffffffff8cfad060 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:747 [inline]
 #3: ffffffff8cfad060 (rcu_read_lock){....}-{1:2}, at: __pte_offset_map+0x42/0x540 mm/pgtable-generic.c:285
 #4: ffff888079231858 (ptlock_ptr(ptdesc)#2){+.+.}-{2:2}, at: spin_lock include/linux/spinlock.h:351 [inline]
 #4: ffff888079231858 (ptlock_ptr(ptdesc)#2){+.+.}-{2:2}, at: __pte_offset_map_lock+0xf1/0x2f0 mm/pgtable-generic.c:373
 #5: ffffffff8cfad060 (rcu_read_lock){....}-{1:2}, at: rcu_lock_acquire include/linux/rcupdate.h:301 [inline]
 #5: ffffffff8cfad060 (rcu_read_lock){....}-{1:2}, at: rcu_read_lock include/linux/rcupdate.h:747 [inline]
 #5: ffffffff8cfad060 (rcu_read_lock){....}-{1:2}, at: __pte_offset_map+0x42/0x540 mm/pgtable-generic.c:285
 #6: ffff888029246618 (ptlock_ptr(ptdesc)#2/1){+.+.}-{2:2}, at: copy_pte_range mm/memory.c:1052 [inline]
 #6: ffff888029246618 (ptlock_ptr(ptdesc)#2/1){+.+.}-{2:2}, at: copy_pmd_range mm/memory.c:1180 [inline]
 #6: ffff888029246618 (ptlock_ptr(ptdesc)#2/1){+.+.}-{2:2}, at: copy_pud_range mm/memory.c:1217 [inline]
 #6: ffff888029246618 (ptlock_ptr(ptdesc)#2/1){+.+.}-{2:2}, at: copy_p4d_range mm/memory.c:1241 [inline]
 #6: ffff888029246618 (ptlock_ptr(ptdesc)#2/1){+.+.}-{2:2}, at: copy_page_range+0xd1c/0x3c40 mm/memory.c:1339

the shortest dependencies between 2nd lock and 1st lock:
 -> (&sighand->siglock){+.+.}-{2:2} {
    HARDIRQ-ON-W at:
                      lock_acquire kernel/locking/lockdep.c:5753 [inline]
                      lock_acquire+0x1b1/0x530 kernel/locking/lockdep.c:5718
                      __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
                      _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
                      spin_lock include/linux/spinlock.h:351 [inline]
                      class_spinlock_constructor include/linux/spinlock.h:530 [inline]
                      ptrace_set_stopped kernel/ptrace.c:391 [inline]
                      ptrace_attach+0x401/0x650 kernel/ptrace.c:478
                      __do_sys_ptrace+0x204/0x230 kernel/ptrace.c:1290
                      do_syscall_x64 arch/x86/entry/common.c:51 [inline]
                      do_syscall_64+0x40/0x110 arch/x86/entry/common.c:82
                      entry_SYSCALL_64_after_hwframe+0x62/0x6a
    SOFTIRQ-ON-W at:
                      lock_acquire kernel/locking/lockdep.c:5753 [inline]
                      lock_acquire+0x1b1/0x530 kernel/locking/lockdep.c:5718
                      __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
                      _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
                      spin_lock include/linux/spinlock.h:351 [inline]
                      class_spinlock_constructor include/linux/spinlock.h:530 [inline]
                      ptrace_set_stopped kernel/ptrace.c:391 [inline]
                      ptrace_attach+0x401/0x650 kernel/ptrace.c:478
                      __do_sys_ptrace+0x204/0x230 kernel/ptrace.c:1290
                      do_syscall_x64 arch/x86/entry/common.c:51 [inline]
                      do_syscall_64+0x40/0x110 arch/x86/entry/common.c:82
                      entry_SYSCALL_64_after_hwframe+0x62/0x6a
    INITIAL USE at:
                     lock_acquire kernel/locking/lockdep.c:5753 [inline]
                     lock_acquire+0x1b1/0x530 kernel/locking/lockdep.c:5718
                     __raw_spin_lock_irq include/linux/spinlock_api_smp.h:119 [inline]
                     _raw_spin_lock_irq+0x36/0x50 kernel/locking/spinlock.c:170
                     spin_lock_irq include/linux/spinlock.h:376 [inline]
                     calculate_sigpending+0x44/0xa0 kernel/signal.c:197
                     ret_from_fork+0x23/0x80 arch/x86/kernel/process.c:143
                     ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:242
  }
  ... key      at: [<ffffffff90b4af80>] __key.341+0x0/0x40
  ... acquired at:
   __raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
   _raw_spin_lock+0x2e/0x40 kernel/locking/spinlock.c:154
   spin_lock include/linux/spinlock.h:351 [inline]
   __do_sys_timer_delete kernel/time/posix-timers.c:1023 [inline]
   __se_sys_timer_delete kernel/time/posix-timers.c:1006 [inline]
   __x64_sys_timer_delete+0x16a/0x3e0 kernel/time/posix-timers.c:1006
   do_syscall_x64 arch/x86/entry/common.c:51 [inline]
   do_syscall_64+0x40/0x110 arch/x86/entry/common.c:82
   entry_SYSCALL_64_after_hwframe+0x62/0x6a

-> (&new_timer->it_lock){-...}-{2:2} {
   IN-HARDIRQ-W at:
                    lock_acquire kernel/locking/lockdep.c:5753 [inline]
                    lock_acquire+0x1b1/0x530 kernel/locking/lockdep.c:5718
                    __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
                    _raw_spin_lock_irqsave+0x3a/0x50 kernel/locking/spinlock.c:162
                    posix_timer_fn+0x2d/0x3d0 kernel/time/posix-timers.c:318
                    __run_hrtimer kernel/time/hrtimer.c:1688 [inline]
                    __hrtimer_run_queues+0x20c/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:645
                    check_kcov_mode kernel/kcov.c:175 [inline]
                    write_comp_data+0x34/0x80 kernel/kcov.c:236
                    mm_counter_file include/linux/mm.h:2600 [inline]
                    copy_present_pte mm/memory.c:967 [inline]
                    copy_pte_range mm/memory.c:1095 [inline]
                    copy_pmd_range mm/memory.c:1180 [inline]
                    copy_pud_range mm/memory.c:1217 [inline]
                    copy_p4d_range mm/memory.c:1241 [inline]
                    copy_page_range+0x1022/0x3c40 mm/memory.c:1339
                    dup_mmap kernel/fork.c:765 [inline]
                    dup_mm kernel/fork.c:1709 [inline]
                    copy_mm kernel/fork.c:1758 [inline]
                    copy_process+0x5c30/0x9770 kernel/fork.c:2520
                    kernel_clone+0xfd/0x940 kernel/fork.c:2925
                    __do_sys_clone+0xba/0x100 kernel/fork.c:3068
                    do_syscall_x64 arch/x86/entry/common.c:51 [inline]
                    do_syscall_64+0x40/0x110 arch/x86/entry/common.c:82
                    entry_SYSCALL_64_after_hwframe+0x62/0x6a
   INITIAL USE at:
                   lock_acquire kernel/locking/lockdep.c:5753 [inline]
                   lock_acquire+0x1b1/0x530 kernel/locking/lockdep.c:5718
                   __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
                   _raw_spin_lock_irqsave+0x3a/0x50 kernel/locking/spinlock.c:162
                   itimer_delete kernel/time/posix-timers.c:1048 [inline]
                   exit_itimers+0x255/0x560 kernel/time/posix-timers.c:1109
                   do_exit+0x629/0x2ad0 kernel/exit.c:845
                   do_group_exit+0xd3/0x2a0 kernel/exit.c:1021
                   get_signal+0x2395/0x2770 kernel/signal.c:2902
                   arch_do_signal_or_restart+0x90/0x7e0 arch/x86/kernel/signal.c:309
                   exit_to_user_mode_loop kernel/entry/common.c:168 [inline]
                   exit_to_user_mode_prepare+0x11e/0x240 kernel/entry/common.c:204
                   __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
                   syscall_exit_to_user_mode+0x1e/0x60 kernel/entry/common.c:296
                   do_syscall_64+0x4d/0x110 arch/x86/entry/common.c:88
                   entry_SYSCALL_64_after_hwframe+0x62/0x6a
 }
 ... key      at: [<ffffffff9280bea0>] __key.0+0x0/0x40
 ... acquired at:
   mark_usage kernel/locking/lockdep.c:4563 [inline]
   __lock_acquire+0x1347/0x3b10 kernel/locking/lockdep.c:5090
   lock_acquire kernel/locking/lockdep.c:5753 [inline]
   lock_acquire+0x1b1/0x530 kernel/locking/lockdep.c:5718
   __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
   _raw_spin_lock_irqsave+0x3a/0x50 kernel/locking/spinlock.c:162
   posix_timer_fn+0x2d/0x3d0 kernel/time/posix-timers.c:318
   __run_hrtimer kernel/time/hrtimer.c:1688 [inline]
   __hrtimer_run_queues+0x20c/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:645
   check_kcov_mode kernel/kcov.c:175 [inline]
   write_comp_data+0x34/0x80 kernel/kcov.c:236
   mm_counter_file include/linux/mm.h:2600 [inline]
   copy_present_pte mm/memory.c:967 [inline]
   copy_pte_range mm/memory.c:1095 [inline]
   copy_pmd_range mm/memory.c:1180 [inline]
   copy_pud_range mm/memory.c:1217 [inline]
   copy_p4d_range mm/memory.c:1241 [inline]
   copy_page_range+0x1022/0x3c40 mm/memory.c:1339
   dup_mmap kernel/fork.c:765 [inline]
   dup_mm kernel/fork.c:1709 [inline]
   copy_mm kernel/fork.c:1758 [inline]
   copy_process+0x5c30/0x9770 kernel/fork.c:2520
   kernel_clone+0xfd/0x940 kernel/fork.c:2925
   __do_sys_clone+0xba/0x100 kernel/fork.c:3068
   do_syscall_x64 arch/x86/entry/common.c:51 [inline]
   do_syscall_64+0x40/0x110 arch/x86/entry/common.c:82
   entry_SYSCALL_64_after_hwframe+0x62/0x6a


stack backtrace:
CPU: 1 PID: 5105 Comm: syz-executor.2 Not tainted 6.7.0-rc1-next-20231117-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/10/2023
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
 print_irq_inversion_bug.part.0+0x3e1/0x590 kernel/locking/lockdep.c:4079
 print_irq_inversion_bug kernel/locking/lockdep.c:4032 [inline]
 check_usage_forwards kernel/locking/lockdep.c:4110 [inline]
 mark_lock_irq kernel/locking/lockdep.c:4242 [inline]
 mark_lock+0x570/0xc50 kernel/locking/lockdep.c:4677
 mark_usage kernel/locking/lockdep.c:4563 [inline]
 __lock_acquire+0x1347/0x3b10 kernel/locking/lockdep.c:5090
 lock_acquire kernel/locking/lockdep.c:5753 [inline]
 lock_acquire+0x1b1/0x530 kernel/locking/lockdep.c:5718
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0x3a/0x50 kernel/locking/spinlock.c:162
 posix_timer_fn+0x2d/0x3d0 kernel/time/posix-timers.c:318
 __run_hrtimer kernel/time/hrtimer.c:1688 [inline]
 __hrtimer_run_queues+0x20c/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
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x1a/0x20 arch/x86/include/asm/idtentry.h:645
RIP: 0010:write_comp_data+0x34/0x80 kernel/kcov.c:236
Code: 48 8b 15 6f b3 7b 7e 65 8b 05 70 b3 7b 7e a9 00 01 ff 00 74 0f f6 c4 01 74 59 8b 82 fc 15 00 00 85 c0 74 4f 8b 82 d8 15 00 00 <83> f8 03 75 44 48 8b 82 e0 15 00 00 8b 92 dc 15 00 00 48 8b 38 48
RSP: 0018:ffffc90003d6f7d8 EFLAGS: 00000246
RAX: 0000000000000000 RBX: 800000002cadd007 RCX: ffffffff81ca24d2
RDX: ffff888026c45940 RSI: 0000000000000000 RDI: 0000000000000001
RBP: ffffea0000b2b740 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000007 R12: ffffea0000b2b740
R13: 0000000000000000 R14: dffffc0000000000 R15: ffff888035afbae8
 mm_counter_file include/linux/mm.h:2600 [inline]
 copy_present_pte mm/memory.c:967 [inline]
 copy_pte_range mm/memory.c:1095 [inline]
 copy_pmd_range mm/memory.c:1180 [inline]
 copy_pud_range mm/memory.c:1217 [inline]
 copy_p4d_range mm/memory.c:1241 [inline]
 copy_page_range+0x1022/0x3c40 mm/memory.c:1339
 dup_mmap kernel/fork.c:765 [inline]
 dup_mm kernel/fork.c:1709 [inline]
 copy_mm kernel/fork.c:1758 [inline]
 copy_process+0x5c30/0x9770 kernel/fork.c:2520
 kernel_clone+0xfd/0x940 kernel/fork.c:2925
 __do_sys_clone+0xba/0x100 kernel/fork.c:3068
 do_syscall_x64 arch/x86/entry/common.c:51 [inline]
 do_syscall_64+0x40/0x110 arch/x86/entry/common.c:82
 entry_SYSCALL_64_after_hwframe+0x62/0x6a
RIP: 0033:0x7f7915679b13
Code: 1f 84 00 00 00 00 00 64 48 8b 04 25 10 00 00 00 45 31 c0 31 d2 31 f6 bf 11 00 20 01 4c 8d 90 d0 02 00 00 b8 38 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 35 89 c2 85 c0 75 2c 64 48 8b 04 25 10 00 00
RSP: 002b:00007ffe5424a408 EFLAGS: 00000246 ORIG_RAX: 0000000000000038
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f7915679b13
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000001200011
RBP: 0000000000000001 R08: 0000000000000000 R09: 0000000000000000
R10: 0000555556615750 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000001 R15: 0000000000000001
 </TASK>
----------------
Code disassembly (best guess):
   0:	48 8b 15 6f b3 7b 7e 	mov    0x7e7bb36f(%rip),%rdx        # 0x7e7bb376
   7:	65 8b 05 70 b3 7b 7e 	mov    %gs:0x7e7bb370(%rip),%eax        # 0x7e7bb37e
   e:	a9 00 01 ff 00       	test   $0xff0100,%eax
  13:	74 0f                	je     0x24
  15:	f6 c4 01             	test   $0x1,%ah
  18:	74 59                	je     0x73
  1a:	8b 82 fc 15 00 00    	mov    0x15fc(%rdx),%eax
  20:	85 c0                	test   %eax,%eax
  22:	74 4f                	je     0x73
  24:	8b 82 d8 15 00 00    	mov    0x15d8(%rdx),%eax
* 2a:	83 f8 03             	cmp    $0x3,%eax <-- trapping instruction
  2d:	75 44                	jne    0x73
  2f:	48 8b 82 e0 15 00 00 	mov    0x15e0(%rdx),%rax
  36:	8b 92 dc 15 00 00    	mov    0x15dc(%rdx),%edx
  3c:	48 8b 38             	mov    (%rax),%rdi
  3f:	48                   	rex.W