dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [syzbot] [dri?] [media?] inconsistent lock state in valid_state (2)
@ 2024-02-07  0:07 syzbot
  2024-02-27  0:56 ` syzbot
  2024-05-05 14:08 ` [PATCH] dma-buf/sw-sync: don't enable IRQ from sync_print_obj() Tetsuo Handa
  0 siblings, 2 replies; 5+ messages in thread
From: syzbot @ 2024-02-07  0:07 UTC (permalink / raw)
  To: christian.koenig, dri-devel, gustavo, linaro-mm-sig,
	linux-kernel, linux-media, sumit.semwal, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    021533194476 Kconfig: Disable -Wstringop-overflow for GCC ..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10a82db0180000
kernel config:  https://syzkaller.appspot.com/x/.config?x=457249c250b93697
dashboard link: https://syzkaller.appspot.com/bug?extid=a225ee3df7e7f9372dbe
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/da8c6426660d/disk-02153319.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/a866aaa09be9/vmlinux-02153319.xz
kernel image: https://storage.googleapis.com/syzbot-assets/4a5680d805d7/bzImage-02153319.xz

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

================================
WARNING: inconsistent lock state
6.8.0-rc2-syzkaller-00199-g021533194476 #0 Not tainted
--------------------------------
inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
syz-executor.4/9508 [HC0[0]:SC0[0]:HE0:SE1] takes:
ffffffff8ea8c5d8 (sync_timeline_list_lock){?...}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:376 [inline]
ffffffff8ea8c5d8 (sync_timeline_list_lock){?...}-{2:2}, at: sync_info_debugfs_show+0x94/0x4d0 drivers/dma-buf/sync_debug.c:147
{IN-HARDIRQ-W} state was registered at:
  lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754
  __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
  _raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162
  sync_timeline_debug_remove+0x2c/0x150 drivers/dma-buf/sync_debug.c:31
  sync_timeline_free drivers/dma-buf/sw_sync.c:125 [inline]
  kref_put include/linux/kref.h:65 [inline]
  sync_timeline_put drivers/dma-buf/sw_sync.c:137 [inline]
  timeline_fence_release+0x204/0x250 drivers/dma-buf/sw_sync.c:165
  kref_put include/linux/kref.h:65 [inline]
  dma_fence_put include/linux/dma-fence.h:297 [inline]
  dma_fence_array_release+0x13e/0x240 drivers/dma-buf/dma-fence-array.c:120
  irq_work_single+0xe1/0x240 kernel/irq_work.c:221
  irq_work_run_list kernel/irq_work.c:252 [inline]
  irq_work_run+0x18b/0x350 kernel/irq_work.c:261
  __sysvec_irq_work+0xa8/0x3e0 arch/x86/kernel/irq_work.c:22
  sysvec_irq_work+0x8f/0xb0 arch/x86/kernel/irq_work.c:17
  asm_sysvec_irq_work+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
  __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:401 [inline]
  sw_sync_debugfs_release+0x14b/0x1d0 drivers/dma-buf/sw_sync.c:359
  __fput+0x429/0x8a0 fs/file_table.c:376
  task_work_run+0x24e/0x310 kernel/task_work.c:180
  exit_task_work include/linux/task_work.h:38 [inline]
  do_exit+0xa2c/0x2740 kernel/exit.c:871
  do_group_exit+0x206/0x2c0 kernel/exit.c:1020
  __do_sys_exit_group kernel/exit.c:1031 [inline]
  __se_sys_exit_group kernel/exit.c:1029 [inline]
  __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1029
  do_syscall_64+0xf9/0x240
  entry_SYSCALL_64_after_hwframe+0x6f/0x77
irq event stamp: 364
hardirqs last  enabled at (363): [<ffffffff8b710daf>] __raw_spin_unlock_irqrestore include/linux/spinlock_api_smp.h:151 [inline]
hardirqs last  enabled at (363): [<ffffffff8b710daf>] _raw_spin_unlock_irqrestore+0x8f/0x140 kernel/locking/spinlock.c:194
hardirqs last disabled at (364): [<ffffffff8b710bdd>] __raw_spin_lock_irq include/linux/spinlock_api_smp.h:117 [inline]
hardirqs last disabled at (364): [<ffffffff8b710bdd>] _raw_spin_lock_irq+0xad/0x120 kernel/locking/spinlock.c:170
softirqs last  enabled at (0): [<ffffffff8156a0f3>] rcu_lock_acquire include/linux/rcupdate.h:298 [inline]
softirqs last  enabled at (0): [<ffffffff8156a0f3>] rcu_read_lock include/linux/rcupdate.h:750 [inline]
softirqs last  enabled at (0): [<ffffffff8156a0f3>] copy_process+0x9c3/0x3fc0 kernel/fork.c:2366
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/9508:
 #0: ffff888086cd7748 (&f->f_pos_lock){+.+.}-{3:3}, at: __fdget_pos+0x258/0x320 fs/file.c:1191
 #1: ffff88801f9c8448 (&p->lock){+.+.}-{3:3}, at: seq_read_iter+0xb7/0xd60 fs/seq_file.c:182
 #2: ffffffff8ea8c5d8 (sync_timeline_list_lock){?...}-{2:2}, at: spin_lock_irq include/linux/spinlock.h:376 [inline]
 #2: ffffffff8ea8c5d8 (sync_timeline_list_lock){?...}-{2:2}, at: sync_info_debugfs_show+0x94/0x4d0 drivers/dma-buf/sync_debug.c:147

stack backtrace:
CPU: 0 PID: 9508 Comm: syz-executor.4 Not tainted 6.8.0-rc2-syzkaller-00199-g021533194476 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e7/0x2e0 lib/dump_stack.c:106
 valid_state+0x13a/0x1c0 kernel/locking/lockdep.c:4013
 mark_lock_irq+0xbb/0xc20 kernel/locking/lockdep.c:4216
 mark_lock+0x223/0x350 kernel/locking/lockdep.c:4678
 mark_held_locks kernel/locking/lockdep.c:4274 [inline]
 __trace_hardirqs_on_caller kernel/locking/lockdep.c:4292 [inline]
 lockdep_hardirqs_on_prepare+0x281/0x780 kernel/locking/lockdep.c:4359
 trace_hardirqs_on+0x28/0x40 kernel/trace/trace_preemptirq.c:61
 __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:401 [inline]
 sync_print_obj drivers/dma-buf/sync_debug.c:118 [inline]
 sync_info_debugfs_show+0x158/0x4d0 drivers/dma-buf/sync_debug.c:153
 seq_read_iter+0x445/0xd60 fs/seq_file.c:230
 seq_read+0x3a3/0x4f0 fs/seq_file.c:162
 vfs_read+0x204/0xb70 fs/read_write.c:474
 ksys_read+0x1a0/0x2c0 fs/read_write.c:619
 do_syscall_64+0xf9/0x240
 entry_SYSCALL_64_after_hwframe+0x6f/0x77
RIP: 0033:0x7fc881e7dda9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 e1 20 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 b0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fc882b390c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
RAX: ffffffffffffffda RBX: 00007fc881fabf80 RCX: 00007fc881e7dda9
RDX: 0000000000002020 RSI: 0000000020001b00 RDI: 0000000000000006
RBP: 00007fc881eca47a R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 000000000000000b R14: 00007fc881fabf80 R15: 00007fc8820cfa48
 </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 syzkaller@googlegroups.com.

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

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [syzbot] [dri?] [media?] inconsistent lock state in valid_state (2)
  2024-02-07  0:07 [syzbot] [dri?] [media?] inconsistent lock state in valid_state (2) syzbot
@ 2024-02-27  0:56 ` syzbot
  2024-05-05 14:08 ` [PATCH] dma-buf/sw-sync: don't enable IRQ from sync_print_obj() Tetsuo Handa
  1 sibling, 0 replies; 5+ messages in thread
From: syzbot @ 2024-02-27  0:56 UTC (permalink / raw)
  To: christian.koenig, dri-devel, gustavo, linaro-mm-sig-bounces,
	linaro-mm-sig, linux-kernel, linux-media, sumit.semwal,
	syzkaller-bugs

syzbot has found a reproducer for the following issue on:

HEAD commit:    d206a76d7d27 Linux 6.8-rc6
git tree:       upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=12eea106180000
kernel config:  https://syzkaller.appspot.com/x/.config?x=fad652894fc96962
dashboard link: https://syzkaller.appspot.com/bug?extid=a225ee3df7e7f9372dbe
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=1537934a180000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=1704b3e2180000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/6fa98109295d/disk-d206a76d.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/613b4087d09d/vmlinux-d206a76d.xz
kernel image: https://storage.googleapis.com/syzbot-assets/d8cd6514daf9/bzImage-d206a76d.xz

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

================================
WARNING: inconsistent lock state
6.8.0-rc6-syzkaller #0 Not tainted
--------------------------------
inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
syz-executor120/5070 [HC1[1]:SC0[0]:HE0:SE1] takes:
ffffffff8ea8cd18 (sync_timeline_list_lock){?.+.}-{2:2}, at: sync_timeline_debug_remove+0x2c/0x150 drivers/dma-buf/sync_debug.c:31
{HARDIRQ-ON-W} state was registered at:
  trace_hardirqs_on+0x28/0x40 kernel/trace/trace_preemptirq.c:61
  __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:401 [inline]
  sync_print_obj drivers/dma-buf/sync_debug.c:118 [inline]
  sync_info_debugfs_show+0x158/0x4d0 drivers/dma-buf/sync_debug.c:153
  seq_read_iter+0x445/0xd60 fs/seq_file.c:230
  seq_read+0x3a3/0x4f0 fs/seq_file.c:162
  vfs_read+0x204/0xb70 fs/read_write.c:474
  ksys_read+0x1a0/0x2c0 fs/read_write.c:619
  do_syscall_64+0xf9/0x240
  entry_SYSCALL_64_after_hwframe+0x6f/0x77
irq event stamp: 9608
hardirqs last  enabled at (9607): [<ffffffff8b71f113>] __raw_spin_unlock_irq include/linux/spinlock_api_smp.h:159 [inline]
hardirqs last  enabled at (9607): [<ffffffff8b71f113>] _raw_spin_unlock_irq+0x23/0x50 kernel/locking/spinlock.c:202
hardirqs last disabled at (9608): [<ffffffff8b66faee>] sysvec_irq_work+0xe/0xb0 arch/x86/kernel/irq_work.c:17
softirqs last  enabled at (9124): [<ffffffff81592641>] invoke_softirq kernel/softirq.c:427 [inline]
softirqs last  enabled at (9124): [<ffffffff81592641>] __irq_exit_rcu+0xf1/0x1c0 kernel/softirq.c:632
softirqs last disabled at (9119): [<ffffffff81592641>] invoke_softirq kernel/softirq.c:427 [inline]
softirqs last disabled at (9119): [<ffffffff81592641>] __irq_exit_rcu+0xf1/0x1c0 kernel/softirq.c:632

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-executor120/5070.

stack backtrace:
CPU: 0 PID: 5070 Comm: syz-executor120 Not tainted 6.8.0-rc6-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Call Trace:
 <IRQ>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e7/0x2e0 lib/dump_stack.c:106
 valid_state+0x13a/0x1c0 kernel/locking/lockdep.c:4013
 mark_lock_irq+0xbb/0xc20 kernel/locking/lockdep.c:4216
 mark_lock+0x223/0x350 kernel/locking/lockdep.c:4678
 mark_usage kernel/locking/lockdep.c:4564 [inline]
 __lock_acquire+0xb8d/0x1fd0 kernel/locking/lockdep.c:5091
 lock_acquire+0x1e3/0x530 kernel/locking/lockdep.c:5754
 __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]
 _raw_spin_lock_irqsave+0xd5/0x120 kernel/locking/spinlock.c:162
 sync_timeline_debug_remove+0x2c/0x150 drivers/dma-buf/sync_debug.c:31
 sync_timeline_free drivers/dma-buf/sw_sync.c:125 [inline]
 kref_put include/linux/kref.h:65 [inline]
 sync_timeline_put drivers/dma-buf/sw_sync.c:137 [inline]
 timeline_fence_release+0x204/0x250 drivers/dma-buf/sw_sync.c:165
 kref_put include/linux/kref.h:65 [inline]
 dma_fence_put include/linux/dma-fence.h:297 [inline]
 dma_fence_array_release+0x13e/0x240 drivers/dma-buf/dma-fence-array.c:120
 irq_work_single+0xe1/0x240 kernel/irq_work.c:221
 irq_work_run_list kernel/irq_work.c:252 [inline]
 irq_work_run+0x18b/0x350 kernel/irq_work.c:261
 __sysvec_irq_work+0xa8/0x3e0 arch/x86/kernel/irq_work.c:22
 sysvec_irq_work+0x8f/0xb0 arch/x86/kernel/irq_work.c:17
 </IRQ>
 <TASK>
 asm_sysvec_irq_work+0x1a/0x20 arch/x86/include/asm/idtentry.h:674
RIP: 0010:__raw_spin_unlock_irq include/linux/spinlock_api_smp.h:160 [inline]
RIP: 0010:_raw_spin_unlock_irq+0x29/0x50 kernel/locking/spinlock.c:202
Code: 90 f3 0f 1e fa 53 48 89 fb 48 83 c7 18 48 8b 74 24 08 e8 da 4b ff f5 48 89 df e8 92 8b 00 f6 e8 ad aa 28 f6 fb bf 01 00 00 00 <e8> 62 5c f2 f5 65 8b 05 e3 cd 91 74 85 c0 74 06 5b c3 cc cc cc cc
RSP: 0018:ffffc90003a87b50 EFLAGS: 00000282
RAX: 9ede7a61d4cee000 RBX: ffff888015fb5f30 RCX: ffffffff94485303
RDX: dffffc0000000000 RSI: ffffffff8baab640 RDI: 0000000000000001
RBP: ffff88807f87c63c R08: ffffffff8f8568af R09: 1ffffffff1f0ad15
R10: dffffc0000000000 R11: fffffbfff1f0ad16 R12: ffff888015fb5f20
R13: ffff88807f87c600 R14: dffffc0000000000 R15: ffff888015fb5ee0
 spin_unlock_irq include/linux/spinlock.h:401 [inline]
 sw_sync_debugfs_release+0x14b/0x1d0 drivers/dma-buf/sw_sync.c:359
 __fput+0x429/0x8a0 fs/file_table.c:376
 task_work_run+0x24e/0x310 kernel/task_work.c:180
 exit_task_work include/linux/task_work.h:38 [inline]
 do_exit+0xa2c/0x2740 kernel/exit.c:871
 do_group_exit+0x206/0x2c0 kernel/exit.c:1020
 __do_sys_exit_group kernel/exit.c:1031 [inline]
 __se_sys_exit_group kernel/exit.c:1029 [inline]
 __x64_sys_exit_group+0x3f/0x40 kernel/exit.c:1029
 do_syscall_64+0xf9/0x240
 entry_SYSCALL_64_after_hwframe+0x6f/0x77
RIP: 0033:0x7fb8001b9f39
Code: Unable to access opcode bytes at 0x7fb8001b9f0f.
RSP: 002b:00007ffdaf45d478 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 000000000000000
----------------
Code disassembly (best guess):
   0:	90                   	nop
   1:	f3 0f 1e fa          	endbr64
   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 da 4b ff f5       	call   0xf5ff4bf1
  17:	48 89 df             	mov    %rbx,%rdi
  1a:	e8 92 8b 00 f6       	call   0xf6008bb1
  1f:	e8 ad aa 28 f6       	call   0xf628aad1
  24:	fb                   	sti
  25:	bf 01 00 00 00       	mov    $0x1,%edi
* 2a:	e8 62 5c f2 f5       	call   0xf5f25c91 <-- trapping instruction
  2f:	65 8b 05 e3 cd 91 74 	mov    %gs:0x7491cde3(%rip),%eax        # 0x7491ce19
  36:	85 c0                	test   %eax,%eax
  38:	74 06                	je     0x40
  3a:	5b                   	pop    %rbx
  3b:	c3                   	ret
  3c:	cc                   	int3
  3d:	cc                   	int3
  3e:	cc                   	int3
  3f:	cc                   	int3


---
If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] dma-buf/sw-sync: don't enable IRQ from sync_print_obj()
  2024-02-07  0:07 [syzbot] [dri?] [media?] inconsistent lock state in valid_state (2) syzbot
  2024-02-27  0:56 ` syzbot
@ 2024-05-05 14:08 ` Tetsuo Handa
  2024-05-07 13:09   ` [Linaro-mm-sig] " Christian König
  1 sibling, 1 reply; 5+ messages in thread
From: Tetsuo Handa @ 2024-05-05 14:08 UTC (permalink / raw)
  To: syzbot, syzkaller-bugs, Sumit Semwal, Gustavo Padovan,
	Christian Konig, Sean Paul, Chris Wilson
  Cc: linux-kernel, linux-media, linaro-mm-sig, dri-devel

Since commit a6aa8fca4d79 ("dma-buf/sw-sync: Reduce irqsave/irqrestore from
known context") by error replaced spin_unlock_irqrestore() with
spin_unlock_irq() for both sync_debugfs_show() and sync_print_obj() despite
sync_print_obj() is called from sync_debugfs_show(), lockdep complains
inconsistent lock state warning.

Use plain spin_{lock,unlock}() for sync_print_obj(), for
sync_debugfs_show() is already using spin_{lock,unlock}_irq().

Reported-by: syzbot <syzbot+a225ee3df7e7f9372dbe@syzkaller.appspotmail.com>
Closes: https://syzkaller.appspot.com/bug?extid=a225ee3df7e7f9372dbe
Fixes: a6aa8fca4d79 ("dma-buf/sw-sync: Reduce irqsave/irqrestore from known context")
Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
---
 drivers/dma-buf/sync_debug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/dma-buf/sync_debug.c b/drivers/dma-buf/sync_debug.c
index 101394f16930..237bce21d1e7 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); /* Caller already disabled IRQ. */
 	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);
 }
 
 static void sync_print_sync_file(struct seq_file *s,
-- 
2.18.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Linaro-mm-sig] [PATCH] dma-buf/sw-sync: don't enable IRQ from sync_print_obj()
  2024-05-05 14:08 ` [PATCH] dma-buf/sw-sync: don't enable IRQ from sync_print_obj() Tetsuo Handa
@ 2024-05-07 13:09   ` Christian König
  2024-05-24 13:26     ` Tetsuo Handa
  0 siblings, 1 reply; 5+ messages in thread
From: Christian König @ 2024-05-07 13:09 UTC (permalink / raw)
  To: Tetsuo Handa, syzbot, syzkaller-bugs, Sumit Semwal,
	Gustavo Padovan, Christian Konig, Sean Paul, Chris Wilson
  Cc: linux-kernel, linux-media, linaro-mm-sig, dri-devel

Am 05.05.24 um 16:08 schrieb Tetsuo Handa:
> Since commit a6aa8fca4d79 ("dma-buf/sw-sync: Reduce irqsave/irqrestore from
> known context") by error replaced spin_unlock_irqrestore() with
> spin_unlock_irq() for both sync_debugfs_show() and sync_print_obj() despite
> sync_print_obj() is called from sync_debugfs_show(), lockdep complains
> inconsistent lock state warning.
>
> Use plain spin_{lock,unlock}() for sync_print_obj(), for
> sync_debugfs_show() is already using spin_{lock,unlock}_irq().
>
> Reported-by: syzbot <syzbot+a225ee3df7e7f9372dbe@syzkaller.appspotmail.com>
> Closes: https://syzkaller.appspot.com/bug?extid=a225ee3df7e7f9372dbe
> Fixes: a6aa8fca4d79 ("dma-buf/sw-sync: Reduce irqsave/irqrestore from known context")
> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>

Reviewed-by: Christian König <christian.koenig@amd.com>

> ---
>   drivers/dma-buf/sync_debug.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/dma-buf/sync_debug.c b/drivers/dma-buf/sync_debug.c
> index 101394f16930..237bce21d1e7 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); /* Caller already disabled IRQ. */
>   	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);
>   }
>   
>   static void sync_print_sync_file(struct seq_file *s,


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [Linaro-mm-sig] [PATCH] dma-buf/sw-sync: don't enable IRQ from sync_print_obj()
  2024-05-07 13:09   ` [Linaro-mm-sig] " Christian König
@ 2024-05-24 13:26     ` Tetsuo Handa
  0 siblings, 0 replies; 5+ messages in thread
From: Tetsuo Handa @ 2024-05-24 13:26 UTC (permalink / raw)
  To: Christian König, syzbot, syzkaller-bugs, Sumit Semwal,
	Gustavo Padovan, Christian Konig, Sean Paul, Chris Wilson
  Cc: linux-kernel, linux-media, linaro-mm-sig, dri-devel

On 2024/05/07 22:09, Christian König wrote:
> Am 05.05.24 um 16:08 schrieb Tetsuo Handa:
>> Since commit a6aa8fca4d79 ("dma-buf/sw-sync: Reduce irqsave/irqrestore from
>> known context") by error replaced spin_unlock_irqrestore() with
>> spin_unlock_irq() for both sync_debugfs_show() and sync_print_obj() despite
>> sync_print_obj() is called from sync_debugfs_show(), lockdep complains
>> inconsistent lock state warning.
>>
>> Use plain spin_{lock,unlock}() for sync_print_obj(), for
>> sync_debugfs_show() is already using spin_{lock,unlock}_irq().
>>
>> Reported-by: syzbot <syzbot+a225ee3df7e7f9372dbe@syzkaller.appspotmail.com>
>> Closes: https://syzkaller.appspot.com/bug?extid=a225ee3df7e7f9372dbe
>> Fixes: a6aa8fca4d79 ("dma-buf/sw-sync: Reduce irqsave/irqrestore from known context")
>> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> 
> Reviewed-by: Christian König <christian.koenig@amd.com>

Thank you. Who can take this patch?

> 
>> ---
>>   drivers/dma-buf/sync_debug.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/dma-buf/sync_debug.c b/drivers/dma-buf/sync_debug.c
>> index 101394f16930..237bce21d1e7 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); /* Caller already disabled IRQ. */
>>       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);
>>   }
>>     static void sync_print_sync_file(struct seq_file *s,
> 


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-05-24 13:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-07  0:07 [syzbot] [dri?] [media?] inconsistent lock state in valid_state (2) syzbot
2024-02-27  0:56 ` syzbot
2024-05-05 14:08 ` [PATCH] dma-buf/sw-sync: don't enable IRQ from sync_print_obj() Tetsuo Handa
2024-05-07 13:09   ` [Linaro-mm-sig] " Christian König
2024-05-24 13:26     ` Tetsuo Handa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).