syzbot


inconsistent lock state in valid_state

Status: auto-obsoleted due to no activity on 2023/09/22 20:18
Reported-by: syzbot+e0c5a1672d975de1b492@syzkaller.appspotmail.com
First crash: 393d, last: 314d
Similar bugs (5)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-5.15 inconsistent lock state in valid_state (2) origin:upstream C 76 17h20m 41d 0/3 upstream: reported C repro on 2024/03/13 18:08
upstream inconsistent lock state in valid_state kernel 1 426d 422d 0/26 auto-obsoleted due to no activity on 2023/06/23 05:39
linux-6.1 inconsistent lock state in valid_state (2) origin:upstream missing-backport C done 169 6h22m 214d 0/3 upstream: reported C repro on 2023/09/22 23:56
upstream inconsistent lock state in valid_state (2) sound C inconclusive 56331 37m 77d 0/26 upstream: reported C repro on 2024/02/07 00:07
linux-6.1 inconsistent lock state in valid_state 1 395d 395d 0/3 auto-obsoleted due to no activity on 2023/07/24 01:34

Sample crash report:
================================
WARNING: inconsistent lock state
5.15.117-syzkaller #0 Not tainted
--------------------------------
inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
syz-executor.5/18604 [HC0[0]:SC0[0]:HE0:SE1] takes:
ffffffff8d150f18 (sync_timeline_list_lock){?...}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:388 [inline]
ffffffff8d150f18 (sync_timeline_list_lock){?...}-{2:2}, at: sync_info_debugfs_show+0x90/0x4c0 drivers/dma-buf/sync_debug.c:147
{IN-HARDIRQ-W} state was registered at:
  lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5622
  __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
  _raw_spin_lock_irqsave+0xd1/0x120 kernel/locking/spinlock.c:162
  sync_timeline_debug_remove+0x28/0x140 drivers/dma-buf/sync_debug.c:31
  sync_timeline_free drivers/dma-buf/sw_sync.c:104 [inline]
  kref_put include/linux/kref.h:65 [inline]
  sync_timeline_put drivers/dma-buf/sw_sync.c:116 [inline]
  timeline_fence_release+0x200/0x250 drivers/dma-buf/sw_sync.c:144
  kref_put include/linux/kref.h:65 [inline]
  dma_fence_put include/linux/dma-fence.h:279 [inline]
  dma_fence_array_release+0x127/0x230 drivers/dma-buf/dma-fence-array.c:120
  irq_work_single kernel/irq_work.c:155 [inline]
  irq_work_run_list+0x20b/0x370 kernel/irq_work.c:177
  irq_work_run+0x63/0xe0 kernel/irq_work.c:186
  __sysvec_irq_work+0x9a/0x250 arch/x86/kernel/irq_work.c:22
  sysvec_irq_work+0x89/0xb0 arch/x86/kernel/irq_work.c:17
  asm_sysvec_irq_work+0x16/0x20 arch/x86/include/asm/idtentry.h:664
  __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:169 [inline]
  _raw_spin_unlock_irq+0x25/0x40 kernel/locking/spinlock.c:202
  spin_unlock_irq include/linux/spinlock.h:413 [inline]
  sw_sync_debugfs_release+0x145/0x1c0 drivers/dma-buf/sw_sync.c:321
  __fput+0x3bf/0x890 fs/file_table.c:280
  task_work_run+0x129/0x1a0 kernel/task_work.c:164
  exit_task_work include/linux/task_work.h:32 [inline]
  do_exit+0x6a3/0x2480 kernel/exit.c:872
  do_group_exit+0x144/0x310 kernel/exit.c:994
  get_signal+0xc66/0x14e0 kernel/signal.c:2889
  arch_do_signal_or_restart+0xc3/0x1890 arch/x86/kernel/signal.c:865
  handle_signal_work kernel/entry/common.c:148 [inline]
  exit_to_user_mode_loop+0x97/0x130 kernel/entry/common.c:172
  exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:208
  __syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
  syscall_exit_to_user_mode+0x5d/0x250 kernel/entry/common.c:301
  do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
  entry_SYSCALL_64_after_hwframe+0x61/0xcb
irq event stamp: 192
hardirqs last  enabled at (191): [<ffffffff81ce363d>] mod_memcg_lruvec_state include/linux/memcontrol.h:1039 [inline]
hardirqs last  enabled at (191): [<ffffffff81ce363d>] mod_objcg_mlstate+0x1ed/0x330 mm/memcontrol.c:831
hardirqs last disabled at (192): [<ffffffff8a244739>] __raw_spin_lock_irq include/linux/spinlock_api_smp.h:126 [inline]
hardirqs last disabled at (192): [<ffffffff8a244739>] _raw_spin_lock_irq+0xa9/0x110 kernel/locking/spinlock.c:170
softirqs last  enabled at (0): [<ffffffff814b1639>] copy_process+0x13b9/0x3ef0 kernel/fork.c:2143
softirqs last disabled at (0): [<0000000000000000>] 0x0

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

       CPU0
       ----
  lock(sync_timeline_list_lock);
  <Interrupt>
    lock(sync_timeline_list_lock);

 *** DEADLOCK ***

3 locks held by syz-executor.5/18604:
 #0: ffff888076989c70 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x261/0x300 fs/file.c:1073
 #1: ffff88802ceac2f0 (&p->lock){+.+.}-{3:3}, at: seq_read_iter+0xae/0xd10 fs/seq_file.c:182
 #2: ffffffff8d150f18 (sync_timeline_list_lock){?...}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:388 [inline]
 #2: ffffffff8d150f18 (sync_timeline_list_lock){?...}-{2:2}, at: sync_info_debugfs_show+0x90/0x4c0 drivers/dma-buf/sync_debug.c:147

stack backtrace:
CPU: 1 PID: 18604 Comm: syz-executor.5 Not tainted 5.15.117-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 valid_state+0x134/0x1c0 kernel/locking/lockdep.c:3931
 mark_lock_irq+0xa8/0xba0 kernel/locking/lockdep.c:4134
 mark_lock+0x21a/0x340 kernel/locking/lockdep.c:4590
 mark_held_locks kernel/locking/lockdep.c:4192 [inline]
 __trace_hardirqs_on_caller kernel/locking/lockdep.c:4210 [inline]
 lockdep_hardirqs_on_prepare+0x27d/0x7a0 kernel/locking/lockdep.c:4277
 trace_hardirqs_on+0x67/0x80 kernel/trace/trace_preemptirq.c:49
 __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:168 [inline]
 _raw_spin_unlock_irq+0x1f/0x40 kernel/locking/spinlock.c:202
 spin_unlock_irq include/linux/spinlock.h:413 [inline]
 sync_print_obj drivers/dma-buf/sync_debug.c:118 [inline]
 sync_info_debugfs_show+0x154/0x4c0 drivers/dma-buf/sync_debug.c:153
 seq_read_iter+0x43a/0xd10 fs/seq_file.c:230
 seq_read+0x452/0x5c0 fs/seq_file.c:162
 vfs_read+0x300/0xe10 fs/read_write.c:483
 ksys_read+0x1a2/0x2c0 fs/read_write.c:623
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x3d/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f49c0c4f199
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 f1 19 00 00 90 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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f49bf1c1168 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007f49c0d6ef80 RCX: 00007f49c0c4f199
RDX: 0000000000000034 RSI: 0000000020003540 RDI: 0000000000000007
RBP: 00007f49c0caaca1 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffccafe73af R14: 00007f49bf1c1300 R15: 0000000000022000
 </TASK>

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/14 20:17 linux-5.15.y 471e639e59d1 d2ee9228 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan inconsistent lock state in valid_state
2023/03/27 17:10 linux-5.15.y 115472395b0a f8f96aa9 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-5-15-kasan inconsistent lock state in valid_state
* Struck through repros no longer work on HEAD.