[syzbot] possible deadlock in f2fs_write_checkpoint

24 views
Skip to first unread message

syzbot

unread,
Jan 14, 2022, 4:09:17 AM1/14/22
to ch...@kernel.org, jae...@kernel.org, linux-f2...@lists.sourceforge.net, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 57c149e506d5 Add linux-next specific files for 20220110
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=15cb8b77b00000
kernel config: https://syzkaller.appspot.com/x/.config?x=2f1cca5543ac6349
dashboard link: https://syzkaller.appspot.com/bug?extid=0b9cadf5fc45a98a5083
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+0b9cad...@syzkaller.appspotmail.com

============================================
WARNING: possible recursive locking detected
5.16.0-rc8-next-20220110-syzkaller #0 Not tainted
--------------------------------------------
f2fs_ckpt-7:2/4139 is trying to acquire lock:
ffff88807c598390 (&sem->internal_rwsem#2){+.+.}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2149 [inline]
ffff88807c598390 (&sem->internal_rwsem#2){+.+.}-{3:3}, at: f2fs_write_checkpoint+0x535/0x5d00 fs/f2fs/checkpoint.c:1615

but task is already holding lock:
ffff88807c599338 (&sem->internal_rwsem#2){+.+.}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2149 [inline]
ffff88807c599338 (&sem->internal_rwsem#2){+.+.}-{3:3}, at: __write_checkpoint_sync fs/f2fs/checkpoint.c:1744 [inline]
ffff88807c599338 (&sem->internal_rwsem#2){+.+.}-{3:3}, at: __checkpoint_and_complete_reqs+0xdd/0x360 fs/f2fs/checkpoint.c:1764

other info that might help us debug this:
Possible unsafe locking scenario:

CPU0
----
lock(&sem->internal_rwsem#2);
lock(&sem->internal_rwsem#2);

*** DEADLOCK ***

May be due to missing lock nesting notation

1 lock held by f2fs_ckpt-7:2/4139:
#0: ffff88807c599338 (&sem->internal_rwsem#2){+.+.}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2149 [inline]
#0: ffff88807c599338 (&sem->internal_rwsem#2){+.+.}-{3:3}, at: __write_checkpoint_sync fs/f2fs/checkpoint.c:1744 [inline]
#0: ffff88807c599338 (&sem->internal_rwsem#2){+.+.}-{3:3}, at: __checkpoint_and_complete_reqs+0xdd/0x360 fs/f2fs/checkpoint.c:1764

stack backtrace:
CPU: 0 PID: 4139 Comm: f2fs_ckpt-7:2 Not tainted 5.16.0-rc8-next-20220110-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_deadlock_bug kernel/locking/lockdep.c:2956 [inline]
check_deadlock kernel/locking/lockdep.c:2999 [inline]
validate_chain kernel/locking/lockdep.c:3788 [inline]
__lock_acquire.cold+0x149/0x3ab kernel/locking/lockdep.c:5027
lock_acquire kernel/locking/lockdep.c:5639 [inline]
lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5604
down_write+0x90/0x150 kernel/locking/rwsem.c:1514
f2fs_down_write fs/f2fs/f2fs.h:2149 [inline]
f2fs_write_checkpoint+0x535/0x5d00 fs/f2fs/checkpoint.c:1615
__write_checkpoint_sync fs/f2fs/checkpoint.c:1745 [inline]
__checkpoint_and_complete_reqs+0xea/0x360 fs/f2fs/checkpoint.c:1764
issue_checkpoint_thread+0xdf/0x250 fs/f2fs/checkpoint.c:1795
kthread+0x2e9/0x3a0 kernel/kthread.c:377
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
</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,
Feb 2, 2022, 8:34:27 AM2/2/22
to ch...@kernel.org, jae...@kernel.org, linux-f2...@lists.sourceforge.net, linux-...@vger.kernel.org, syzkall...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 6abab1b81b65 Add linux-next specific files for 20220202
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=178ef35bb00000
kernel config: https://syzkaller.appspot.com/x/.config?x=b8d8750556896349
dashboard link: https://syzkaller.appspot.com/bug?extid=0b9cadf5fc45a98a5083
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=150341d4700000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15649300700000

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

F2FS-fs (loop0): Can't find valid F2FS filesystem in 2th superblock
F2FS-fs (loop0): invalid crc_offset: 0
F2FS-fs (loop0): Disable nat_bits due to incorrect cp_ver (8221872453892455638, 0)
F2FS-fs (loop0): Try to recover 2th superblock, ret: 0
F2FS-fs (loop0): Mounted with checkpoint version = 7ad43cd6
============================================
WARNING: possible recursive locking detected
5.17.0-rc2-next-20220202-syzkaller #0 Not tainted
--------------------------------------------
syz-executor316/3595 is trying to acquire lock:
ffff88801d514390 (&sem->internal_rwsem#2){++++}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2156 [inline]
ffff88801d514390 (&sem->internal_rwsem#2){++++}-{3:3}, at: f2fs_write_checkpoint+0x535/0x5c90 fs/f2fs/checkpoint.c:1616

but task is already holding lock:
ffff88801d515398 (&sem->internal_rwsem#2){++++}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2156 [inline]
ffff88801d515398 (&sem->internal_rwsem#2){++++}-{3:3}, at: f2fs_issue_checkpoint+0x149/0x480 fs/f2fs/checkpoint.c:1835

other info that might help us debug this:
Possible unsafe locking scenario:

CPU0
----
lock(&sem->internal_rwsem#2);
lock(&sem->internal_rwsem#2);

*** DEADLOCK ***

May be due to missing lock nesting notation

2 locks held by syz-executor316/3595:
#0: ffff888074db00e0 (&type->s_umount_key#46){+.+.}-{3:3}, at: deactivate_super+0xa5/0xd0 fs/super.c:362
#1: ffff88801d515398 (&sem->internal_rwsem#2){++++}-{3:3}, at: f2fs_down_write fs/f2fs/f2fs.h:2156 [inline]
#1: ffff88801d515398 (&sem->internal_rwsem#2){++++}-{3:3}, at: f2fs_issue_checkpoint+0x149/0x480 fs/f2fs/checkpoint.c:1835

stack backtrace:
CPU: 0 PID: 3595 Comm: syz-executor316 Not tainted 5.17.0-rc2-next-20220202-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_deadlock_bug kernel/locking/lockdep.c:2956 [inline]
check_deadlock kernel/locking/lockdep.c:2999 [inline]
validate_chain kernel/locking/lockdep.c:3788 [inline]
__lock_acquire.cold+0x149/0x3ab kernel/locking/lockdep.c:5027
lock_acquire kernel/locking/lockdep.c:5639 [inline]
lock_acquire+0x1ab/0x510 kernel/locking/lockdep.c:5604
down_write+0x90/0x150 kernel/locking/rwsem.c:1514
f2fs_down_write fs/f2fs/f2fs.h:2156 [inline]
f2fs_write_checkpoint+0x535/0x5c90 fs/f2fs/checkpoint.c:1616
__write_checkpoint_sync fs/f2fs/checkpoint.c:1746 [inline]
f2fs_issue_checkpoint+0x156/0x480 fs/f2fs/checkpoint.c:1843
f2fs_sync_fs+0x20f/0x420 fs/f2fs/super.c:1644
sync_filesystem.part.0+0x13c/0x1d0 fs/sync.c:66
sync_filesystem+0x8b/0xc0 fs/sync.c:43
generic_shutdown_super+0x70/0x400 fs/super.c:445
kill_block_super+0x97/0xf0 fs/super.c:1394
kill_f2fs_super+0x2b3/0x3c0 fs/f2fs/super.c:4523
deactivate_locked_super+0x94/0x160 fs/super.c:332
deactivate_super+0xad/0xd0 fs/super.c:363
cleanup_mnt+0x3a2/0x540 fs/namespace.c:1159
task_work_run+0xdd/0x1a0 kernel/task_work.c:164
exit_task_work include/linux/task_work.h:32 [inline]
do_exit+0xb29/0x2b10 kernel/exit.c:806
do_group_exit+0xd2/0x2f0 kernel/exit.c:935
__do_sys_exit_group kernel/exit.c:946 [inline]
__se_sys_exit_group kernel/exit.c:944 [inline]
__x64_sys_exit_group+0x3a/0x50 kernel/exit.c:944
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:0x7f93b7998639
Code: Unable to access opcode bytes at RIP 0x7f93b799860f.
RSP: 002b:00007fffe1dc7708 EFLAGS: 00000246 ORIG_RAX: 00000000000000e7
RAX: ffffffffffffffda RBX: 00007f93b7a0d3

syzbot

unread,
Feb 2, 2022, 9:23:08 PM2/2/22
to ch...@kernel.org, jae...@kernel.org, linux-f2...@lists.sourceforge.net, linux-...@vger.kernel.org, syzkall...@googlegroups.com, timm...@google.com
syzbot has bisected this issue to:

commit e4544b63a7ee49e7fbebf35ece0a6acd3b9617ae
Author: Tim Murray <timm...@google.com>
Date: Fri Jan 7 20:48:44 2022 +0000

f2fs: move f2fs to use reader-unfair rwsems

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=108e6078700000
start commit: 6abab1b81b65 Add linux-next specific files for 20220202
git tree: linux-next
final oops: https://syzkaller.appspot.com/x/report.txt?x=128e6078700000
console output: https://syzkaller.appspot.com/x/log.txt?x=148e6078700000
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12de9cb8700000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=11953798700000

Reported-by: syzbot+0b9cad...@syzkaller.appspotmail.com
Fixes: e4544b63a7ee ("f2fs: move f2fs to use reader-unfair rwsems")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection
Reply all
Reply to author
Forward
0 new messages