[v6.1] inconsistent lock state in valid_state

0 views
Skip to first unread message

syzbot

unread,
Mar 25, 2023, 9:35:57 PM3/25/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: e3a87a10f259 Linux 6.1.21
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=10f008f5c80000
kernel config: https://syzkaller.appspot.com/x/.config?x=b49b0405a60858ed
dashboard link: https://syzkaller.appspot.com/bug?extid=4b11a54ed0361cda1b8d
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/ed3d1f3e75e6/disk-e3a87a10.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/6d8e44c8c75c/vmlinux-e3a87a10.xz
kernel image: https://storage.googleapis.com/syzbot-assets/cebe803ea4fa/bzImage-e3a87a10.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+4b11a5...@syzkaller.appspotmail.com

================================
WARNING: inconsistent lock state
6.1.21-syzkaller #0 Not tainted
--------------------------------
inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
syz-executor.1/20105 [HC1[1]:SC0[0]:HE0:SE1] takes:
ffffffff8d7df8b8 (sync_timeline_list_lock){?.+.}-{2:2}, at: sync_timeline_debug_remove+0x28/0x140 drivers/dma-buf/sync_debug.c:31
{HARDIRQ-ON-W} state was registered at:
trace_hardirqs_on+0x34/0x40 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:400 [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+0x289/0x380 fs/seq_file.c:162
vfs_read+0x2ed/0xbe0 fs/read_write.c:468
ksys_read+0x19c/0x2c0 fs/read_write.c:613
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+0x63/0xcd
irq event stamp: 526
hardirqs last enabled at (525): [<ffffffff8a8736af>] __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:159 [inline]
hardirqs last enabled at (525): [<ffffffff8a8736af>] _raw_spin_unlock_irq+0x1f/0x40 kernel/locking/spinlock.c:202
hardirqs last disabled at (526): [<ffffffff8a7d510a>] sysvec_irq_work+0xa/0xb0 arch/x86/kernel/irq_work.c:17
softirqs last enabled at (0): [<ffffffff815171fd>] copy_process+0x155d/0x4020 kernel/fork.c:2201
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 ***

no locks held by syz-executor.1/20105.

stack backtrace:
CPU: 0 PID: 20105 Comm: syz-executor.1 Not tainted 6.1.21-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
valid_state+0x136/0x1c0 kernel/locking/lockdep.c:3976
mark_lock_irq+0xa8/0xba0 kernel/locking/lockdep.c:4179
mark_lock+0x21c/0x340 kernel/locking/lockdep.c:4635
mark_usage kernel/locking/lockdep.c:4527 [inline]
__lock_acquire+0xb40/0x1f80 kernel/locking/lockdep.c:5010
lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
__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:276 [inline]
dma_fence_array_release+0x13a/0x240 drivers/dma-buf/dma-fence-array.c:120
irq_work_single+0xd5/0x230 kernel/irq_work.c:211
irq_work_run_list kernel/irq_work.c:242 [inline]
irq_work_run+0x187/0x350 kernel/irq_work.c:251
__sysvec_irq_work+0xbb/0x360 arch/x86/kernel/irq_work.c:22
sysvec_irq_work+0x89/0xb0 arch/x86/kernel/irq_work.c:17
</IRQ>
<TASK>
asm_sysvec_irq_work+0x16/0x20 arch/x86/include/asm/idtentry.h:675
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: f1 41 f6 ff 90 53 48 89 fb 48 83 c7 18 48 8b 74 24 08 e8 8e 8b e2 f6 48 89 df e8 e6 c7 e3 f6 e8 e1 ff 08 f7 fb bf 01 00 00 00 <e8> 46 95 d6 f6 65 8b 05 87 38 7b 75 85 c0 74 02 5b c3 e8 84 56 79
RSP: 0018:ffffc9001825fcf0 EFLAGS: 00000286
RAX: 25bd42f6cebb8700 RBX: ffff88807bf95e50 RCX: ffffffff91a67003
RDX: dffffc0000000000 RSI: ffffffff8aebc5e0 RDI: 0000000000000001
RBP: ffff888077007a3c R08: dffffc0000000000 R09: ffffed100f7f2bcb
R10: 0000000000000000 R11: dffffc0000000001 R12: ffff88807bf95e40
R13: ffff888077007a00 R14: dffffc0000000000 R15: ffff88807bf95e00
spin_unlock_irq include/linux/spinlock.h:400 [inline]
sw_sync_debugfs_release+0x145/0x1c0 drivers/dma-buf/sw_sync.c:321
__fput+0x3b7/0x890 fs/file_table.c:320
task_work_run+0x246/0x300 kernel/task_work.c:179
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop+0xd9/0x100 kernel/entry/common.c:171
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:203
__syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
syscall_exit_to_user_mode+0x60/0x270 kernel/entry/common.c:296
do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f63d3a8c0f9
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:00007f63d48d4168 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 00007f63d3babf80 RCX: 00007f63d3a8c0f9
RDX: 0000000000000000 RSI: ffffffffffffffff RDI: 0000000000000003
RBP: 00007f63d3ae7b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffc3f3cde4f R14: 00007f63d48d4300 R15: 0000000000022000
</TASK>
----------------
Code disassembly (best guess):
0: f1 icebp
1: 41 f6 ff idiv %r15b
4: 90 nop
5: 53 push %rbx
6: 48 89 fb mov %rdi,%rbx
9: 48 83 c7 18 add $0x18,%rdi
d: 48 8b 74 24 08 mov 0x8(%rsp),%rsi
12: e8 8e 8b e2 f6 callq 0xf6e28ba5
17: 48 89 df mov %rbx,%rdi
1a: e8 e6 c7 e3 f6 callq 0xf6e3c805
1f: e8 e1 ff 08 f7 callq 0xf7090005
24: fb sti
25: bf 01 00 00 00 mov $0x1,%edi
* 2a: e8 46 95 d6 f6 callq 0xf6d69575 <-- trapping instruction
2f: 65 8b 05 87 38 7b 75 mov %gs:0x757b3887(%rip),%eax # 0x757b38bd
36: 85 c0 test %eax,%eax
38: 74 02 je 0x3c
3a: 5b pop %rbx
3b: c3 retq
3c: e8 .byte 0xe8
3d: 84 56 79 test %dl,0x79(%rsi)


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Mar 27, 2023, 1:11:48 PM3/27/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 115472395b0a Linux 5.15.104
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=119b9f19c80000
kernel config: https://syzkaller.appspot.com/x/.config?x=f5592cc4916e1c2f
dashboard link: https://syzkaller.appspot.com/bug?extid=e0c5a1672d975de1b492
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/6c2c0744c7e0/disk-11547239.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/7ea4c5ecca4f/vmlinux-11547239.xz
kernel image: https://storage.googleapis.com/syzbot-assets/9a231dbcf423/bzImage-11547239.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+e0c5a1...@syzkaller.appspotmail.com

================================
WARNING: inconsistent lock state
5.15.104-syzkaller #0 Not tainted
--------------------------------
inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
syz-executor.5/17601 [HC0[0]:SC0[0]:HE0:SE1] takes:
ffffffff8d148818 (sync_timeline_list_lock){?...}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:388 [inline]
ffffffff8d148818 (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
tracehook_notify_resume include/linux/tracehook.h:189 [inline]
exit_to_user_mode_loop+0x106/0x130 kernel/entry/common.c:175
exit_to_user_mode_prepare+0xb1/0x140 kernel/entry/common.c:207
__syscall_exit_to_user_mode_work kernel/entry/common.c:289 [inline]
syscall_exit_to_user_mode+0x5d/0x250 kernel/entry/common.c:300
do_syscall_64+0x49/0xb0 arch/x86/entry/common.c:86
entry_SYSCALL_64_after_hwframe+0x61/0xcb
irq event stamp: 684
hardirqs last enabled at (683): [<ffffffff81cde07d>] mod_memcg_lruvec_state include/linux/memcontrol.h:1039 [inline]
hardirqs last enabled at (683): [<ffffffff81cde07d>] mod_objcg_mlstate+0x1ed/0x330 mm/memcontrol.c:831
hardirqs last disabled at (684): [<ffffffff8a201a79>] __raw_spin_lock_irq include/linux/spinlock_api_smp.h:126 [inline]
hardirqs last disabled at (684): [<ffffffff8a201a79>] _raw_spin_lock_irq+0xa9/0x110 kernel/locking/spinlock.c:170
softirqs last enabled at (0): [<ffffffff814ae639>] 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/17601:
#0: ffff88807e262ff0 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x261/0x300 fs/file.c:1073
#1: ffff888092107d58 (&p->lock){+.+.}-{3:3}, at: seq_read_iter+0xae/0xd10 fs/seq_file.c:182
#2: ffffffff8d148818 (sync_timeline_list_lock){?...}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:388 [inline]
#2: ffffffff8d148818 (sync_timeline_list_lock){?...}-{2:2}, at: sync_info_debugfs_show+0x90/0x4c0 drivers/dma-buf/sync_debug.c:147

stack backtrace:
CPU: 0 PID: 17601 Comm: syz-executor.5 Not tainted 5.15.104-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/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:0x7f3cd070c0f9
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:00007f3ccec7e168 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007f3cd082bf80 RCX: 00007f3cd070c0f9
RDX: 0000000000002020 RSI: 0000000020000180 RDI: 0000000000000006
RBP: 00007f3cd0767b39 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffcf2922fff R14: 00007f3ccec7e300 R15: 0000000000022000
</TASK>

syzbot

unread,
Jul 23, 2023, 9:34:47 PM7/23/23
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.

syzbot

unread,
Sep 22, 2023, 4:18:46 PM9/22/23
to syzkaller...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages