syzbot


possible deadlock in do_journal_begin_r

Status: upstream: reported C repro on 2023/06/25 10:36
Bug presence: origin:upstream
[Documentation on labels]
Reported-by: syzbot+072acd93ef3214032377@syzkaller.appspotmail.com
First crash: 365d, last: 24d
Bug presence (1)
Date Name Commit Repro Result
2023/06/26 upstream (ToT) a0433f8cae3a C [report] possible deadlock in page_cache_ra_unbounded
Similar bugs (4)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-4.19 possible deadlock in do_journal_begin_r reiserfs C error 45 551d 636d 0/1 upstream: reported C repro on 2022/09/27 10:45
linux-4.14 possible deadlock in do_journal_begin_r reiserfs C 55 478d 628d 0/1 upstream: reported C repro on 2022/10/05 14:07
upstream possible deadlock in do_journal_begin_r reiserfs C error error 227 156d 632d 0/27 auto-obsoleted due to no activity on 2024/05/26 14:27
linux-5.15 possible deadlock in do_journal_begin_r origin:upstream C 45 18d 371d 0/3 upstream: reported C repro on 2023/06/19 07:49
Fix bisection attempts (8)
Created Duration User Patch Repo Result
2024/05/31 21:47 2h04m bisect fix linux-6.1.y job log (0) log
2024/04/28 13:27 1h47m bisect fix linux-6.1.y job log (0) log
2024/02/23 10:38 1h31m bisect fix linux-6.1.y job log (0) log
2024/01/14 15:30 1h08m bisect fix linux-6.1.y job log (0) log
2023/12/15 04:39 1h04m bisect fix linux-6.1.y job log (0) log
2023/11/14 09:57 1h09m bisect fix linux-6.1.y job log (0) log
2023/10/11 19:41 1h03m bisect fix linux-6.1.y job log (0) log
2023/09/02 07:30 2h05m bisect fix linux-6.1.y job log (0) log

Sample crash report:
REISERFS (device loop0): journal params: device loop0, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop0): checking transaction log (loop0)
REISERFS (device loop0): Using r5 hash to sort names
REISERFS (device loop0): using 3.5.x disk format
REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage.
======================================================
WARNING: possible circular locking dependency detected
6.1.35-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor141/3852 is trying to acquire lock:
ffffc900063de0f0 (&journal->j_mutex){+.+.}-{3:3}, at: reiserfs_mutex_lock_safe fs/reiserfs/reiserfs.h:814 [inline]
ffffc900063de0f0 (&journal->j_mutex){+.+.}-{3:3}, at: lock_journal fs/reiserfs/journal.c:534 [inline]
ffffc900063de0f0 (&journal->j_mutex){+.+.}-{3:3}, at: do_journal_begin_r+0x34e/0x1020 fs/reiserfs/journal.c:3047

but task is already holding lock:
ffff888019676558 (sb_pagefaults){.+.+}-{0:0}, at: do_page_mkwrite+0x1a1/0x5f0 mm/memory.c:2973

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #3 (sb_pagefaults){.+.+}-{0:0}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
       percpu_down_read include/linux/percpu-rwsem.h:51 [inline]
       __sb_start_write include/linux/fs.h:1832 [inline]
       sb_start_pagefault include/linux/fs.h:1936 [inline]
       filemap_page_mkwrite+0x16a/0x630 mm/filemap.c:3421
       do_page_mkwrite+0x1a1/0x5f0 mm/memory.c:2973
       do_shared_fault mm/memory.c:4628 [inline]
       do_fault mm/memory.c:4696 [inline]
       handle_pte_fault mm/memory.c:4964 [inline]
       __handle_mm_fault mm/memory.c:5106 [inline]
       handle_mm_fault+0x22e8/0x5330 mm/memory.c:5227
       do_user_addr_fault arch/x86/mm/fault.c:1428 [inline]
       handle_page_fault arch/x86/mm/fault.c:1519 [inline]
       exc_page_fault+0x58d/0x790 arch/x86/mm/fault.c:1575
       asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570
       __put_user_nocheck_4+0x3/0x11
       reiserfs_ioctl+0x14d/0x340 fs/reiserfs/ioctl.c:96
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:870 [inline]
       __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:856
       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

-> #2 (&mm->mmap_lock#2){++++}-{3:3}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
       __might_fault+0xb2/0x110 mm/memory.c:5655
       reiserfs_ioctl+0x11d/0x340 fs/reiserfs/ioctl.c:96
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:870 [inline]
       __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:856
       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

-> #1 (&sbi->lock){+.+.}-{3:3}:
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
       __mutex_lock_common+0x1d4/0x2520 kernel/locking/mutex.c:603
       __mutex_lock kernel/locking/mutex.c:747 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799
       reiserfs_write_lock_nested+0x5b/0xd0 fs/reiserfs/lock.c:78
       reiserfs_mutex_lock_safe fs/reiserfs/reiserfs.h:815 [inline]
       lock_journal fs/reiserfs/journal.c:534 [inline]
       do_journal_begin_r+0x359/0x1020 fs/reiserfs/journal.c:3047
       journal_begin+0x148/0x350 fs/reiserfs/journal.c:3255
       reiserfs_fill_super+0x184f/0x2620 fs/reiserfs/super.c:2104
       mount_bdev+0x2c9/0x3f0 fs/super.c:1423
       legacy_get_tree+0xeb/0x180 fs/fs_context.c:610
       vfs_get_tree+0x88/0x270 fs/super.c:1553
       do_new_mount+0x28b/0xae0 fs/namespace.c:3040
       do_mount fs/namespace.c:3383 [inline]
       __do_sys_mount fs/namespace.c:3591 [inline]
       __se_sys_mount+0x2d5/0x3c0 fs/namespace.c:3568
       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

-> #0 (&journal->j_mutex){+.+.}-{3:3}:
       check_prev_add kernel/locking/lockdep.c:3098 [inline]
       check_prevs_add kernel/locking/lockdep.c:3217 [inline]
       validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832
       __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056
       lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
       __mutex_lock_common+0x1d4/0x2520 kernel/locking/mutex.c:603
       __mutex_lock kernel/locking/mutex.c:747 [inline]
       mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799
       reiserfs_mutex_lock_safe fs/reiserfs/reiserfs.h:814 [inline]
       lock_journal fs/reiserfs/journal.c:534 [inline]
       do_journal_begin_r+0x34e/0x1020 fs/reiserfs/journal.c:3047
       journal_begin+0x148/0x350 fs/reiserfs/journal.c:3255
       reiserfs_dirty_inode+0x11c/0x240 fs/reiserfs/super.c:710
       __mark_inode_dirty+0x331/0xf80 fs/fs-writeback.c:2411
       generic_update_time fs/inode.c:1859 [inline]
       inode_update_time fs/inode.c:1872 [inline]
       __file_update_time+0x221/0x240 fs/inode.c:2060
       file_update_time+0x34c/0x3c0 fs/inode.c:2091
       filemap_page_mkwrite+0x275/0x630 mm/filemap.c:3422
       do_page_mkwrite+0x1a1/0x5f0 mm/memory.c:2973
       do_shared_fault mm/memory.c:4628 [inline]
       do_fault mm/memory.c:4696 [inline]
       handle_pte_fault mm/memory.c:4964 [inline]
       __handle_mm_fault mm/memory.c:5106 [inline]
       handle_mm_fault+0x22e8/0x5330 mm/memory.c:5227
       do_user_addr_fault arch/x86/mm/fault.c:1428 [inline]
       handle_page_fault arch/x86/mm/fault.c:1519 [inline]
       exc_page_fault+0x58d/0x790 arch/x86/mm/fault.c:1575
       asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570
       __put_user_nocheck_4+0x3/0x11
       reiserfs_ioctl+0x14d/0x340 fs/reiserfs/ioctl.c:96
       vfs_ioctl fs/ioctl.c:51 [inline]
       __do_sys_ioctl fs/ioctl.c:870 [inline]
       __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:856
       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

other info that might help us debug this:

Chain exists of:
  &journal->j_mutex --> &mm->mmap_lock#2 --> sb_pagefaults

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(sb_pagefaults);
                               lock(&mm->mmap_lock#2);
                               lock(sb_pagefaults);
  lock(&journal->j_mutex);

 *** DEADLOCK ***

2 locks held by syz-executor141/3852:
 #0: ffff8880759435d8 (&mm->mmap_lock#2){++++}-{3:3}, at: mmap_read_lock include/linux/mmap_lock.h:117 [inline]
 #0: ffff8880759435d8 (&mm->mmap_lock#2){++++}-{3:3}, at: do_user_addr_fault arch/x86/mm/fault.c:1379 [inline]
 #0: ffff8880759435d8 (&mm->mmap_lock#2){++++}-{3:3}, at: handle_page_fault arch/x86/mm/fault.c:1519 [inline]
 #0: ffff8880759435d8 (&mm->mmap_lock#2){++++}-{3:3}, at: exc_page_fault+0x46a/0x790 arch/x86/mm/fault.c:1575
 #1: ffff888019676558 (sb_pagefaults){.+.+}-{0:0}, at: do_page_mkwrite+0x1a1/0x5f0 mm/memory.c:2973

stack backtrace:
CPU: 1 PID: 3852 Comm: syz-executor141 Not tainted 6.1.35-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Call Trace:
 <TASK>
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
 check_noncircular+0x2fa/0x3b0 kernel/locking/lockdep.c:2178
 check_prev_add kernel/locking/lockdep.c:3098 [inline]
 check_prevs_add kernel/locking/lockdep.c:3217 [inline]
 validate_chain+0x1667/0x58e0 kernel/locking/lockdep.c:3832
 __lock_acquire+0x125b/0x1f80 kernel/locking/lockdep.c:5056
 lock_acquire+0x1f8/0x5a0 kernel/locking/lockdep.c:5669
 __mutex_lock_common+0x1d4/0x2520 kernel/locking/mutex.c:603
 __mutex_lock kernel/locking/mutex.c:747 [inline]
 mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:799
 reiserfs_mutex_lock_safe fs/reiserfs/reiserfs.h:814 [inline]
 lock_journal fs/reiserfs/journal.c:534 [inline]
 do_journal_begin_r+0x34e/0x1020 fs/reiserfs/journal.c:3047
 journal_begin+0x148/0x350 fs/reiserfs/journal.c:3255
 reiserfs_dirty_inode+0x11c/0x240 fs/reiserfs/super.c:710
 __mark_inode_dirty+0x331/0xf80 fs/fs-writeback.c:2411
 generic_update_time fs/inode.c:1859 [inline]
 inode_update_time fs/inode.c:1872 [inline]
 __file_update_time+0x221/0x240 fs/inode.c:2060
 file_update_time+0x34c/0x3c0 fs/inode.c:2091
 filemap_page_mkwrite+0x275/0x630 mm/filemap.c:3422
 do_page_mkwrite+0x1a1/0x5f0 mm/memory.c:2973
 do_shared_fault mm/memory.c:4628 [inline]
 do_fault mm/memory.c:4696 [inline]
 handle_pte_fault mm/memory.c:4964 [inline]
 __handle_mm_fault mm/memory.c:5106 [inline]
 handle_mm_fault+0x22e8/0x5330 mm/memory.c:5227
 do_user_addr_fault arch/x86/mm/fault.c:1428 [inline]
 handle_page_fault arch/x86/mm/fault.c:1519 [inline]
 exc_page_fault+0x58d/0x790 arch/x86/mm/fault.c:1575
 asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:570
RIP: 0010:__put_user_nocheck_4+0x3/0x11
Code: 00 00 48 39 d9 73 54 0f 01 cb 66 89 01 31 c9 0f 01 ca c3 0f 1f 44 00 00 48 bb fd ef ff ff ff 7f 00 00 48 39 d9 73 34 0f 01 cb <89> 01 31 c9 0f 01 ca c3 66 0f 1f 44 00 00 48 bb f9 ef ff ff ff 7f
RSP: 0018:ffffc9000632feb0 EFLAGS: 00050297
RAX: 0000000000000002 RBX: 00007fffffffeffd RCX: 0000000020000000
RDX: 0000000000000001 RSI: ffffffff8aebe320 RDI: ffffffff8b3ccb60
RBP: 1ffff1100de1de4b R08: dffffc0000000000 R09: fffffbfff1ca654e
R10: 0000000000000000 R11: dffffc0000000001 R12: 0000000020000000
R13: ffff88806f0ef698 R14: ffff88806f0ef258 R15: ffff888027298f00
 reiserfs_ioctl+0x14d/0x340 fs/reiserfs/ioctl.c:96
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:870 [inline]
 __se_sys_ioctl+0xf1/0x160 fs/ioctl.c:856
 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
RIP: 0033:0x7fb8f29869d9
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 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:00007ffea26a4658 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 000000000008d44b RCX: 00007fb8f29869d9
RDX: 0000000020000000 RSI: 0000000080087601 RDI: 0000000000000005
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007ffea26a468c
R13: 00007ffea26a46c0 R14: 00007ffea26a46a0 R15: 0000000000000088
 </TASK>
----------------
Code disassembly (best guess):
   0:	00 00                	add    %al,(%rax)
   2:	48 39 d9             	cmp    %rbx,%rcx
   5:	73 54                	jae    0x5b
   7:	0f 01 cb             	stac
   a:	66 89 01             	mov    %ax,(%rcx)
   d:	31 c9                	xor    %ecx,%ecx
   f:	0f 01 ca             	clac
  12:	c3                   	retq
  13:	0f 1f 44 00 00       	nopl   0x0(%rax,%rax,1)
  18:	48 bb fd ef ff ff ff 	movabs $0x7fffffffeffd,%rbx
  1f:	7f 00 00
  22:	48 39 d9             	cmp    %rbx,%rcx
  25:	73 34                	jae    0x5b
  27:	0f 01 cb             	stac
* 2a:	89 01                	mov    %eax,(%rcx) <-- trapping instruction
  2c:	31 c9                	xor    %ecx,%ecx
  2e:	0f 01 ca             	clac
  31:	c3                   	retq
  32:	66 0f 1f 44 00 00    	nopw   0x0(%rax,%rax,1)
  38:	48                   	rex.W
  39:	bb f9 ef ff ff       	mov    $0xffffeff9,%ebx
  3e:	ff                   	(bad)
  3f:	7f                   	.byte 0x7f

Crashes (25):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/06/25 10:35 linux-6.1.y e84a4e368abe 79782afc .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan possible deadlock in do_journal_begin_r
2024/03/05 23:42 linux-6.1.y a3eb3a74aa8c f39a7eed .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
2024/03/05 13:30 linux-6.1.y a3eb3a74aa8c 5fc53669 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
2024/03/05 11:19 linux-6.1.y a3eb3a74aa8c 5fc53669 .config console log report syz C [disk image] [vmlinux] [kernel image] [mounted in repro] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
2024/03/27 22:14 linux-6.1.y e5cd595e23c1 120789fd .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_journal_begin_r
2024/03/23 09:15 linux-6.1.y d7543167affd 0ea90952 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_journal_begin_r
2024/03/18 02:17 linux-6.1.y d7543167affd d615901c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_journal_begin_r
2024/03/15 22:08 linux-6.1.y d7543167affd d615901c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan possible deadlock in do_journal_begin_r
2024/03/27 20:16 linux-6.1.y e5cd595e23c1 120789fd .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
2024/03/26 02:37 linux-6.1.y d7543167affd bcd9b39f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
2024/03/26 02:37 linux-6.1.y d7543167affd bcd9b39f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
2024/03/26 02:37 linux-6.1.y d7543167affd bcd9b39f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
2024/03/26 00:43 linux-6.1.y d7543167affd bcd9b39f .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
2024/03/25 13:30 linux-6.1.y d7543167affd 0ea90952 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
2024/03/25 05:16 linux-6.1.y d7543167affd 0ea90952 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
2024/03/23 09:05 linux-6.1.y d7543167affd 0ea90952 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
2024/03/23 06:27 linux-6.1.y d7543167affd 0ea90952 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
2024/03/23 05:52 linux-6.1.y d7543167affd 0ea90952 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
2024/03/21 19:29 linux-6.1.y d7543167affd 7a239ce7 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
2024/03/20 15:36 linux-6.1.y d7543167affd 5b7d42ae .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
2024/03/20 03:23 linux-6.1.y d7543167affd a485f239 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
2024/03/19 12:56 linux-6.1.y d7543167affd e104824c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
2024/03/19 06:34 linux-6.1.y d7543167affd baa80228 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
2024/03/18 15:20 linux-6.1.y d7543167affd baa80228 .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
2024/03/14 22:38 linux-6.1.y 61adba85cc40 d615901c .config console log report info [disk image] [vmlinux] [kernel image] ci2-linux-6-1-kasan-arm64 possible deadlock in do_journal_begin_r
* Struck through repros no longer work on HEAD.