[syzbot] inconsistent lock state in sync_info_debugfs_show

15 views
Skip to first unread message

syzbot

unread,
Jan 27, 2022, 11:33:18 AM1/27/22
to christia...@amd.com, dri-...@lists.freedesktop.org, gus...@padovan.org, linaro...@lists.linaro.org, linux-...@vger.kernel.org, linux...@vger.kernel.org, sumit....@linaro.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 1c52283265a4 Merge branch 'akpm' (patches from Andrew)
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1224663fb00000
kernel config: https://syzkaller.appspot.com/x/.config?x=75bc179af0ff0457
dashboard link: https://syzkaller.appspot.com/bug?extid=007bfe0f3330f6e1e7d1
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2

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

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

================================
WARNING: inconsistent lock state
5.16.0-syzkaller #0 Not tainted
--------------------------------
inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
syz-executor.2/18360 [HC0[0]:SC0[0]:HE0:SE1] takes:
ffffffff8c712cf8 (sync_timeline_list_lock){?...}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:374 [inline]
ffffffff8c712cf8 (sync_timeline_list_lock){?...}-{2:2}, at: sync_info_debugfs_show+0x2d/0x200 drivers/dma-buf/sync_debug.c:147
{IN-HARDIRQ-W} state was registered at:
lock_acquire kernel/locking/lockdep.c:5639 [inline]
lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5604
__raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
_raw_spin_lock_irqsave+0x39/0x50 kernel/locking/spinlock.c:162
sync_timeline_debug_remove+0x25/0x190 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+0x263/0x340 drivers/dma-buf/sw_sync.c:144
dma_fence_release+0x2ee/0x590 drivers/dma-buf/dma-fence.c:549
kref_put include/linux/kref.h:65 [inline]
dma_fence_put include/linux/dma-fence.h:276 [inline]
dma_fence_array_release+0x1e4/0x2b0 drivers/dma-buf/dma-fence-array.c:120
dma_fence_release+0x2ee/0x590 drivers/dma-buf/dma-fence.c:549
kref_put include/linux/kref.h:65 [inline]
dma_fence_put include/linux/dma-fence.h:276 [inline]
irq_dma_fence_array_work+0xa5/0xd0 drivers/dma-buf/dma-fence-array.c:52
irq_work_single+0x120/0x270 kernel/irq_work.c:211
irq_work_run_list+0x91/0xc0 kernel/irq_work.c:242
irq_work_run+0x54/0xd0 kernel/irq_work.c:251
__sysvec_irq_work+0x95/0x3d0 arch/x86/kernel/irq_work.c:22
sysvec_irq_work+0x8e/0xc0 arch/x86/kernel/irq_work.c:17
asm_sysvec_irq_work+0x12/0x20 arch/x86/include/asm/idtentry.h:664
__raw_spin_unlock_irq include/linux/spinlock_api_smp.h:160 [inline]
_raw_spin_unlock_irq+0x25/0x40 kernel/locking/spinlock.c:202
spin_unlock_irq include/linux/spinlock.h:399 [inline]
sw_sync_debugfs_release+0x160/0x240 drivers/dma-buf/sw_sync.c:321
__fput+0x286/0x9f0 fs/file_table.c:311
task_work_run+0xdd/0x1a0 kernel/task_work.c:164
exit_task_work include/linux/task_work.h:32 [inline]
do_exit+0xb29/0x2a30 kernel/exit.c:806
do_group_exit+0xd2/0x2f0 kernel/exit.c:935
get_signal+0x4b0/0x28c0 kernel/signal.c:2862
arch_do_signal_or_restart+0x2a9/0x1c40 arch/x86/kernel/signal.c:868
handle_signal_work kernel/entry/common.c:148 [inline]
exit_to_user_mode_loop kernel/entry/common.c:172 [inline]
exit_to_user_mode_prepare+0x17d/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
ret_from_fork+0x15/0x30 arch/x86/entry/entry_64.S:288
irq event stamp: 124
hardirqs last enabled at (123): [<ffffffff894fd980>] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
hardirqs last enabled at (123): [<ffffffff894fd980>] _raw_spin_unlock_irqrestore+0x50/0x70 kernel/locking/spinlock.c:194
hardirqs last disabled at (124): [<ffffffff894fd6e1>] __raw_spin_lock_irq include/linux/spinlock_api_smp.h:117 [inline]
hardirqs last disabled at (124): [<ffffffff894fd6e1>] _raw_spin_lock_irq+0x41/0x50 kernel/locking/spinlock.c:170
softirqs last enabled at (116): [<ffffffff81465513>] invoke_softirq kernel/softirq.c:432 [inline]
softirqs last enabled at (116): [<ffffffff81465513>] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:637
softirqs last disabled at (97): [<ffffffff81465513>] invoke_softirq kernel/softirq.c:432 [inline]
softirqs last disabled at (97): [<ffffffff81465513>] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:637

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.2/18360:
#0: ffff88801e30c0f0 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0xe9/0x100 fs/file.c:1034
#1: ffff88807a26dd58 (&p->lock){+.+.}-{3:3}, at: seq_read_iter+0xdf/0x1280 fs/seq_file.c:182
#2: ffffffff8c712cf8 (sync_timeline_list_lock){?...}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:374 [inline]
#2: ffffffff8c712cf8 (sync_timeline_list_lock){?...}-{2:2}, at: sync_info_debugfs_show+0x2d/0x200 drivers/dma-buf/sync_debug.c:147

stack backtrace:
CPU: 0 PID: 18360 Comm: syz-executor.2 Not tainted 5.16.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
<TASK>
__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_held_locks+0x9f/0xe0 kernel/locking/lockdep.c:4206
__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]
sync_print_obj drivers/dma-buf/sync_debug.c:118 [inline]
sync_info_debugfs_show+0xeb/0x200 drivers/dma-buf/sync_debug.c:153
seq_read_iter+0x4f5/0x1280 fs/seq_file.c:230
seq_read+0x3e8/0x5c0 fs/seq_file.c:162
vfs_read+0x1b5/0x600 fs/read_write.c:479
ksys_read+0x12d/0x250 fs/read_write.c:619
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:0x7f781fb4b059
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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f781e4c0168 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007f781fc5df60 RCX: 00007f781fb4b059
RDX: 0000000000000008 RSI: 0000000020000140 RDI: 0000000000000003
RBP: 00007f781fba508d R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007fff0ff6575f R14: 00007f781e4c0300 R15: 0000000000022000
</TASK>


---
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,
Nov 18, 2022, 9:46:40 PM11/18/22
to christia...@amd.com, dri-...@lists.freedesktop.org, gus...@padovan.org, linaro-mm-...@lists.linaro.org, linaro...@lists.linaro.org, linux-...@vger.kernel.org, linux...@vger.kernel.org, sumit....@linaro.org, syzkall...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 84368d882b96 Merge tag 'soc-fixes-6.1-3' of git://git.kern..
git tree: upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=1670fb65880000
kernel config: https://syzkaller.appspot.com/x/.config?x=6f4e5e9899396248
dashboard link: https://syzkaller.appspot.com/bug?extid=007bfe0f3330f6e1e7d1
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=164376f9880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16cf0965880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/031b6e68785d/disk-84368d88.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/cff5e66b90e8/vmlinux-84368d88.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e75525784a66/bzImage-84368d88.xz

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

================================
WARNING: inconsistent lock state
6.1.0-rc5-syzkaller-00144-g84368d882b96 #0 Not tainted
--------------------------------
inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
syz-executor333/3645 [HC0[0]:SC0[0]:HE0:SE1] takes:
ffffffff8d295c38 (sync_timeline_list_lock){?...}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:375 [inline]
ffffffff8d295c38 (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: 638
hardirqs last enabled at (637): [<ffffffff81cc6530>] ___slab_alloc+0xca0/0x1400 mm/slub.c:3132
hardirqs last disabled at (638): [<ffffffff89f47e95>] __raw_spin_lock_irq include/linux/spinlock_api_smp.h:117 [inline]
hardirqs last disabled at (638): [<ffffffff89f47e95>] _raw_spin_lock_irq+0x45/0x50 kernel/locking/spinlock.c:170
softirqs last enabled at (538): [<ffffffff814c1d03>] invoke_softirq kernel/softirq.c:445 [inline]
softirqs last enabled at (538): [<ffffffff814c1d03>] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:650
softirqs last disabled at (505): [<ffffffff814c1d03>] invoke_softirq kernel/softirq.c:445 [inline]
softirqs last disabled at (505): [<ffffffff814c1d03>] __irq_exit_rcu+0x123/0x180 kernel/softirq.c:650

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-executor333/3645:
#0: ffff888021f8c8b8 (&p->lock){+.+.}-{3:3}, at: seq_read_iter+0xe3/0x1280 fs/seq_file.c:182
#1: ffffffff8d295c38 (sync_timeline_list_lock){?...}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:375 [inline]
#1: ffffffff8d295c38 (sync_timeline_list_lock){?...}-{2:2}, at: sync_info_debugfs_show+0x31/0x200 drivers/dma-buf/sync_debug.c:147

stack backtrace:
CPU: 1 PID: 3645 Comm: syz-executor333 Not tainted 6.1.0-rc5-syzkaller-00144-g84368d882b96 #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:0x7f7cb1bbb049
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:00007ffd52951818 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00000000000f4240 RCX: 00007f7cb1bbb049
RDX: 0000000000002020 RSI: 0000000020002200 RDI: 0000000000000003
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000001
R10: 00007ffd52951290 R11: 0000000000000246 R12: 000000000000e32c
R13: 00007ffd5295182c R14: 00007ffd52951840 R15: 00007ffd52951830
</TASK>

Hillf Danton

unread,
Nov 19, 2022, 3:10:27 AM11/19/22
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Fri, 18 Nov 2022 18:46:38 -0800
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 84368d882b96 Merge tag 'soc-fixes-6.1-3' of git://git.kern..
> git tree: upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=1670fb65880000
> kernel config: https://syzkaller.appspot.com/x/.config?x=6f4e5e9899396248
> dashboard link: https://syzkaller.appspot.com/bug?extid=007bfe0f3330f6e1e7d1
> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=164376f9880000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16cf0965880000

Try irqsave.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 84368d882b96

--- x/drivers/dma-buf/sync_debug.c
+++ s/drivers/dma-buf/sync_debug.c
@@ -141,10 +141,11 @@ static void sync_print_sync_file(struct
static int sync_info_debugfs_show(struct seq_file *s, void *unused)
{
struct list_head *pos;
+ unsigned long flags;

seq_puts(s, "objs:\n--------------\n");

- spin_lock_irq(&sync_timeline_list_lock);
+ spin_lock_irqsave(&sync_timeline_list_lock, flags);
list_for_each(pos, &sync_timeline_list_head) {
struct sync_timeline *obj =
container_of(pos, struct sync_timeline,
@@ -153,11 +154,11 @@ static int sync_info_debugfs_show(struct
sync_print_obj(s, obj);
seq_putc(s, '\n');
}
- spin_unlock_irq(&sync_timeline_list_lock);
+ spin_unlock_irqrestore(&sync_timeline_list_lock, flags);

seq_puts(s, "fences:\n--------------\n");

- spin_lock_irq(&sync_file_list_lock);
+ spin_lock_irqsave(&sync_file_list_lock, flags);
list_for_each(pos, &sync_file_list_head) {
struct sync_file *sync_file =
container_of(pos, struct sync_file, sync_file_list);
@@ -165,7 +166,7 @@ static int sync_info_debugfs_show(struct
sync_print_sync_file(s, sync_file);
seq_putc(s, '\n');
}
- spin_unlock_irq(&sync_file_list_lock);
+ spin_unlock_irqrestore(&sync_file_list_lock, flags);
return 0;
}

--

syzbot

unread,
Nov 19, 2022, 4:43:30 AM11/19/22
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
inconsistent lock state in sync_info_debugfs_show

================================
WARNING: inconsistent lock state
6.1.0-rc5-syzkaller-00144-g84368d882b96-dirty #0 Not tainted
--------------------------------
inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
syz-executor.4/4365 [HC0[0]:SC0[0]:HE0:SE1] takes:
ffffffff8d295c38 (sync_timeline_list_lock){?...}-{2:2}, at: sync_info_debugfs_show+0x35/0x210 drivers/dma-buf/sync_debug.c:148
resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
exit_to_user_mode_prepare+0x23c/0x250 kernel/entry/common.c:203
__syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline]
syscall_exit_to_user_mode+0x1d/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: 94
hardirqs last enabled at (93): [<ffffffff81d48585>] mod_objcg_state+0x595/0xa50 mm/memcontrol.c:3213
hardirqs last disabled at (94): [<ffffffff89f47ef2>] __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:108 [inline]
hardirqs last disabled at (94): [<ffffffff89f47ef2>] _raw_spin_lock_irqsave+0x52/0x60 kernel/locking/spinlock.c:162
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 ***

3 locks held by syz-executor.4/4365:
#0: ffff888078122fe8 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0xe7/0x100 fs/file.c:1037
#1: ffff888074a74540 (&p->lock){+.+.}-{3:3}, at: seq_read_iter+0xe3/0x1280 fs/seq_file.c:182
#2: ffffffff8d295c38 (sync_timeline_list_lock){?...}-{2:2}, at: sync_info_debugfs_show+0x35/0x210 drivers/dma-buf/sync_debug.c:148

stack backtrace:
CPU: 0 PID: 4365 Comm: syz-executor.4 Not tainted 6.1.0-rc5-syzkaller-00144-g84368d882b96-dirty #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+0xf4/0x210 drivers/dma-buf/sync_debug.c:154
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:0x7f54a7e8b639
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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f54a8b9c168 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007f54a7fabf80 RCX: 00007f54a7e8b639
RDX: 0000000000002020 RSI: 0000000020002200 RDI: 0000000000000003
RBP: 00007f54a7ee6ae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffcd4b693af R14: 00007f54a8b9c300 R15: 0000000000022000
</TASK>
------------[ cut here ]------------
raw_local_irq_restore() called with IRQs enabled
WARNING: CPU: 0 PID: 4365 at kernel/locking/irqflag-debug.c:10 warn_bogus_irq_restore+0x21/0x30 kernel/locking/irqflag-debug.c:10
Modules linked in:
CPU: 0 PID: 4365 Comm: syz-executor.4 Not tainted 6.1.0-rc5-syzkaller-00144-g84368d882b96-dirty #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
RIP: 0010:warn_bogus_irq_restore+0x21/0x30 kernel/locking/irqflag-debug.c:10
Code: b9 ff 0f 1f 80 00 00 00 00 f3 0f 1e fa 80 3d f3 d7 4c 04 00 74 01 c3 48 c7 c7 20 3c 4c 8a c6 05 e2 d7 4c 04 01 e8 5c bb b9 ff <0f> 0b c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 f3 0f 1e fa 44 8b 05
RSP: 0018:ffffc900056bfb30 EFLAGS: 00010282
RAX: 0000000000000000 RBX: 0000000000000200 RCX: 0000000000000000
RDX: ffff888028990000 RSI: ffffffff816574fc RDI: fffff52000ad7f58
RBP: ffffffff8d295c20 R08: 0000000000000005 R09: 0000000000000000
R10: 0000000000000001 R11: 61636f6c5f776172 R12: ffff88807a69c740
R13: ffffffff8d295c80 R14: ffff88807a69c750 R15: ffff88807a69c740
FS: 00007f54a8b9c700(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ff7e6f85498 CR3: 000000007c48e000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
__raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
_raw_spin_unlock_irqrestore+0x63/0x70 kernel/locking/spinlock.c:194
spin_unlock_irqrestore include/linux/spinlock.h:405 [inline]
sync_info_debugfs_show+0x138/0x210 drivers/dma-buf/sync_debug.c:157
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:0x7f54a7e8b639
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 b8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f54a8b9c168 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007f54a7fabf80 RCX: 00007f54a7e8b639
RDX: 0000000000002020 RSI: 0000000020002200 RDI: 0000000000000003
RBP: 00007f54a7ee6ae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffcd4b693af R14: 00007f54a8b9c300 R15: 0000000000022000
</TASK>


Tested on:

commit: 84368d88 Merge tag 'soc-fixes-6.1-3' of git://git.kern..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=16ad20fd880000
kernel config: https://syzkaller.appspot.com/x/.config?x=6f4e5e9899396248
dashboard link: https://syzkaller.appspot.com/bug?extid=007bfe0f3330f6e1e7d1
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=16ecc301880000

Hillf Danton

unread,
Nov 19, 2022, 4:51:24 AM11/19/22
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Fri, 18 Nov 2022 18:46:38 -0800
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 84368d882b96 Merge tag 'soc-fixes-6.1-3' of git://git.kern..
> git tree: upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=1670fb65880000
> kernel config: https://syzkaller.appspot.com/x/.config?x=6f4e5e9899396248
> dashboard link: https://syzkaller.appspot.com/bug?extid=007bfe0f3330f6e1e7d1
> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=164376f9880000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16cf0965880000

Try irqsave.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 84368d882b96

--- x/drivers/dma-buf/sync_debug.c
+++ s/drivers/dma-buf/sync_debug.c
@@ -107,15 +107,16 @@ static void sync_print_fence(struct seq_
static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj)
{
struct list_head *pos;
+ unsigned long flags;

seq_printf(s, "%s: %d\n", obj->name, obj->value);

- spin_lock_irq(&obj->lock);
+ spin_lock_irqsave(&obj->lock, flags);
list_for_each(pos, &obj->pt_list) {
struct sync_pt *pt = container_of(pos, struct sync_pt, link);
sync_print_fence(s, &pt->base, false);
}
- spin_unlock_irq(&obj->lock);
+ spin_unlock_irqrestore(&obj->lock, flags);
}

static void sync_print_sync_file(struct seq_file *s,
@@ -141,10 +142,11 @@ static void sync_print_sync_file(struct
static int sync_info_debugfs_show(struct seq_file *s, void *unused)
{
struct list_head *pos;
+ unsigned long flags;

seq_puts(s, "objs:\n--------------\n");

- spin_lock_irq(&sync_timeline_list_lock);
+ spin_lock_irqsave(&sync_timeline_list_lock, flags);
list_for_each(pos, &sync_timeline_list_head) {
struct sync_timeline *obj =
container_of(pos, struct sync_timeline,
@@ -153,11 +155,11 @@ static int sync_info_debugfs_show(struct
sync_print_obj(s, obj);
seq_putc(s, '\n');
}
- spin_unlock_irq(&sync_timeline_list_lock);
+ spin_unlock_irqrestore(&sync_timeline_list_lock, flags);

seq_puts(s, "fences:\n--------------\n");

- spin_lock_irq(&sync_file_list_lock);
+ spin_lock_irqsave(&sync_file_list_lock, flags);
list_for_each(pos, &sync_file_list_head) {
struct sync_file *sync_file =
container_of(pos, struct sync_file, sync_file_list);
@@ -165,7 +167,7 @@ static int sync_info_debugfs_show(struct

syzbot

unread,
Nov 19, 2022, 5:50:18 AM11/19/22
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
INFO: rcu detected stall in corrupted

rcu: INFO: rcu_preempt detected expedited stalls on CPUs/tasks: { P4107 } 2631 jiffies s: 2805 root: 0x0/T
rcu: blocking rcu_node structures (internal RCU debug):


Tested on:

commit: 84368d88 Merge tag 'soc-fixes-6.1-3' of git://git.kern..
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=146d20fd880000
kernel config: https://syzkaller.appspot.com/x/.config?x=6f4e5e9899396248
dashboard link: https://syzkaller.appspot.com/bug?extid=007bfe0f3330f6e1e7d1
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=120fe909880000

syzbot

unread,
Nov 20, 2022, 3:51:20 PM11/20/22
to b...@alien8.de, christia...@amd.com, dri-...@lists.freedesktop.org, gus...@padovan.org, hda...@sina.com, h...@zytor.com, jmat...@google.com, jo...@8bytes.org, k...@vger.kernel.org, linaro-mm-...@lists.linaro.org, linaro...@lists.linaro.org, linux-...@vger.kernel.org, linux...@vger.kernel.org, mark.r...@arm.com, mi...@redhat.com, pbon...@redhat.com, pet...@infradead.org, sea...@google.com, sumit....@linaro.org, syzkall...@googlegroups.com, tg...@linutronix.de, vkuz...@redhat.com, wanp...@tencent.com, wi...@kernel.org, x...@kernel.org
syzbot has bisected this issue to:

commit 997acaf6b4b59c6a9c259740312a69ea549cc684
Author: Mark Rutland <mark.r...@arm.com>
Date: Mon Jan 11 15:37:07 2021 +0000

lockdep: report broken irq restoration

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=115b350d880000
start commit: 84368d882b96 Merge tag 'soc-fixes-6.1-3' of git://git.kern..
git tree: upstream
final oops: https://syzkaller.appspot.com/x/report.txt?x=135b350d880000
console output: https://syzkaller.appspot.com/x/log.txt?x=155b350d880000
Reported-by: syzbot+007bfe...@syzkaller.appspotmail.com
Fixes: 997acaf6b4b5 ("lockdep: report broken irq restoration")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

Daniel Vetter

unread,
Nov 22, 2022, 9:51:19 AM11/22/22
to syzbot, christia...@amd.com, dri-...@lists.freedesktop.org, gus...@padovan.org, linaro-mm-...@lists.linaro.org, linaro...@lists.linaro.org, linux-...@vger.kernel.org, linux...@vger.kernel.org, sumit....@linaro.org, syzkall...@googlegroups.com
Do we need to just generally push all dma_fence_release finalization to an
irq work to untangle this mess once and for all? Or is this not just plain
old recursion? Christian, any good ideas?
-Daniel
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

Christian König

unread,
Nov 22, 2022, 12:31:57 PM11/22/22
to dri-...@lists.freedesktop.org, gus...@padovan.org, linaro-mm-...@lists.linaro.org, linaro...@lists.linaro.org, linux-...@vger.kernel.org, linux...@vger.kernel.org, sumit....@linaro.org, syzkall...@googlegroups.com
Am 22.11.22 um 15:51 schrieb Daniel Vetter:
> On Fri, Nov 18, 2022 at 06:46:38PM -0800, syzbot wrote:
>> syzbot has found a reproducer for the following issue on:
>>
>> HEAD commit: 84368d882b96 Merge tag 'soc-fixes-6.1-3' of git://git.kern..
>> git tree: upstream
>> console+strace: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsyzkaller.appspot.com%2Fx%2Flog.txt%3Fx%3D1670fb65880000&amp;data=05%7C01%7Cchristian.koenig%40amd.com%7C93106507f7994c3175f408dacc99034c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638047254866307874%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=%2BNj%2B3vZRTi6DhdOdNlQDG7GJN9u3IZy8%2FZxqHScu2Fs%3D&amp;reserved=0
>> kernel config: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsyzkaller.appspot.com%2Fx%2F.config%3Fx%3D6f4e5e9899396248&amp;data=05%7C01%7Cchristian.koenig%40amd.com%7C93106507f7994c3175f408dacc99034c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638047254866307874%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=qZpvAr44nbuFs3jvd9fggeVnMgAt7J5Izxa1GvoMDjA%3D&amp;reserved=0
>> dashboard link: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsyzkaller.appspot.com%2Fbug%3Fextid%3D007bfe0f3330f6e1e7d1&amp;data=05%7C01%7Cchristian.koenig%40amd.com%7C93106507f7994c3175f408dacc99034c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638047254866307874%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=tTHNWwrjD%2F%2FddfRi%2Fe3AbwMw%2B7MPWoolWeZt%2FgnBa4g%3D&amp;reserved=0
>> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
>> syz repro: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsyzkaller.appspot.com%2Fx%2Frepro.syz%3Fx%3D164376f9880000&amp;data=05%7C01%7Cchristian.koenig%40amd.com%7C93106507f7994c3175f408dacc99034c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638047254866307874%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=bay5gePJjT3Nm4J%2BINtso1hKNPMUmfP6xActclfXqa8%3D&amp;reserved=0
>> C reproducer: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsyzkaller.appspot.com%2Fx%2Frepro.c%3Fx%3D16cf0965880000&amp;data=05%7C01%7Cchristian.koenig%40amd.com%7C93106507f7994c3175f408dacc99034c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638047254866307874%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=o5JlI1IDcmP%2Bd08wLRhyD5gUIjuPioMEyK%2FkH6m%2FNIQ%3D&amp;reserved=0
>>
>> Downloadable assets:
>> disk image: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstorage.googleapis.com%2Fsyzbot-assets%2F031b6e68785d%2Fdisk-84368d88.raw.xz&amp;data=05%7C01%7Cchristian.koenig%40amd.com%7C93106507f7994c3175f408dacc99034c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638047254866307874%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=dAT5hGTqrR01QiyGbOHyWkBIvTYvsmGqLiPqXuw7vK4%3D&amp;reserved=0
>> vmlinux: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstorage.googleapis.com%2Fsyzbot-assets%2Fcff5e66b90e8%2Fvmlinux-84368d88.xz&amp;data=05%7C01%7Cchristian.koenig%40amd.com%7C93106507f7994c3175f408dacc99034c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638047254866307874%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=bHMhF3kWMS3ZVbPs8z6mWewUlNBTJPabhhI58e77KuI%3D&amp;reserved=0
>> kernel image: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstorage.googleapis.com%2Fsyzbot-assets%2Fe75525784a66%2FbzImage-84368d88.xz&amp;data=05%7C01%7Cchristian.koenig%40amd.com%7C93106507f7994c3175f408dacc99034c%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C638047254866307874%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&amp;sdata=KFJD3fDW1Ppqla%2BPA6wY6NC3qSNrlCpnkhdqIDZGxoY%3D&amp;reserved=0
>>
>> IMPORTANT: if you fix the issue, please add the following tag to the commit:
>> Reported-by: syzbot+007bfe...@syzkaller.appspotmail.com
>>
>> ================================
>> WARNING: inconsistent lock state
>> 6.1.0-rc5-syzkaller-00144-g84368d882b96 #0 Not tainted
>> --------------------------------
>> inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
>> syz-executor333/3645 [HC0[0]:SC0[0]:HE0:SE1] takes:
>> ffffffff8d295c38 (sync_timeline_list_lock){?...}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:375 [inline]
>> ffffffff8d295c38 (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
> Do we need to just generally push all dma_fence_release finalization to an
> irq work to untangle this mess once and for all? Or is this not just plain
> old recursion? Christian, any good ideas?

I couldn't even figure out what exactly is going wrong here.

As far as I can see someone just constructed a timeline_fence within a
timeline_fence which doesn't sounds valid to me in the first place.

Christian.

Daniel Vetter

unread,
Nov 22, 2022, 2:48:18 PM11/22/22
to syzbot, b...@alien8.de, christia...@amd.com, dri-...@lists.freedesktop.org, gus...@padovan.org, hda...@sina.com, h...@zytor.com, jmat...@google.com, jo...@8bytes.org, k...@vger.kernel.org, linaro-mm-...@lists.linaro.org, linaro...@lists.linaro.org, linux-...@vger.kernel.org, linux...@vger.kernel.org, mark.r...@arm.com, mi...@redhat.com, pbon...@redhat.com, pet...@infradead.org, sea...@google.com, sumit....@linaro.org, syzkall...@googlegroups.com, tg...@linutronix.de, vkuz...@redhat.com, wanp...@tencent.com, wi...@kernel.org, x...@kernel.org
On Sun, 20 Nov 2022 at 21:51, syzbot
<syzbot+007bfe...@syzkaller.appspotmail.com> wrote:
>
> syzbot has bisected this issue to:
>
> commit 997acaf6b4b59c6a9c259740312a69ea549cc684
> Author: Mark Rutland <mark.r...@arm.com>
> Date: Mon Jan 11 15:37:07 2021 +0000
>
> lockdep: report broken irq restoration

Ok this looks funny. I'm pretty sure the code in
drivers/dma-buf/sw_sync.c around sync_timeline_fence_lock is correct.
And we don't do anything that this patch claims to catch, it's all
just plain spin_lock_irq and spin_lock_irqsave usage. Only thing that
crossed my mind here is that maybe lockdep somehow ends up with two
different keys for the same spinlock? I'm really confused ...
-Daniel

> bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=115b350d880000
> start commit: 84368d882b96 Merge tag 'soc-fixes-6.1-3' of git://git.kern..
> git tree: upstream
> final oops: https://syzkaller.appspot.com/x/report.txt?x=135b350d880000
> console output: https://syzkaller.appspot.com/x/log.txt?x=155b350d880000
> kernel config: https://syzkaller.appspot.com/x/.config?x=6f4e5e9899396248
> dashboard link: https://syzkaller.appspot.com/bug?extid=007bfe0f3330f6e1e7d1
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=164376f9880000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16cf0965880000
>
> Reported-by: syzbot+007bfe...@syzkaller.appspotmail.com
> Fixes: 997acaf6b4b5 ("lockdep: report broken irq restoration")
>
> For information about bisection process see: https://goo.gl/tpsmEJ#bisection

Lizhi Xu

unread,
Aug 27, 2023, 9:53:25 PM8/27/23
to syzbot+007bfe...@syzkaller.appspotmail.com, syzkall...@googlegroups.com
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1c52283265a4

diff --git a/drivers/dma-buf/sync_debug.c b/drivers/dma-buf/sync_debug.c
index 101394f16930..2d3e03eb892f 100644
--- a/drivers/dma-buf/sync_debug.c
+++ b/drivers/dma-buf/sync_debug.c
@@ -110,12 +110,12 @@ static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj)

seq_printf(s, "%s: %d\n", obj->name, obj->value);

- spin_lock_irq(&obj->lock);
+ spin_lock(&obj->lock);
list_for_each(pos, &obj->pt_list) {
struct sync_pt *pt = container_of(pos, struct sync_pt, link);
sync_print_fence(s, &pt->base, false);
}
- spin_unlock_irq(&obj->lock);
+ spin_unlock(&obj->lock);

syzbot

unread,
Aug 27, 2023, 10:09:31 PM8/27/23
to lizh...@windriver.com, syzkall...@googlegroups.com
Hello,

syzbot tried to test the proposed patch but the build/boot failed:

scripts/sign-file.c:89:9: warning: 'ERR_get_error_line' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
scripts/sign-file.c:102:9: warning: 'ERR_get_error_line' is deprecated: Since OpenSSL 3.0 [-Wdeprecated-declarations]
subcmd-util.h:56:23: error: pointer may be used after 'realloc' [-Werror=use-after-free]
subcmd-util.h:58:31: error: pointer may be used after 'realloc' [-Werror=use-after-free]
check.c:2867:58: error: '%d' directive output may be truncated writing between 1 and 10 bytes into a region of size 9 [-Werror=format-truncation=]


Tested on:

commit: 1c522832 Merge branch 'akpm' (patches from Andrew)
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel config: https://syzkaller.appspot.com/x/.config?x=cc4b2e0a8e8a8366
patch: https://syzkaller.appspot.com/x/patch.diff?x=1099c870680000

Lizhi Xu

unread,
Aug 27, 2023, 11:28:02 PM8/27/23
to syzbot+007bfe...@syzkaller.appspotmail.com, syzkall...@googlegroups.com
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1c52283265a4

diff --git a/drivers/dma-buf/sync_debug.c b/drivers/dma-buf/sync_debug.c
index 101394f16930..2da5ec3903a8 100644
--- a/drivers/dma-buf/sync_debug.c
+++ b/drivers/dma-buf/sync_debug.c
@@ -107,15 +107,16 @@ static void sync_print_fence(struct seq_file *s,
static void sync_print_obj(struct seq_file *s, struct sync_timeline *obj)
{
struct list_head *pos;
+ unsigned long flags;

seq_printf(s, "%s: %d\n", obj->name, obj->value);

- spin_lock_irq(&obj->lock);
+ spin_lock_irqsave(&obj->lock, flags);
list_for_each(pos, &obj->pt_list) {
struct sync_pt *pt = container_of(pos, struct sync_pt, link);
sync_print_fence(s, &pt->base, false);
}
- spin_unlock_irq(&obj->lock);
+ spin_unlock_irqrestore(&obj->lock, flags);
}

static void sync_print_sync_file(struct seq_file *s,
@@ -141,10 +142,11 @@ static void sync_print_sync_file(struct seq_file *s,
static int sync_info_debugfs_show(struct seq_file *s, void *unused)
{
struct list_head *pos;
+ unsigned long flags;

seq_puts(s, "objs:\n--------------\n");

- spin_lock_irq(&sync_timeline_list_lock);
+ spin_lock_irqsave(&sync_timeline_list_lock, flags);
list_for_each(pos, &sync_timeline_list_head) {
struct sync_timeline *obj =
container_of(pos, struct sync_timeline,
@@ -153,11 +155,11 @@ static int sync_info_debugfs_show(struct seq_file *s, void *unused)
sync_print_obj(s, obj);
seq_putc(s, '\n');
}
- spin_unlock_irq(&sync_timeline_list_lock);
+ spin_unlock_irqrestore(&sync_timeline_list_lock, flags);

seq_puts(s, "fences:\n--------------\n");

- spin_lock_irq(&sync_file_list_lock);
+ spin_lock_irqsave(&sync_file_list_lock, flags);
list_for_each(pos, &sync_file_list_head) {
struct sync_file *sync_file =
container_of(pos, struct sync_file, sync_file_list);
@@ -165,7 +167,7 @@ static int sync_info_debugfs_show(struct seq_file *s, void *unused)

syzbot

unread,
Aug 27, 2023, 11:52:23 PM8/27/23
to lizh...@windriver.com, syzkall...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages