syzbot


possible deadlock in reiserfs_dirty_inode

Status: upstream: reported on 2022/11/25 09:22
Subsystems: reiserfs
[Documentation on labels]
Reported-by: syzbot+6aab732247079ba33345@syzkaller.appspotmail.com
First crash: 603d, last: 522d
Similar bugs (3)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
linux-6.1 possible deadlock in reiserfs_dirty_inode origin:upstream C error 40 1d08h 472d 0/3 upstream: reported C repro on 2023/04/06 01:23
linux-5.15 possible deadlock in reiserfs_dirty_inode origin:upstream C 32 2d14h 489d 0/3 upstream: reported C repro on 2023/03/19 20:48
upstream possible deadlock in reiserfs_dirty_inode reiserfs C done done 519 172d 600d 26/27 fixed on 2024/03/20 11:33

Sample crash report:
REISERFS (device loop4): journal params: device loop4, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop0): Using r5 hash to sort names
REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage.
======================================================
WARNING: possible circular locking dependency detected
4.19.211-syzkaller #0 Not tainted
------------------------------------------------------
syz-executor.0/6374 is trying to acquire lock:
0000000087b26391 (&mm->mmap_sem){++++}, at: __might_fault+0xef/0x1d0 mm/memory.c:4771

but task is already holding lock:
00000000b656685e (&sbi->lock){+.+.}, at: reiserfs_write_lock+0x75/0xf0 fs/reiserfs/lock.c:27

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&sbi->lock){+.+.}:
       reiserfs_write_lock+0x75/0xf0 fs/reiserfs/lock.c:27
       reiserfs_dirty_inode+0xce/0x250 fs/reiserfs/super.c:710
       __mark_inode_dirty+0x16b/0x1140 fs/fs-writeback.c:2164
       generic_update_time+0x21c/0x370 fs/inode.c:1659
       update_time fs/inode.c:1675 [inline]
       file_update_time+0x316/0x500 fs/inode.c:1890
       filemap_page_mkwrite+0x123/0x2f0 mm/filemap.c:2726
       do_page_mkwrite+0xd4/0x410 mm/memory.c:2486
       wp_page_shared mm/memory.c:2794 [inline]
       do_wp_page+0x980/0x2210 mm/memory.c:2894
       handle_pte_fault mm/memory.c:4191 [inline]
       __handle_mm_fault+0x258b/0x41c0 mm/memory.c:4299
       handle_mm_fault+0x436/0xb10 mm/memory.c:4336
       __do_page_fault+0x68e/0xd60 arch/x86/mm/fault.c:1412
       page_fault+0x1e/0x30 arch/x86/entry/entry_64.S:1205

-> #1 (sb_pagefaults#2){.+.+}:
       sb_start_pagefault include/linux/fs.h:1608 [inline]
       filemap_page_mkwrite+0xd7/0x2f0 mm/filemap.c:2725
       do_page_mkwrite+0xd4/0x410 mm/memory.c:2486
       wp_page_shared mm/memory.c:2794 [inline]
       do_wp_page+0x980/0x2210 mm/memory.c:2894
       handle_pte_fault mm/memory.c:4191 [inline]
       __handle_mm_fault+0x258b/0x41c0 mm/memory.c:4299
       handle_mm_fault+0x436/0xb10 mm/memory.c:4336
       __do_page_fault+0x68e/0xd60 arch/x86/mm/fault.c:1412
       page_fault+0x1e/0x30 arch/x86/entry/entry_64.S:1205

-> #0 (&mm->mmap_sem){++++}:
       __might_fault mm/memory.c:4772 [inline]
       __might_fault+0x152/0x1d0 mm/memory.c:4757
       reiserfs_ioctl+0xbb/0x9a0 fs/reiserfs/ioctl.c:103
       vfs_ioctl fs/ioctl.c:46 [inline]
       file_ioctl fs/ioctl.c:501 [inline]
       do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
       ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
       __do_sys_ioctl fs/ioctl.c:712 [inline]
       __se_sys_ioctl fs/ioctl.c:710 [inline]
       __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
       do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
       entry_SYSCALL_64_after_hwframe+0x49/0xbe

other info that might help us debug this:

F2FS-fs (loop2): invalid crc value
Chain exists of:
  &mm->mmap_sem --> sb_pagefaults#2 --> &sbi->lock

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&sbi->lock);
                               lock(sb_pagefaults#2);
                               lock(&sbi->lock);
  lock(&mm->mmap_sem);

 *** DEADLOCK ***

1 lock held by syz-executor.0/6374:
 #0: 00000000b656685e (&sbi->lock){+.+.}, at: reiserfs_write_lock+0x75/0xf0 fs/reiserfs/lock.c:27

stack backtrace:
CPU: 0 PID: 6374 Comm: syz-executor.0 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/21/2023
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
 print_circular_bug.constprop.0.cold+0x2d7/0x41e kernel/locking/lockdep.c:1222
 check_prev_add kernel/locking/lockdep.c:1866 [inline]
 check_prevs_add kernel/locking/lockdep.c:1979 [inline]
 validate_chain kernel/locking/lockdep.c:2420 [inline]
 __lock_acquire+0x30c9/0x3ff0 kernel/locking/lockdep.c:3416
 lock_acquire+0x170/0x3c0 kernel/locking/lockdep.c:3908
 __might_fault mm/memory.c:4772 [inline]
 __might_fault+0x152/0x1d0 mm/memory.c:4757
 reiserfs_ioctl+0xbb/0x9a0 fs/reiserfs/ioctl.c:103
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0xcdb/0x12e0 fs/ioctl.c:688
 ksys_ioctl+0x9b/0xc0 fs/ioctl.c:705
 __do_sys_ioctl fs/ioctl.c:712 [inline]
 __se_sys_ioctl fs/ioctl.c:710 [inline]
 __x64_sys_ioctl+0x6f/0xb0 fs/ioctl.c:710
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f5877f040f9
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:00007f5876476168 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f5878023f80 RCX: 00007f5877f040f9
RDX: 0000000020000140 RSI: 0000000080087601 RDI: 000000000000000a
RBP: 00007f5877f5fae9 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007ffe9534275f R14: 00007f5876476300 R15: 0000000000022000
REISERFS (device loop4): checking transaction log (loop4)
F2FS-fs (loop2): Mounted with checkpoint version = 48b305e4
REISERFS (device loop4): Using r5 hash to sort names
REISERFS (device loop4): Created .reiserfs_priv - reserved for xattr storage.
REISERFS (device loop0): found reiserfs format "3.6" with non-standard journal
REISERFS (device loop0): using ordered data mode
reiserfs: using flush barriers
REISERFS (device loop4): found reiserfs format "3.6" with non-standard journal
REISERFS (device loop4): using ordered data mode
reiserfs: using flush barriers
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 loop4): journal params: device loop4, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop4): checking transaction log (loop4)
REISERFS (device loop4): Using r5 hash to sort names
REISERFS (device loop4): Created .reiserfs_priv - reserved for xattr storage.
REISERFS (device loop0): checking transaction log (loop0)
REISERFS (device loop0): Using r5 hash to sort names
REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage.
caif:caif_disconnect_client(): nothing to disconnect
REISERFS (device loop0): found reiserfs format "3.6" with non-standard journal
REISERFS (device loop0): using ordered data mode
REISERFS (device loop4): found reiserfs format "3.6" with non-standard journal
reiserfs: using flush barriers
REISERFS (device loop4): using ordered data mode
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: using flush barriers
REISERFS (device loop4): journal params: device loop4, 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 loop4): checking transaction log (loop4)
REISERFS (device loop0): Using r5 hash to sort names
REISERFS (device loop0): Created .reiserfs_priv - reserved for xattr storage.
REISERFS (device loop4): Using r5 hash to sort names
REISERFS (device loop4): Created .reiserfs_priv - reserved for xattr storage.
caif:caif_disconnect_client(): nothing to disconnect
REISERFS (device loop4): found reiserfs format "3.6" with non-standard journal
REISERFS (device loop4): using ordered data mode
reiserfs: using flush barriers
REISERFS (device loop4): journal params: device loop4, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop4): checking transaction log (loop4)
REISERFS (device loop4): Using r5 hash to sort names
REISERFS (device loop4): Created .reiserfs_priv - reserved for xattr storage.
caif:caif_disconnect_client(): nothing to disconnect
F2FS-fs (loop2): invalid crc value
F2FS-fs (loop2): Mounted with checkpoint version = 48b305e4
REISERFS (device loop4): found reiserfs format "3.6" with non-standard journal
REISERFS (device loop4): using ordered data mode
reiserfs: using flush barriers
REISERFS (device loop4): journal params: device loop4, size 512, journal first block 18, max trans len 256, max batch 225, max commit age 30, max trans age 30
REISERFS (device loop4): checking transaction log (loop4)
REISERFS (device loop4): Using r5 hash to sort names
REISERFS (device loop4): Created .reiserfs_priv - reserved for xattr storage.
F2FS-fs (loop2): invalid crc value
F2FS-fs (loop2): Mounted with checkpoint version = 48b305e4

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2023/02/14 16:42 linux-4.19.y 3f8a27f9e27b 93ae7e0a .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in reiserfs_dirty_inode
2022/11/25 09:21 linux-4.19.y 3f8a27f9e27b 74a66371 .config console log report info [disk image] [vmlinux] ci2-linux-4-19 possible deadlock in reiserfs_dirty_inode
* Struck through repros no longer work on HEAD.