[v5.15] possible deadlock in reiserfs_get_block

0 views
Skip to first unread message

syzbot

unread,
Jan 27, 2025, 5:54:21 AMJan 27
Hello,

syzbot found the following issue on:

HEAD commit: 003148680b79 Linux 5.15.177
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=15a7f5df980000
kernel config: https://syzkaller.appspot.com/x/.config?x=f2c956168ff5b89
dashboard link: https://syzkaller.appspot.com/bug?extid=01ea35620ea8d97c2f23
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/452e6089e1b8/disk-00314868.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/368807beca93/vmlinux-00314868.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e98b52fba46c/bzImage-00314868.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]

REISERFS (device loop5): Created .reiserfs_priv - reserved for xattr storage.
======================================================
WARNING: possible circular locking dependency detected
5.15.177-syzkaller #0 Not tainted
------------------------------------------------------
syz.5.1688/15041 is trying to acquire lock:
ffff88807dd48828 (&mm->mmap_lock){++++}-{3:3}, at: __might_fault+0x91/0x110 mm/memory.c:5354

but task is already holding lock:
ffff888024e44090 (&sbi->lock){+.+.}-{3:3}, at: reiserfs_write_lock+0x76/0xd0 fs/reiserfs/lock.c:27

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #2 (&sbi->lock){+.+.}-{3:3}:
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
__mutex_lock_common+0x1da/0x25a0 kernel/locking/mutex.c:596
__mutex_lock kernel/locking/mutex.c:729 [inline]
mutex_lock_nested+0x17/0x20 kernel/locking/mutex.c:743
reiserfs_write_lock+0x76/0xd0 fs/reiserfs/lock.c:27
reiserfs_get_block+0x27c/0x5390 fs/reiserfs/inode.c:688
do_mpage_readpage+0x6c8/0x1f70 fs/mpage.c:231
mpage_readahead+0x427/0x9b0 fs/mpage.c:389
read_pages+0x159/0x8e0 mm/readahead.c:130
page_cache_ra_unbounded+0x7b0/0x930 mm/readahead.c:239
do_sync_mmap_readahead+0x610/0x800 mm/filemap.c:2996
filemap_fault+0x77a/0x1470 mm/filemap.c:3089
__do_fault+0x139/0x340 mm/memory.c:3926
do_shared_fault mm/memory.c:4316 [inline]
do_fault mm/memory.c:4394 [inline]
handle_pte_fault mm/memory.c:4648 [inline]
__handle_mm_fault mm/memory.c:4783 [inline]
handle_mm_fault+0x275d/0x5960 mm/memory.c:4881
do_user_addr_fault arch/x86/mm/fault.c:1357 [inline]
handle_page_fault arch/x86/mm/fault.c:1445 [inline]
exc_page_fault+0x271/0x700 arch/x86/mm/fault.c:1501
asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:606

-> #1 (mapping.invalidate_lock#3){.+.+}-{3:3}:
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
down_read+0x45/0x2e0 kernel/locking/rwsem.c:1498
filemap_invalidate_lock_shared include/linux/fs.h:844 [inline]
filemap_fault+0x708/0x1470 mm/filemap.c:3081
__do_fault+0x139/0x340 mm/memory.c:3926
do_shared_fault mm/memory.c:4316 [inline]
do_fault mm/memory.c:4394 [inline]
handle_pte_fault mm/memory.c:4648 [inline]
__handle_mm_fault mm/memory.c:4783 [inline]
handle_mm_fault+0x275d/0x5960 mm/memory.c:4881
do_user_addr_fault arch/x86/mm/fault.c:1357 [inline]
handle_page_fault arch/x86/mm/fault.c:1445 [inline]
exc_page_fault+0x271/0x700 arch/x86/mm/fault.c:1501
asm_exc_page_fault+0x22/0x30 arch/x86/include/asm/idtentry.h:606

-> #0 (&mm->mmap_lock){++++}-{3:3}:
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
__might_fault+0xb4/0x110 mm/memory.c:5355
reiserfs_ioctl+0x11d/0x340 fs/reiserfs/ioctl.c:96
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl+0xf1/0x160 fs/ioctl.c:860
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0

other info that might help us debug this:

Chain exists of:
&mm->mmap_lock --> mapping.invalidate_lock#3 --> &sbi->lock

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&sbi->lock);
lock(mapping.invalidate_lock#3);
lock(&sbi->lock);
lock(&mm->mmap_lock);

*** DEADLOCK ***

1 lock held by syz.5.1688/15041:
#0: ffff888024e44090 (&sbi->lock){+.+.}-{3:3}, at: reiserfs_write_lock+0x76/0xd0 fs/reiserfs/lock.c:27

stack backtrace:
CPU: 0 PID: 15041 Comm: syz.5.1688 Not tainted 5.15.177-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 12/27/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2d0 lib/dump_stack.c:106
check_noncircular+0x2f8/0x3b0 kernel/locking/lockdep.c:2133
check_prev_add kernel/locking/lockdep.c:3053 [inline]
check_prevs_add kernel/locking/lockdep.c:3172 [inline]
validate_chain+0x1649/0x5930 kernel/locking/lockdep.c:3788
__lock_acquire+0x1295/0x1ff0 kernel/locking/lockdep.c:5012
lock_acquire+0x1db/0x4f0 kernel/locking/lockdep.c:5623
__might_fault+0xb4/0x110 mm/memory.c:5355
reiserfs_ioctl+0x11d/0x340 fs/reiserfs/ioctl.c:96
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl+0xf1/0x160 fs/ioctl.c:860
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x3b/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x66/0xd0
RIP: 0033:0x7f08e2af9d29
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 a8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f08e0963038 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f08e2d12fa0 RCX: 00007f08e2af9d29
RDX: 0000000020000080 RSI: 0000000080087601 RDI: 0000000000000004
RBP: 00007f08e2b7b2a0 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 00007f08e2d12fa0 R15: 00007ffd9f3185a8
</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 [email protected].

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
Reply all
Reply to author
Forward
0 new messages