syzbot


inconsistent lock state in sync_info_debugfs_show

Status: upstream: reported C repro on 2022/01/27 16:33
Reported-by: syzbot+007bfe0f3330f6e1e7d1@syzkaller.appspotmail.com
First crash: 374d, last: 10d

Cause bisection: introduced by (bisect log) :
commit 997acaf6b4b59c6a9c259740312a69ea549cc684
Author: Mark Rutland <mark.rutland@arm.com>
Date: Mon Jan 11 15:37:07 2021 +0000

  lockdep: report broken irq restoration

Crash: WARNING in kvm_wait (log)
Repro: C syz .config
Last patch testing requests:
Created Duration User Patch Repo Result
2022/11/19 09:51 21m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 84368d882b96 report log
2022/11/19 08:10 13m hdanton@sina.com patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 84368d882b96 report log

Sample crash report:
================================
WARNING: inconsistent lock state
6.1.0-rc7-syzkaller-00103-gef4d3ea40565 #0 Not tainted
--------------------------------
inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
syz-executor191/3635 [HC0[0]:SC0[0]:HE0:SE1] takes:
ffffffff8d27adf8 (sync_timeline_list_lock){?...}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:375 [inline]
ffffffff8d27adf8 (sync_timeline_list_lock){?...}-{2:2}, at: sync_info_debugfs_show+0x31/0x200 drivers/dma-buf/sync_debug.c:147
{IN-HARDIRQ-W} state was registered at:
  lock_acquire kernel/locking/lockdep.c:5668 [inline]
  lock_acquire+0x1e3/0x630 kernel/locking/lockdep.c:5633
  __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
  _raw_spin_lock_irqsave+0x3d/0x60 kernel/locking/spinlock.c:162
  sync_timeline_debug_remove+0x29/0x1a0 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+0x267/0x340 drivers/dma-buf/sw_sync.c:144
  dma_fence_release+0x14b/0x690 drivers/dma-buf/dma-fence.c:559
  kref_put include/linux/kref.h:65 [inline]
  dma_fence_put include/linux/dma-fence.h:276 [inline]
  dma_fence_array_release+0x1fa/0x2d0 drivers/dma-buf/dma-fence-array.c:120
  dma_fence_release+0x14b/0x690 drivers/dma-buf/dma-fence.c:559
  kref_put include/linux/kref.h:65 [inline]
  dma_fence_put include/linux/dma-fence.h:276 [inline]
  irq_dma_fence_array_work+0xa9/0xd0 drivers/dma-buf/dma-fence-array.c:52
  irq_work_single+0x124/0x260 kernel/irq_work.c:211
  irq_work_run_list kernel/irq_work.c:242 [inline]
  irq_work_run_list+0x91/0xc0 kernel/irq_work.c:225
  irq_work_run+0x58/0xd0 kernel/irq_work.c:251
  __sysvec_irq_work+0xce/0x4e0 arch/x86/kernel/irq_work.c:22
  sysvec_irq_work+0x92/0xc0 arch/x86/kernel/irq_work.c:17
  asm_sysvec_irq_work+0x1a/0x20 arch/x86/include/asm/idtentry.h:675
  __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:160 [inline]
  _raw_spin_unlock_irq+0x29/0x50 kernel/locking/spinlock.c:202
  spin_unlock_irq include/linux/spinlock.h:400 [inline]
  sw_sync_debugfs_release+0x162/0x240 drivers/dma-buf/sw_sync.c:321
  __fput+0x27c/0xa90 fs/file_table.c:320
  task_work_run+0x16f/0x270 kernel/task_work.c:179
  ptrace_notify+0x118/0x140 kernel/signal.c:2354
  ptrace_report_syscall include/linux/ptrace.h:420 [inline]
  ptrace_report_syscall_exit include/linux/ptrace.h:482 [inline]
  syscall_exit_work kernel/entry/common.c:251 [inline]
  syscall_exit_to_user_mode_prepare+0x129/0x280 kernel/entry/common.c:278
  __syscall_exit_to_user_mode_work kernel/entry/common.c:283 [inline]
  syscall_exit_to_user_mode+0xd/0x50 kernel/entry/common.c:296
  do_syscall_64+0x46/0xb0 arch/x86/entry/common.c:86
  entry_SYSCALL_64_after_hwframe+0x63/0xcd
irq event stamp: 666
hardirqs last  enabled at (665): [<ffffffff89f07713>] __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:159 [inline]
hardirqs last  enabled at (665): [<ffffffff89f07713>] _raw_spin_unlock_irq+0x23/0x50 kernel/locking/spinlock.c:202
hardirqs last disabled at (666): [<ffffffff89f074c5>] __raw_spin_lock_irq include/linux/spinlock_api_smp.h:117 [inline]
hardirqs last disabled at (666): [<ffffffff89f074c5>] _raw_spin_lock_irq+0x45/0x50 kernel/locking/spinlock.c:170
softirqs last  enabled at (0): [<ffffffff8149e759>] copy_process+0x2129/0x7190 kernel/fork.c:2198
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 ***

2 locks held by syz-executor191/3635:
 #0: ffff8880253ebd58 (&p->lock){+.+.}-{3:3}, at: seq_read_iter+0xe3/0x1280 fs/seq_file.c:182
 #1: ffffffff8d27adf8 (sync_timeline_list_lock){?...}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:375 [inline]
 #1: ffffffff8d27adf8 (sync_timeline_list_lock){?...}-{2:2}, at: sync_info_debugfs_show+0x31/0x200 drivers/dma-buf/sync_debug.c:147

stack backtrace:
CPU: 0 PID: 3635 Comm: syz-executor191 Not tainted 6.1.0-rc7-syzkaller-00103-gef4d3ea40565 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xd1/0x138 lib/dump_stack.c:106
 print_usage_bug kernel/locking/lockdep.c:3963 [inline]
 valid_state kernel/locking/lockdep.c:3975 [inline]
 mark_lock_irq kernel/locking/lockdep.c:4178 [inline]
 mark_lock.part.0.cold+0x18/0xd8 kernel/locking/lockdep.c:4634
 mark_lock kernel/locking/lockdep.c:4598 [inline]
 mark_held_locks+0x9f/0xe0 kernel/locking/lockdep.c:4236
 __trace_hardirqs_on_caller kernel/locking/lockdep.c:4254 [inline]
 lockdep_hardirqs_on_prepare kernel/locking/lockdep.c:4321 [inline]
 lockdep_hardirqs_on_prepare+0x139/0x410 kernel/locking/lockdep.c:4273
 trace_hardirqs_on+0x31/0x160 kernel/trace/trace_preemptirq.c:49
 __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:159 [inline]
 _raw_spin_unlock_irq+0x23/0x50 kernel/locking/spinlock.c:202
 spin_unlock_irq include/linux/spinlock.h:400 [inline]
 sync_print_obj drivers/dma-buf/sync_debug.c:118 [inline]
 sync_info_debugfs_show+0xef/0x200 drivers/dma-buf/sync_debug.c:153
 seq_read_iter+0x4f9/0x1280 fs/seq_file.c:230
 seq_read+0x171/0x210 fs/seq_file.c:162
 vfs_read+0x25b/0x930 fs/read_write.c:468
 ksys_read+0x12b/0x250 fs/read_write.c:613
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x39/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fb920c25049
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 b1 14 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fff7e030748 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00000000000f4240 RCX: 00007fb920c25049
RDX: 0000000000002020 RSI: 0000000020002200 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000001
R10: 00007fff7e0301c0 R11: 0000000000000246 R12: 00007fb920be8820
R13: 0000000000000000 R14: 00007fff7e030770 R15: 00007fff7e030760
 </TASK>

Crashes (29):
Manager Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets Title
ci-upstream-kasan-gce-root 2022/12/02 06:35 upstream ef4d3ea40565 e080de16 .config strace log report syz C [disk image] [vmlinux] [kernel image] inconsistent lock state in sync_info_debugfs_show
ci-upstream-kasan-gce 2022/11/19 02:45 upstream 84368d882b96 5bb70014 .config strace log report syz C [disk image] [vmlinux] [kernel image] inconsistent lock state in sync_info_debugfs_show
ci-upstream-linux-next-kasan-gce-root 2022/12/30 10:44 linux-next c76083fac3ba 44712fbc .config strace log report syz C [disk image] [vmlinux] [kernel image] inconsistent lock state in sync_info_debugfs_show
ci-upstream-gce-arm64 2022/11/19 02:47 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci 9500fc6e9e60 5bb70014 .config console log report syz C [disk image] [vmlinux] [kernel image] inconsistent lock state in sync_info_debugfs_show
ci-upstream-kasan-gce 2023/01/23 02:20 upstream 2241ab53cbb5 559a440a .config console log report info [disk image] [vmlinux] [kernel image] inconsistent lock state in sync_info_debugfs_show
ci-upstream-kasan-gce-selinux-root 2022/12/11 12:02 upstream 4cee37b3a4e6 67be1ae7 .config console log report info [disk image] [vmlinux] [kernel image] inconsistent lock state in sync_info_debugfs_show
ci-upstream-kasan-gce 2022/12/08 00:36 upstream 479174d402bc d88f3abb .config console log report info [disk image] [vmlinux] [kernel image] inconsistent lock state in sync_info_debugfs_show
ci-upstream-kasan-gce 2022/10/01 01:55 upstream 5a77386984b5 feb56351 .config console log report info inconsistent lock state in sync_info_debugfs_show
ci-upstream-kasan-gce 2022/09/30 23:34 upstream 5a77386984b5 feb56351 .config console log report info inconsistent lock state in sync_info_debugfs_show
ci-upstream-kasan-gce-smack-root 2022/08/12 09:17 upstream 7ebfc85e2cd7 402cd70d .config console log report info inconsistent lock state in sync_info_debugfs_show
ci-upstream-kasan-gce 2022/08/05 23:28 upstream 200e340f2196 e853abd9 .config console log report info inconsistent lock state in sync_info_debugfs_show
ci-upstream-kasan-gce-root 2022/06/10 13:10 upstream 874c8ca1e60b 0d5abf15 .config console log report info inconsistent lock state in sync_info_debugfs_show
ci-upstream-kasan-gce-smack-root 2022/04/28 20:40 upstream 259b897e5a79 e9076525 .config console log report info inconsistent lock state in sync_info_debugfs_show
ci-upstream-kasan-gce-smack-root 2022/04/25 22:40 upstream d615b5416f8a 152baedd .config console log report info inconsistent lock state in sync_info_debugfs_show
ci-upstream-kasan-gce-root 2022/04/18 22:26 upstream b2d229d4ddb1 8bcc32a6 .config console log report info inconsistent lock state in sync_info_debugfs_show
ci-upstream-kasan-gce-selinux-root 2022/03/17 22:02 upstream 551acdc3c3d2 e2d91b1d .config console log report info inconsistent lock state in sync_info_debugfs_show
ci-upstream-kasan-gce-root 2022/03/04 03:05 upstream 38f80f42147f 45a13a73 .config console log report info inconsistent lock state in sync_info_debugfs_show
ci-qemu-upstream 2022/02/14 08:37 upstream 754e0b0e3560 8b9ca619 .config console log report info inconsistent lock state in sync_info_debugfs_show
ci-upstream-kasan-gce-selinux-root 2022/01/23 16:24 upstream 1c52283265a4 214351e1 .config console log report info inconsistent lock state in sync_info_debugfs_show
ci-upstream-kasan-gce-386 2022/08/05 08:20 upstream 200e340f2196 1c9013ac .config console log report info inconsistent lock state in sync_info_debugfs_show
ci-qemu-upstream-386 2022/02/16 11:00 upstream c5d9ae265b10 8b9ca619 .config console log report info inconsistent lock state in sync_info_debugfs_show
ci-qemu-upstream-386 2022/02/14 09:50 upstream 754e0b0e3560 8b9ca619 .config console log report info inconsistent lock state in sync_info_debugfs_show
ci-qemu-upstream-386 2022/02/12 13:16 upstream 83e396641110 8b9ca619 .config console log report info inconsistent lock state in sync_info_debugfs_show
ci-upstream-linux-next-kasan-gce-root 2022/02/17 19:26 linux-next ef6b35306dd8 3cd800e4 .config console log report info inconsistent lock state in sync_info_debugfs_show
ci-upstream-gce-arm64 2022/09/25 19:17 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci c194837ebb57 0042f2b4 .config console log report info [disk image] [vmlinux] inconsistent lock state in sync_info_debugfs_show
ci-upstream-gce-arm64 2022/09/23 11:00 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci d2cd2931d2fd 0042f2b4 .config console log report info inconsistent lock state in sync_info_debugfs_show
ci-upstream-gce-arm64 2022/09/22 00:54 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci aa49f95768a9 60af5050 .config console log report info [disk image] [vmlinux] inconsistent lock state in sync_info_debugfs_show
ci-upstream-gce-arm64 2022/09/12 16:50 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a6b443748715 f371ed7e .config console log report info [disk image] [vmlinux] inconsistent lock state in sync_info_debugfs_show
ci-upstream-gce-arm64 2022/09/01 01:41 git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci a41a877bc12d b01ec571 .config console log report info inconsistent lock state in sync_info_debugfs_show
* Struck through repros no longer work on HEAD.