sr 1:0:0:0: [sr0] tag#0 unaligned transfer
sr 1:0:0:0: [sr0] tag#0 unaligned transfer
sr 1:0:0:0: [sr0] tag#0 unaligned transfer
========================================================
WARNING: possible irq lock inversion dependency detected
6.4.0-rc7-next-20230623 #1 Not tainted
--------------------------------------------------------
syz-executor.6/6256 just changed the state of lock:
ffffffff85815818 (blkg_stat_lock){+.-.}-{2:2}, at: __blkcg_rstat_flush.isra.0+0x11f/0x4e0
but this lock was taken by another, HARDIRQ-safe lock in the past:
 (per_cpu_ptr(&cgroup_rstat_cpu_lock, cpu)){-.-.}-{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(blkg_stat_lock);
                               local_irq_disable();
                               lock(per_cpu_ptr(&cgroup_rstat_cpu_lock, cpu));
                               lock(blkg_stat_lock);
  <Interrupt>
    lock(per_cpu_ptr(&cgroup_rstat_cpu_lock, cpu));

 *** DEADLOCK ***

5 locks held by syz-executor.6/6256:
 #0: ffffffff87b85530 (&pmus_srcu){.+.+}-{0:0}, at: perf_event_alloc.part.0+0xcd2/0x3a30
 #1: ffffffff85653808 (kprobe_mutex){+.+.}-{3:3}, at: register_kprobe+0x327/0x1580
 #2: ffffffff854e2d50 (cpu_hotplug_lock){++++}-{0:0}, at: register_kprobe+0xba9/0x1580
 #3: ffffffff8560b5a0 (rcu_callback){....}-{0:0}, at: rcu_core+0x83e/0x28b0
 #4: ffffffff8560b6c0 (rcu_read_lock){....}-{1:2}, at: __blkcg_rstat_flush.isra.0+0x93/0x4e0

the shortest dependencies between 2nd lock and 1st lock:
 -> (per_cpu_ptr(&cgroup_rstat_cpu_lock, cpu)){-.-.}-{2:2} {
    IN-HARDIRQ-W at:
                      lock_acquire+0x19a/0x4c0
                      _raw_spin_lock_irqsave+0x3a/0x60
                      cgroup_rstat_updated+0xcb/0x2e0
                      __cgroup_account_cputime_field+0xa0/0x120
                      account_system_index_time+0x199/0x2c0
                      update_process_times+0x26/0x150
                      tick_sched_handle+0x8e/0x170
                      tick_sched_timer+0xe6/0x110
                      __hrtimer_run_queues+0x17f/0xb60
                      hrtimer_interrupt+0x2ef/0x750
                      __sysvec_apic_timer_interrupt+0xff/0x380
                      sysvec_apic_timer_interrupt+0x69/0x90
                      asm_sysvec_apic_timer_interrupt+0x1a/0x20
                      _raw_spin_unlock_irqrestore+0x34/0x50
                      __wake_up_common_lock+0xe5/0x140
                      d_splice_alias+0x4c3/0xe30
                      kernfs_iop_lookup+0x283/0x330
                      lookup_open.isra.0+0x745/0x1400
                      path_openat+0x96c/0x2710
                      do_filp_open+0x1ba/0x410
                      do_sys_openat2+0x164/0x1d0
                      __x64_sys_openat+0x143/0x200
                      do_syscall_64+0x3f/0x90
                      entry_SYSCALL_64_after_hwframe+0x6e/0xd8
    IN-SOFTIRQ-W at:
                      lock_acquire+0x19a/0x4c0
                      _raw_spin_lock_irqsave+0x3a/0x60
                      cgroup_rstat_updated+0xcb/0x2e0
                      __mod_memcg_state+0x86/0x160
                      memcg_account_kmem+0x38/0x70
                      refill_obj_stock+0x35f/0x5c0
                      kmem_cache_free+0x444/0x4d0
                      file_free_rcu+0xb5/0x100
                      rcu_core+0x8c8/0x28b0
                      __do_softirq+0x1b7/0x7d4
                      irq_exit_rcu+0x93/0xc0
                      sysvec_apic_timer_interrupt+0x6e/0x90
                      asm_sysvec_apic_timer_interrupt+0x1a/0x20
                      unwind_next_frame+0x1aa/0x2490
                      arch_stack_walk+0x87/0xf0
                      stack_trace_save+0x90/0xd0
                      kasan_save_stack+0x22/0x50
                      __kasan_record_aux_stack+0x8e/0xa0
                      __call_rcu_common.constprop.0+0x6a/0xbd0
                      kmem_cache_free+0xc1/0x4d0
                      mt_destroy_walk+0xb1/0x1200
                      __mt_destroy+0x220/0x290
                      do_vmi_align_munmap+0xfb9/0x12e0
                      do_vmi_munmap+0x1f1/0x2b0
                      mmap_region+0x1fe/0x26c0
                      do_mmap+0x833/0xea0
                      vm_mmap_pgoff+0x1a8/0x3b0
                      ksys_mmap_pgoff+0x3af/0x500
                      do_syscall_64+0x3f/0x90
                      entry_SYSCALL_64_after_hwframe+0x6e/0xd8
    INITIAL USE at:
                     lock_acquire+0x19a/0x4c0
                     _raw_spin_lock_irqsave+0x3a/0x60
                     cgroup_rstat_flush_locked+0x131/0xd80
                     cgroup_rstat_flush+0x37/0x50
                     do_flush_stats+0x97/0xf0
                     flush_memcg_stats_dwork+0x9/0x50
                     process_one_work+0xabf/0x1770
                     worker_thread+0x64f/0x12a0
                     kthread+0x33f/0x440
                     ret_from_fork+0x2c/0x50
  }
  ... key      at: [<ffffffff87b7e760>] __key.0+0x0/0x40
  ... acquired at:
   _raw_spin_lock+0x2b/0x40
   __blkcg_rstat_flush.isra.0+0x11f/0x4e0
   blkcg_rstat_flush+0x87/0xb0
   cgroup_rstat_flush_locked+0x706/0xd80
   cgroup_rstat_flush+0x37/0x50
   do_flush_stats+0x97/0xf0
   flush_memcg_stats_dwork+0x9/0x50
   process_one_work+0xabf/0x1770
   worker_thread+0x64f/0x12a0
   kthread+0x33f/0x440
   ret_from_fork+0x2c/0x50

-> (blkg_stat_lock){+.-.}-{2:2} {
   HARDIRQ-ON-W at:
                    lock_acquire+0x19a/0x4c0
                    _raw_spin_lock+0x2b/0x40
                    __blkcg_rstat_flush.isra.0+0x11f/0x4e0
                    __blkg_release+0xfa/0x3b0
                    rcu_core+0x8c8/0x28b0
                    __do_softirq+0x1b7/0x7d4
                    irq_exit_rcu+0x93/0xc0
                    sysvec_apic_timer_interrupt+0x6e/0x90
                    asm_sysvec_apic_timer_interrupt+0x1a/0x20
                    _raw_spin_unlock_irqrestore+0x34/0x50
                    try_to_wake_up+0x64b/0x1b30
                    wake_up_q+0x82/0xf0
                    __mutex_unlock_slowpath+0x20b/0x5e0
                    register_kprobe+0xc3e/0x1580
                    __register_trace_kprobe+0x26a/0x2d0
                    create_local_trace_kprobe+0x1ea/0x3d0
                    perf_kprobe_init+0x119/0x210
                    perf_kprobe_event_init+0xfc/0x1d0
                    perf_try_init_event+0x130/0x570
                    perf_event_alloc.part.0+0xf84/0x3a30
                    __do_sys_perf_event_open+0x4d9/0x2a60
                    do_syscall_64+0x3f/0x90
                    entry_SYSCALL_64_after_hwframe+0x6e/0xd8
   IN-SOFTIRQ-W at:
                    lock_acquire+0x19a/0x4c0
                    _raw_spin_lock+0x2b/0x40
                    __blkcg_rstat_flush.isra.0+0x11f/0x4e0
                    __blkg_release+0xfa/0x3b0
                    rcu_core+0x8c8/0x28b0
                    __do_softirq+0x1b7/0x7d4
                    irq_exit_rcu+0x93/0xc0
                    sysvec_apic_timer_interrupt+0x6e/0x90
                    asm_sysvec_apic_timer_interrupt+0x1a/0x20
                    _raw_spin_unlock_irqrestore+0x34/0x50
                    try_to_wake_up+0x64b/0x1b30
                    wake_up_q+0x82/0xf0
                    __mutex_unlock_slowpath+0x20b/0x5e0
                    register_kprobe+0xc3e/0x1580
                    __register_trace_kprobe+0x26a/0x2d0
                    create_local_trace_kprobe+0x1ea/0x3d0
                    perf_kprobe_init+0x119/0x210
                    perf_kprobe_event_init+0xfc/0x1d0
                    perf_try_init_event+0x130/0x570
                    perf_event_alloc.part.0+0xf84/0x3a30
                    __do_sys_perf_event_open+0x4d9/0x2a60
                    do_syscall_64+0x3f/0x90
                    entry_SYSCALL_64_after_hwframe+0x6e/0xd8
   INITIAL USE at:
                   lock_acquire+0x19a/0x4c0
                   _raw_spin_lock+0x2b/0x40
                   __blkcg_rstat_flush.isra.0+0x11f/0x4e0
                   blkcg_rstat_flush+0x87/0xb0
                   cgroup_rstat_flush_locked+0x706/0xd80
                   cgroup_rstat_flush+0x37/0x50
                   do_flush_stats+0x97/0xf0
                   flush_memcg_stats_dwork+0x9/0x50
                   process_one_work+0xabf/0x1770
                   worker_thread+0x64f/0x12a0
                   kthread+0x33f/0x440
                   ret_from_fork+0x2c/0x50
 }
 ... key      at: [<ffffffff85815818>] blkg_stat_lock+0x18/0x60
 ... acquired at:
   __lock_acquire+0x8b8/0x6340
   lock_acquire+0x19a/0x4c0
   _raw_spin_lock+0x2b/0x40
   __blkcg_rstat_flush.isra.0+0x11f/0x4e0
   __blkg_release+0xfa/0x3b0
   rcu_core+0x8c8/0x28b0
   __do_softirq+0x1b7/0x7d4
   irq_exit_rcu+0x93/0xc0
   sysvec_apic_timer_interrupt+0x6e/0x90
   asm_sysvec_apic_timer_interrupt+0x1a/0x20
   _raw_spin_unlock_irqrestore+0x34/0x50
   try_to_wake_up+0x64b/0x1b30
   wake_up_q+0x82/0xf0
   __mutex_unlock_slowpath+0x20b/0x5e0
   register_kprobe+0xc3e/0x1580
   __register_trace_kprobe+0x26a/0x2d0
   create_local_trace_kprobe+0x1ea/0x3d0
   perf_kprobe_init+0x119/0x210
   perf_kprobe_event_init+0xfc/0x1d0
   perf_try_init_event+0x130/0x570
   perf_event_alloc.part.0+0xf84/0x3a30
   __do_sys_perf_event_open+0x4d9/0x2a60
   do_syscall_64+0x3f/0x90
   entry_SYSCALL_64_after_hwframe+0x6e/0xd8


stack backtrace:
CPU: 0 PID: 6256 Comm: syz-executor.6 Not tainted 6.4.0-rc7-next-20230623 #1
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
Call Trace:
 <IRQ>
 dump_stack_lvl+0x91/0xf0
 print_irq_inversion_bug.part.0+0x3d5/0x570
 mark_lock.part.0+0x900/0x2f50
 __lock_acquire+0x8b8/0x6340
 lock_acquire+0x19a/0x4c0
 _raw_spin_lock+0x2b/0x40
 __blkcg_rstat_flush.isra.0+0x11f/0x4e0
 __blkg_release+0xfa/0x3b0
 rcu_core+0x8c8/0x28b0
 __do_softirq+0x1b7/0x7d4
 irq_exit_rcu+0x93/0xc0
 sysvec_apic_timer_interrupt+0x6e/0x90
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x1a/0x20
RIP: 0010:_raw_spin_unlock_irqrestore+0x34/0x50
Code: c7 18 53 48 89 f3 48 8b 74 24 10 e8 c6 db d8 fc 48 89 ef e8 8e 59 d9 fc 80 e7 02 74 06 e8 44 b5 fe fc fb 65 ff 0d 34 a4 ae 7b <74> 07 5b 5d e9 23 2a 00 00 0f 1f 44 00 00 5b 5d e9 17 2a 00 00 0f
RSP: 0018:ffff888013e7f8e8 EFLAGS: 00000202
RAX: 000000000000076b RBX: 0000000000000283 RCX: ffffffff812d1fbf
RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff8454e68c
RBP: ffff888017afa450 R08: 0000000000000001 R09: fffffbfff0ef9b60
R10: ffffffff877cdb07 R11: 0000000000000001 R12: 0000000000000283
R13: ffff888017afa450 R14: ffff888017af9b54 R15: ffff88806ce39500
 try_to_wake_up+0x64b/0x1b30
 wake_up_q+0x82/0xf0
 __mutex_unlock_slowpath+0x20b/0x5e0
 register_kprobe+0xc3e/0x1580
 __register_trace_kprobe+0x26a/0x2d0
 create_local_trace_kprobe+0x1ea/0x3d0
 perf_kprobe_init+0x119/0x210
 perf_kprobe_event_init+0xfc/0x1d0
 perf_try_init_event+0x130/0x570
 perf_event_alloc.part.0+0xf84/0x3a30
 __do_sys_perf_event_open+0x4d9/0x2a60
 do_syscall_64+0x3f/0x90
 entry_SYSCALL_64_after_hwframe+0x6e/0xd8
RIP: 0033:0x7f9f6e2bab19
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:00007f9f6b830188 EFLAGS: 00000246 ORIG_RAX: 000000000000012a
RAX: ffffffffffffffda RBX: 00007f9f6e3cdf60 RCX: 00007f9f6e2bab19
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000020000280
RBP: 00007f9f6e314f6d R08: 0000000000000000 R09: 0000000000000000
R10: ffffffffffffffff R11: 0000000000000246 R12: 0000000000000000
R13: 00007fff29223d6f R14: 00007f9f6b830300 R15: 0000000000022000
 </TASK>
sr 1:0:0:0: [sr0] tag#0 unaligned transfer
sr 1:0:0:0: [sr0] tag#0 unaligned transfer
ISOFS: Bad logical zone size 12959
loop5: detected capacity change from 0 to 264192
FAT-fs (loop5): invalid media value (0xc7)
FAT-fs (loop5): Can't find a valid FAT filesystem
----------------
Code disassembly (best guess), 1 bytes skipped:
   0:	18 53 48             	sbb    %dl,0x48(%rbx)
   3:	89 f3                	mov    %esi,%ebx
   5:	48 8b 74 24 10       	mov    0x10(%rsp),%rsi
   a:	e8 c6 db d8 fc       	callq  0xfcd8dbd5
   f:	48 89 ef             	mov    %rbp,%rdi
  12:	e8 8e 59 d9 fc       	callq  0xfcd959a5
  17:	80 e7 02             	and    $0x2,%bh
  1a:	74 06                	je     0x22
  1c:	e8 44 b5 fe fc       	callq  0xfcfeb565
  21:	fb                   	sti
  22:	65 ff 0d 34 a4 ae 7b 	decl   %gs:0x7baea434(%rip)        # 0x7baea45d
* 29:	74 07                	je     0x32 <-- trapping instruction
  2b:	5b                   	pop    %rbx
  2c:	5d                   	pop    %rbp
  2d:	e9 23 2a 00 00       	jmpq   0x2a55
  32:	0f 1f 44 00 00       	nopl   0x0(%rax,%rax,1)
  37:	5b                   	pop    %rbx
  38:	5d                   	pop    %rbp
  39:	e9 17 2a 00 00       	jmpq   0x2a55
  3e:	0f                   	.byte 0xf