syzbot


inconsistent lock state in io_timeout_fn

Status: closed as dup on 2021/11/26 14:29
Subsystems: fs
[Documentation on labels]
Reported-by: syzbot+3cb756a49d2f394a9ee3@syzkaller.appspotmail.com
Fix commit: 6af3f48bf615 io_uring: fix link traversal locking
First crash: 1121d, last: 1119d
Duplicate of
Title Repro Cause bisect Fix bisect Count Last Reported
inconsistent lock state in io_poll_remove_all fs 63 1119d 1121d
Discussions (3)
Title Replies (including bot) Last reply
[PATCH 5.15 000/179] 5.15.6-rc1 review 189 (189) 2021/12/01 02:29
[PATCH 0/2] 5.16 fixes for syz reports 6 (6) 2021/11/26 15:36
[syzbot] inconsistent lock state in io_timeout_fn 1 (2) 2021/11/26 14:29

Sample crash report:
================================
WARNING: inconsistent lock state
5.16.0-rc2-syzkaller #0 Not tainted
--------------------------------
inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
syz-executor.5/21296 [HC1[1]:SC0[0]:HE0:SE1] takes:
ffff88807d824418 (&ctx->timeout_lock){?.+.}-{2:2}, at: io_timeout_fn+0x6f/0x360 fs/io_uring.c:5943
{HARDIRQ-ON-W} state was registered at:
  __trace_hardirqs_on_caller kernel/locking/lockdep.c:4224 [inline]
  lockdep_hardirqs_on_prepare kernel/locking/lockdep.c:4292 [inline]
  lockdep_hardirqs_on_prepare+0x135/0x400 kernel/locking/lockdep.c:4244
  trace_hardirqs_on+0x5b/0x1c0 kernel/trace/trace_preemptirq.c:49
  __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:159 [inline]
  _raw_spin_unlock_irq+0x1f/0x40 kernel/locking/spinlock.c:202
  spin_unlock_irq include/linux/spinlock.h:399 [inline]
  __io_poll_remove_one fs/io_uring.c:5669 [inline]
  __io_poll_remove_one fs/io_uring.c:5654 [inline]
  io_poll_remove_one+0x236/0x870 fs/io_uring.c:5680
  io_poll_remove_all+0x1af/0x235 fs/io_uring.c:5709
  io_ring_ctx_wait_and_kill+0x1cc/0x322 fs/io_uring.c:9534
  io_uring_release+0x42/0x46 fs/io_uring.c:9554
  __fput+0x286/0x9f0 fs/file_table.c:280
  task_work_run+0xdd/0x1a0 kernel/task_work.c:164
  tracehook_notify_resume include/linux/tracehook.h:189 [inline]
  exit_to_user_mode_loop kernel/entry/common.c:175 [inline]
  exit_to_user_mode_prepare+0x27e/0x290 kernel/entry/common.c:207
  __syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline]
  syscall_exit_to_user_mode+0x19/0x60 kernel/entry/common.c:300
  do_syscall_64+0x42/0xb0 arch/x86/entry/common.c:86
  entry_SYSCALL_64_after_hwframe+0x44/0xae
irq event stamp: 366
hardirqs last  enabled at (365): [<ffffffff8946eeff>] __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:159 [inline]
hardirqs last  enabled at (365): [<ffffffff8946eeff>] _raw_spin_unlock_irq+0x1f/0x40 kernel/locking/spinlock.c:202
hardirqs last disabled at (366): [<ffffffff8944067b>] sysvec_apic_timer_interrupt+0xb/0xc0 arch/x86/kernel/apic/apic.c:1097
softirqs last  enabled at (176): [<ffffffff83bd578a>] alg_setsockopt+0x1ea/0x670 crypto/af_alg.c:272
softirqs last disabled at (174): [<ffffffff872375ab>] spin_lock_bh include/linux/spinlock.h:354 [inline]
softirqs last disabled at (174): [<ffffffff872375ab>] release_sock+0x1b/0x1b0 net/core/sock.c:3298

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

       CPU0
       ----
  lock(&ctx->timeout_lock);
  <Interrupt>
    lock(&ctx->timeout_lock);

 *** DEADLOCK ***

1 lock held by syz-executor.5/21296:
 #0: ffff88807d8240a8 (&ctx->uring_lock){+.+.}-{3:3}, at: __do_sys_io_uring_enter+0xf60/0x1f50 fs/io_uring.c:10042

stack backtrace:
CPU: 0 PID: 21296 Comm: syz-executor.5 Not tainted 5.16.0-rc2-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 print_usage_bug kernel/locking/lockdep.c:203 [inline]
 valid_state kernel/locking/lockdep.c:3945 [inline]
 mark_lock_irq kernel/locking/lockdep.c:4148 [inline]
 mark_lock.cold+0x61/0x8e kernel/locking/lockdep.c:4605
 mark_usage kernel/locking/lockdep.c:4497 [inline]
 __lock_acquire+0x149d/0x54a0 kernel/locking/lockdep.c:4981
 lock_acquire kernel/locking/lockdep.c:5637 [inline]
 lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5602
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:162
 io_timeout_fn+0x6f/0x360 fs/io_uring.c:5943
 __run_hrtimer kernel/time/hrtimer.c:1685 [inline]
 __hrtimer_run_queues+0x609/0xe50 kernel/time/hrtimer.c:1749
 hrtimer_interrupt+0x31c/0x790 kernel/time/hrtimer.c:1811
 local_apic_timer_interrupt arch/x86/kernel/apic/apic.c:1086 [inline]
 __sysvec_apic_timer_interrupt+0x146/0x530 arch/x86/kernel/apic/apic.c:1103
 sysvec_apic_timer_interrupt+0x8e/0xc0 arch/x86/kernel/apic/apic.c:1097
 </IRQ>
 <TASK>
 asm_sysvec_apic_timer_interrupt+0x12/0x20 arch/x86/include/asm/idtentry.h:638
RIP: 0010:__raw_spin_unlock_irq include/linux/spinlock_api_smp.h:160 [inline]
RIP: 0010:_raw_spin_unlock_irq+0x25/0x40 kernel/locking/spinlock.c:202
Code: 0f 1f 44 00 00 55 48 8b 74 24 08 48 89 fd 48 83 c7 18 e8 ee bd 15 f8 48 89 ef e8 36 34 16 f8 e8 01 ee 36 f8 fb bf 01 00 00 00 <e8> 06 fe 08 f8 65 8b 05 ef 80 bb 76 85 c0 74 02 5d c3 e8 0b 56 b9
RSP: 0018:ffffc9000b72f9c8 EFLAGS: 00000202
RAX: 000000000000016d RBX: 0000000000000000 RCX: 1ffffffff1ffbc06
RDX: 0000000000000000 RSI: 0000000000000001 RDI: 0000000000000001
RBP: ffff88807d824400 R08: 0000000000000001 R09: ffffffff8ff72b1f
R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000
R13: ffff888063ca5400 R14: 0000000003938700 R15: ffff88801d6f1640
 spin_unlock_irq include/linux/spinlock.h:399 [inline]
 io_timeout fs/io_uring.c:6223 [inline]
 io_issue_sqe+0x3789/0x7010 fs/io_uring.c:6662
 __io_queue_sqe fs/io_uring.c:6976 [inline]
 io_queue_sqe fs/io_uring.c:7018 [inline]
 io_submit_sqe fs/io_uring.c:7221 [inline]
 io_submit_sqes+0x1bca/0x8a20 fs/io_uring.c:7327
 __do_sys_io_uring_enter+0xf6e/0x1f50 fs/io_uring.c:10043
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x7fc2c4ae5ae9
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:00007fc2c203a188 EFLAGS: 00000246 ORIG_RAX: 00000000000001aa
RAX: ffffffffffffffda RBX: 00007fc2c4bf9020 RCX: 00007fc2c4ae5ae9
RDX: 0000000000000000 RSI: 000000000000000e RDI: 0000000000000003
RBP: 00007fc2c4b3ff6d R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fc2c512cb2f R14: 00007fc2c203a300 R15: 0000000000022000
 </TASK>
powermate 1-1:0.0: powermate_irq - usb_submit_urb failed with result: -19
powermate: config urb returned -71
----------------
Code disassembly (best guess):
   0:	0f 1f 44 00 00       	nopl   0x0(%rax,%rax,1)
   5:	55                   	push   %rbp
   6:	48 8b 74 24 08       	mov    0x8(%rsp),%rsi
   b:	48 89 fd             	mov    %rdi,%rbp
   e:	48 83 c7 18          	add    $0x18,%rdi
  12:	e8 ee bd 15 f8       	callq  0xf815be05
  17:	48 89 ef             	mov    %rbp,%rdi
  1a:	e8 36 34 16 f8       	callq  0xf8163455
  1f:	e8 01 ee 36 f8       	callq  0xf836ee25
  24:	fb                   	sti
  25:	bf 01 00 00 00       	mov    $0x1,%edi
* 2a:	e8 06 fe 08 f8       	callq  0xf808fe35 <-- trapping instruction
  2f:	65 8b 05 ef 80 bb 76 	mov    %gs:0x76bb80ef(%rip),%eax        # 0x76bb8125
  36:	85 c0                	test   %eax,%eax
  38:	74 02                	je     0x3c
  3a:	5d                   	pop    %rbp
  3b:	c3                   	retq
  3c:	e8                   	.byte 0xe8
  3d:	0b 56 b9             	or     -0x47(%rsi),%edx

Crashes (332):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/11/28 07:50 upstream 741392771338 63eeac02 .config console log report info ci-upstream-kasan-gce inconsistent lock state in io_timeout_fn
2021/11/28 06:28 upstream 741392771338 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/28 04:54 upstream 741392771338 63eeac02 .config console log report info ci-upstream-kasan-gce inconsistent lock state in io_timeout_fn
2021/11/28 04:07 upstream 741392771338 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/28 02:57 upstream 741392771338 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/28 01:56 upstream 741392771338 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/28 00:39 upstream 741392771338 63eeac02 .config console log report info ci-upstream-kasan-gce inconsistent lock state in io_timeout_fn
2021/11/27 23:00 upstream 741392771338 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/27 22:12 upstream 741392771338 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/27 22:05 upstream 741392771338 63eeac02 .config console log report info ci-upstream-kasan-gce-selinux-root inconsistent lock state in io_timeout_fn
2021/11/27 21:01 upstream 741392771338 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/27 20:05 upstream 741392771338 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/27 19:05 upstream c5c17547b778 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/27 18:36 upstream c5c17547b778 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/27 17:27 upstream c5c17547b778 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/27 16:25 upstream c5c17547b778 63eeac02 .config console log report info ci-upstream-kasan-gce inconsistent lock state in io_timeout_fn
2021/11/27 15:30 upstream c5c17547b778 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/27 14:24 upstream c5c17547b778 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/27 13:18 upstream c5c17547b778 63eeac02 .config console log report info ci-upstream-kasan-gce inconsistent lock state in io_timeout_fn
2021/11/27 13:12 upstream c5c17547b778 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/27 11:46 upstream c5c17547b778 63eeac02 .config console log report info ci-upstream-kasan-gce-selinux-root inconsistent lock state in io_timeout_fn
2021/11/27 10:42 upstream c5c17547b778 63eeac02 .config console log report info ci-upstream-kasan-gce-selinux-root inconsistent lock state in io_timeout_fn
2021/11/27 08:47 upstream c5c17547b778 63eeac02 .config console log report info ci-upstream-kasan-gce-selinux-root inconsistent lock state in io_timeout_fn
2021/11/27 08:31 upstream c5c17547b778 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/27 07:10 upstream c5c17547b778 63eeac02 .config console log report info ci-upstream-kasan-gce inconsistent lock state in io_timeout_fn
2021/11/27 05:42 upstream c5c17547b778 63eeac02 .config console log report info ci-upstream-kasan-gce inconsistent lock state in io_timeout_fn
2021/11/27 04:18 upstream c5c17547b778 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/27 02:31 upstream c5c17547b778 63eeac02 .config console log report info ci-upstream-kasan-gce inconsistent lock state in io_timeout_fn
2021/11/27 01:24 upstream c5c17547b778 63eeac02 .config console log report info ci-qemu-upstream inconsistent lock state in io_timeout_fn
2021/11/27 01:13 upstream c5c17547b778 63eeac02 .config console log report info ci-qemu-upstream inconsistent lock state in io_timeout_fn
2021/11/27 00:08 upstream c5c17547b778 63eeac02 .config console log report info ci-qemu-upstream inconsistent lock state in io_timeout_fn
2021/11/26 23:19 upstream c5c17547b778 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/26 23:04 upstream c5c17547b778 63eeac02 .config console log report info ci-qemu-upstream inconsistent lock state in io_timeout_fn
2021/11/26 22:03 upstream c5c17547b778 63eeac02 .config console log report info ci-upstream-kasan-gce inconsistent lock state in io_timeout_fn
2021/11/26 21:59 upstream c5c17547b778 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/26 20:48 upstream a4849f6000e2 63eeac02 .config console log report info ci-upstream-kasan-gce-smack-root inconsistent lock state in io_timeout_fn
2021/11/26 19:35 upstream a4849f6000e2 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/26 18:33 upstream a4849f6000e2 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/26 17:12 upstream a4849f6000e2 63eeac02 .config console log report info ci-qemu-upstream inconsistent lock state in io_timeout_fn
2021/11/26 16:13 upstream a4849f6000e2 63eeac02 .config console log report info ci-upstream-kasan-gce inconsistent lock state in io_timeout_fn
2021/11/26 14:49 upstream a4849f6000e2 63eeac02 .config console log report info ci-upstream-kasan-gce-selinux-root inconsistent lock state in io_timeout_fn
2021/11/26 13:41 upstream a4849f6000e2 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/26 11:49 upstream a4849f6000e2 63eeac02 .config console log report info ci-upstream-kasan-gce-selinux-root inconsistent lock state in io_timeout_fn
2021/11/26 10:44 upstream a4849f6000e2 63eeac02 .config console log report info ci-upstream-kasan-gce inconsistent lock state in io_timeout_fn
2021/11/26 10:40 upstream a4849f6000e2 63eeac02 .config console log report info ci-qemu-upstream inconsistent lock state in io_timeout_fn
2021/11/26 10:37 upstream a4849f6000e2 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/26 10:35 upstream a4849f6000e2 63eeac02 .config console log report info ci-upstream-kasan-gce inconsistent lock state in io_timeout_fn
2021/11/26 10:33 upstream a4849f6000e2 63eeac02 .config console log report info ci-upstream-kasan-gce inconsistent lock state in io_timeout_fn
2021/11/26 08:47 upstream a4849f6000e2 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
2021/11/26 08:32 upstream a4849f6000e2 63eeac02 .config console log report info ci-upstream-kasan-gce-root inconsistent lock state in io_timeout_fn
* Struck through repros no longer work on HEAD.