[syzbot] INFO: trying to register non-static key in f2fs_handle_error

7 views
Skip to first unread message

syzbot

unread,
Nov 5, 2022, 12:07:53ā€ÆPM11/5/22
to ch...@kernel.org, jae...@kernel.org, linux-f2...@lists.sourceforge.net, linux-...@vger.kernel.org, syzkall...@googlegroups.com, terr...@fb.com
Hello,

syzbot found the following issue on:

HEAD commit: 10d916c86eca Merge tag 'soc-fixes-6.1-2' of git://git.kern..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=117b4251880000
kernel config: https://syzkaller.appspot.com/x/.config?x=ddb381fe9a8f6a8b
dashboard link: https://syzkaller.appspot.com/bug?extid=40642be9b7e0bb28e0df
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2

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

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/73d5475b518c/disk-10d916c8.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/2ce12d00f04a/vmlinux-10d916c8.xz
kernel image: https://storage.googleapis.com/syzbot-assets/4d23719c0557/bzImage-10d916c8.xz

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

loop1: detected capacity change from 0 to 264192
F2FS-fs (loop1): inaccessible inode: 2, run fsck to repair
INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe
you didn't initialize this object before use?
turning off the locking correctness validator.
CPU: 1 PID: 28028 Comm: syz-executor.1 Not tainted 6.1.0-rc3-syzkaller-00239-g10d916c86eca #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 10/26/2022
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x1e3/0x2cb lib/dump_stack.c:106
assign_lock_key+0x22a/0x240 kernel/locking/lockdep.c:981
register_lock_class+0x287/0x9b0 kernel/locking/lockdep.c:1294
__lock_acquire+0xe4/0x1f60 kernel/locking/lockdep.c:4934
lock_acquire+0x1a7/0x400 kernel/locking/lockdep.c:5668
__raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
_raw_spin_lock+0x2a/0x40 kernel/locking/spinlock.c:154
spin_lock include/linux/spinlock.h:350 [inline]
f2fs_save_errors fs/f2fs/super.c:3868 [inline]
f2fs_handle_error+0x29/0x230 fs/f2fs/super.c:3896
f2fs_iget+0x215/0x4bb0 fs/f2fs/inode.c:516
f2fs_fill_super+0x47d3/0x7b50 fs/f2fs/super.c:4222
mount_bdev+0x26c/0x3a0 fs/super.c:1401
legacy_get_tree+0xea/0x180 fs/fs_context.c:610
vfs_get_tree+0x88/0x270 fs/super.c:1531
do_new_mount+0x289/0xad0 fs/namespace.c:3040
do_mount fs/namespace.c:3383 [inline]
__do_sys_mount fs/namespace.c:3591 [inline]
__se_sys_mount+0x2e3/0x3d0 fs/namespace.c:3568
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x2b/0x70 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7f5a7388cada
Code: 48 c7 c2 b8 ff ff ff f7 d8 64 89 02 b8 ff ff ff ff eb d2 e8 b8 04 00 00 0f 1f 84 00 00 00 00 00 49 89 ca b8 a5 00 00 00 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:00007f5a74682f88 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000020000200 RCX: 00007f5a7388cada
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007f5a74682fe0
RBP: 00007f5a74683020 R08: 00007f5a74683020 R09: 0000000020000000
R10: 0000000000000000 R11: 0000000000000202 R12: 0000000020000000
R13: 0000000020000100 R14: 00007f5a74682fe0 R15: 00000000200005c0
</TASK>
F2FS-fs (loop1): Failed to read F2FS meta data inode


---
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,
Nov 7, 2022, 7:15:54ā€ÆPM11/7/22
to ch...@kernel.org, jae...@kernel.org, linux-f2...@lists.sourceforge.net, linux-...@vger.kernel.org, syzkall...@googlegroups.com, terr...@fb.com
syzbot has found a reproducer for the following issue on:

HEAD commit: f0c4d9fc9cc9 Linux 6.1-rc4
git tree: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=15e494fe880000
kernel config: https://syzkaller.appspot.com/x/.config?x=ff27f0c8b406726e
dashboard link: https://syzkaller.appspot.com/bug?extid=40642be9b7e0bb28e0df
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=10822271880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14f4cd51880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/92c7e839ac32/disk-f0c4d9fc.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/b7bedbc08fb4/vmlinux-f0c4d9fc.xz
kernel image: https://storage.googleapis.com/syzbot-assets/3fe25e2dfdb7/Image-f0c4d9fc.gz.xz
mounted in repro #1: https://storage.googleapis.com/syzbot-assets/1f9d740f89a9/mount_1.gz
mounted in repro #2: https://storage.googleapis.com/syzbot-assets/6c6db4f39192/mount_2.gz

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

F2FS-fs (loop0): Invalid log_blocksize (16), supports only 12
F2FS-fs (loop0): Can't find valid F2FS filesystem in 1th superblock
F2FS-fs (loop0): inaccessible inode: 2, run fsck to repair
INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe
you didn't initialize this object before use?
turning off the locking correctness validator.
CPU: 1 PID: 3141 Comm: syz-executor147 Not tainted 6.1.0-rc4-syzkaller-31833-gf0c4d9fc9cc9 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/30/2022
Call trace:
dump_backtrace+0x1c4/0x1f0 arch/arm64/kernel/stacktrace.c:156
show_stack+0x2c/0x54 arch/arm64/kernel/stacktrace.c:163
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x104/0x16c lib/dump_stack.c:106
dump_stack+0x1c/0x58 lib/dump_stack.c:113
assign_lock_key+0x134/0x140 kernel/locking/lockdep.c:981
register_lock_class+0xc4/0x2f8 kernel/locking/lockdep.c:1294
__lock_acquire+0xa8/0x3084 kernel/locking/lockdep.c:4934
lock_acquire+0x100/0x1f8 kernel/locking/lockdep.c:5668
__raw_spin_lock include/linux/spinlock_api_smp.h:133 [inline]
_raw_spin_lock+0x54/0x6c kernel/locking/spinlock.c:154
spin_lock include/linux/spinlock.h:350 [inline]
f2fs_save_errors fs/f2fs/super.c:3868 [inline]
f2fs_handle_error+0x38/0x17c fs/f2fs/super.c:3896
f2fs_iget+0x138/0x538 fs/f2fs/inode.c:516
f2fs_fill_super+0x10fc/0x1e90 fs/f2fs/super.c:4222
mount_bdev+0x1b8/0x210 fs/super.c:1401
f2fs_mount+0x44/0x58 fs/f2fs/super.c:4580
legacy_get_tree+0x30/0x74 fs/fs_context.c:610
vfs_get_tree+0x40/0x140 fs/super.c:1531
do_new_mount+0x1dc/0x4e4 fs/namespace.c:3040
path_mount+0x358/0x890 fs/namespace.c:3370
do_mount fs/namespace.c:3383 [inline]
__do_sys_mount fs/namespace.c:3591 [inline]
__se_sys_mount fs/namespace.c:3568 [inline]
__arm64_sys_mount+0x2c4/0x3c4 fs/namespace.c:3568
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall arch/arm64/kernel/syscall.c:52 [inline]
el0_svc_common+0x138/0x220 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x48/0x164 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x150 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
F2FS-fs (loop0): Failed to read F2FS meta data inode
loop0: detected capacity change from 0 to 8192
REISERFS warning: read_super_block: reiserfs filesystem is deprecated and scheduled to be removed from the kernel in 2025
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 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 rupasov hash to sort names
REISERFS warning (device loop0): jdm-20006 create_privroot: xattrs/ACLs enabled and couldn't find/create .reiserfs_priv. Failing mount.

Tetsuo Handa

unread,
Nov 8, 2022, 9:04:39ā€ÆAM11/8/22
to syzbot, syzkall...@googlegroups.com
#syz test: git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git for-kernelci

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 3834ead04620..8df94d287a36 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -4095,6 +4095,23 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)

sbi->sb = sb;

+ /* initialize locks within allocated memory */
+ init_f2fs_rwsem(&sbi->gc_lock);
+ mutex_init(&sbi->writepages);
+ init_f2fs_rwsem(&sbi->cp_global_sem);
+ init_f2fs_rwsem(&sbi->node_write);
+ init_f2fs_rwsem(&sbi->node_change);
+ spin_lock_init(&sbi->stat_lock);
+ init_f2fs_rwsem(&sbi->cp_rwsem);
+ init_f2fs_rwsem(&sbi->quota_sem);
+ init_waitqueue_head(&sbi->cp_wait);
+ spin_lock_init(&sbi->error_lock);
+ for (i = 0; i < NR_INODE_TYPE; i++) {
+ INIT_LIST_HEAD(&sbi->inode_list[i]);
+ spin_lock_init(&sbi->inode_lock[i]);
+ }
+ mutex_init(&sbi->flush_lock);
+
/* Load the checksum driver */
sbi->s_chksum_driver = crypto_alloc_shash("crc32", 0, 0);
if (IS_ERR(sbi->s_chksum_driver)) {
@@ -4174,23 +4191,14 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)

/* init f2fs-specific super block info */
sbi->valid_super_block = valid_super_block;
- init_f2fs_rwsem(&sbi->gc_lock);
- mutex_init(&sbi->writepages);
- init_f2fs_rwsem(&sbi->cp_global_sem);
- init_f2fs_rwsem(&sbi->node_write);
- init_f2fs_rwsem(&sbi->node_change);

/* disallow all the data/node/meta page writes */
set_sbi_flag(sbi, SBI_POR_DOING);
- spin_lock_init(&sbi->stat_lock);

err = f2fs_init_write_merge_io(sbi);
if (err)
goto free_bio_info;

- init_f2fs_rwsem(&sbi->cp_rwsem);
- init_f2fs_rwsem(&sbi->quota_sem);
- init_waitqueue_head(&sbi->cp_wait);
init_sb_info(sbi);

err = f2fs_init_iostat(sbi);
@@ -4255,7 +4263,6 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
goto free_devices;
}

- spin_lock_init(&sbi->error_lock);
memcpy(sbi->errors, raw_super->s_errors, MAX_F2FS_ERRORS);

sbi->total_valid_node_count =
@@ -4271,12 +4278,6 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
limit_reserve_root(sbi);
adjust_unusable_cap_perc(sbi);

- for (i = 0; i < NR_INODE_TYPE; i++) {
- INIT_LIST_HEAD(&sbi->inode_list[i]);
- spin_lock_init(&sbi->inode_lock[i]);
- }
- mutex_init(&sbi->flush_lock);
-
f2fs_init_extent_cache_info(sbi);

f2fs_init_ino_entry_info(sbi);

syzbot

unread,
Nov 8, 2022, 3:01:30ā€ÆPM11/8/22
to penguin...@i-love.sakura.ne.jp, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+40642b...@syzkaller.appspotmail.com

Tested on:

commit: 56751c56 Merge branch 'for-next/fixes' into for-kernelci
console output: https://syzkaller.appspot.com/x/log.txt?x=1141b999880000
kernel config: https://syzkaller.appspot.com/x/.config?x=606e57fd25c5c6cc
dashboard link: https://syzkaller.appspot.com/bug?extid=40642be9b7e0bb28e0df
compiler: Debian clang version 13.0.1-++20220126092033+75e33f71c2da-1~exp1~20220126212112.63, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
patch: https://syzkaller.appspot.com/x/patch.diff?x=14ceeb41880000

Note: testing is done by a robot and is best-effort only.

Tetsuo Handa

unread,
Nov 8, 2022, 5:04:49ā€ÆPM11/8/22
to Jaegeuk Kim, Chao Yu, linux-f2...@lists.sourceforge.net, syzbot, terr...@fb.com, syzkall...@googlegroups.com
syzbot is reporting lockdep warning at f2fs_handle_error() [1], for
spin_lock(&sbi->error_lock) is called before spin_lock_init() is called.
For safe locking in error handling, move initialization of locks (and
obvious structures) in f2fs_fill_super() to immediately after memory
allocation.

Link: https://syzkaller.appspot.com/bug?extid=40642be9b7e0bb28e0df [1]
Reported-by: syzbot <syzbot+40642b...@syzkaller.appspotmail.com>
Signed-off-by: Tetsuo Handa <penguin...@I-love.SAKURA.ne.jp>
Tested-by: syzbot <syzbot+40642b...@syzkaller.appspotmail.com>
---
fs/f2fs/super.c | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
--
2.18.4

Chao Yu

unread,
Nov 10, 2022, 6:59:30ā€ÆAM11/10/22
to Tetsuo Handa, Jaegeuk Kim, linux-f2...@lists.sourceforge.net, syzbot, terr...@fb.com, syzkall...@googlegroups.com
On 2022/11/9 6:04, Tetsuo Handa wrote:
> syzbot is reporting lockdep warning at f2fs_handle_error() [1], for
> spin_lock(&sbi->error_lock) is called before spin_lock_init() is called.
> For safe locking in error handling, move initialization of locks (and
> obvious structures) in f2fs_fill_super() to immediately after memory
> allocation.
>
> Link: https://syzkaller.appspot.com/bug?extid=40642be9b7e0bb28e0df [1]
> Reported-by: syzbot <syzbot+40642b...@syzkaller.appspotmail.com>
> Signed-off-by: Tetsuo Handa <penguin...@I-love.SAKURA.ne.jp>
> Tested-by: syzbot <syzbot+40642b...@syzkaller.appspotmail.com>

Reviewed-by: Chao Yu <ch...@kernel.org>

Thanks,

Nick Terrell

unread,
Nov 11, 2022, 7:15:12ā€ÆPM11/11/22
to syzbot, ch...@kernel.org, jae...@kernel.org, linux-f2...@lists.sourceforge.net, Linux Kernel Mailing List, syzkall...@googlegroups.com


> On Nov 7, 2022, at 4:15 PM, syzbot <syzbot+40642b...@syzkaller.appspotmail.com> wrote:
>
> !-------------------------------------------------------------------|
> This Message Is From an External Sender
>
> |-------------------------------------------------------------------!
Not quite sure why I am CC'd here, I don't see anything related to zstd or compression in this stack.
Just want to check that it is likely unrelated, and that I'm not missing something.

Best,
Nick Terrell

Eric Biggers

unread,
Nov 11, 2022, 8:55:23ā€ÆPM11/11/22
to Nick Terrell, syzbot, ch...@kernel.org, jae...@kernel.org, linux-f2...@lists.sourceforge.net, Linux Kernel Mailing List, syzkall...@googlegroups.com
On Sat, Nov 12, 2022 at 12:15:08AM +0000, 'Nick Terrell' via syzkaller-bugs wrote:
>
> Not quite sure why I am CC'd here, I don't see anything related to zstd or compression in this stack.
> Just want to check that it is likely unrelated, and that I'm not missing something.
>
> Best,
> Nick Terrell

It's because:

$ ./scripts/get_maintainer.pl fs/f2fs/super.c
Jaegeuk Kim <jae...@kernel.org> (maintainer:F2FS FILE SYSTEM)
Chao Yu <ch...@kernel.org> (maintainer:F2FS FILE SYSTEM)
Nick Terrell <terr...@fb.com> (maintainer:ZSTD)
linux-f2...@lists.sourceforge.net (open list:F2FS FILE SYSTEM)
linux-...@vger.kernel.org (open list)

Do *not* use content regexes (K: zstd) in MAINTAINERS unless you are absolutely
sure you want to be notified about every file that contains your regex.

If you do want to use a content regex anyway, you might want to look into
changing get_maintainer.pl to make them only apply to patches that contain the
regex, as I think that might be what people are expecting it does.

- Eric

Reply all
Reply to author
Forward
0 new messages