From: Deepanshu Kartikey <kartikey406@gmail.com>
To: eadavis@qq.com
Cc: konishi.ryusuke@gmail.com, linux-kernel@vger.kernel.org,
linux-nilfs@vger.kernel.org, slava@dubeyko.com,
syzbot+4b4093b1f24ad789bf37@syzkaller.appspotmail.com,
syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH] nilfs2: no longer save to shadow map if the num of members is too small
Date: Tue, 17 Mar 2026 20:45:06 +0530 [thread overview]
Message-ID: <20260317151506.881298-1-kartikey406@gmail.com> (raw)
In-Reply-To: <tencent_5E9ECE1B9E4B941B182565BAC2BB48336408@qq.com>
Hi Edward,
On Mon, 17 Mar 2026, Edward Adam Davis wrote:
> The value of argv0.v_nmembs passed from userspace is 0. This prevents
> nilfs_iget_for_gc() from being called to initialize the gcinode during
> the execution of nilfs_ioctl_move_blocks(). Consequently, this triggers
> a null-ptr-deref involving ii->i_assoc_inode within the subsequent call
> sequence: nilfs_clean_segments()->nilfs_mdt_save_to_shadow_map() [1].
This analysis is incorrect. The null-ptr-deref is not caused by
nilfs_iget_for_gc() not being called. The real problem is that
ns_dat->i_assoc_inode (the DAT inode's btree node cache) is never
initialized at mount time.
> A check for argv[0].v_nmembs has been added to nilfs_clean_segments()
> to prevent this potential null-ptr-deref of ii->i_assoc_inode.
This fixes the symptom but not the root cause. Also note that in
the original syzkaller reproducer:
argv[0].v_nmembs = 0xd = 13 > 0
Your check would NOT prevent the crash with the original reproducer.
The correct fix is to initialize the btnode cache eagerly in
nilfs_dat_read() at mount time, since i_assoc_inode is only
initialized lazily during btree operations. When
NILFS_IOCTL_CLEAN_SEGMENTS is called before any btree operation
has occurred, i_assoc_inode is NULL.
I have already submitted this fix and syzbot confirmed it as fixed:
https://lore.kernel.org/all/20260317090109.878401-1-kartikey406@gmail.com/T/
Regards,
Deepanshu Kartikey
next prev parent reply other threads:[~2026-03-17 15:15 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 3:14 [syzbot] [nilfs?] general protection fault in nilfs_mdt_save_to_shadow_map syzbot
2026-03-17 3:40 ` Forwarded: [PATCH] nilfs2: fix NULL i_assoc_inode dereference " syzbot
2026-03-17 4:25 ` Forwarded: [PATCH] nilfs2: fix wrong inode returned from nilfs_iget_for_shadow on cache hit syzbot
2026-03-17 6:25 ` Forwarded: [PATCH] nilfs2: fix missing i_assoc_inode initialization in nilfs_iget_for_shadow syzbot
2026-03-17 6:47 ` Forwarded: [PATCH] nilfs2: fix uninitialized btree node cache in nilfs_attach_btree_node_cache syzbot
2026-03-17 7:36 ` syzbot
2026-03-17 8:09 ` [syzbot] [nilfs?] general protection fault in nilfs_mdt_save_to_shadow_map Edward Adam Davis
2026-03-17 8:41 ` syzbot
2026-03-17 8:26 ` Forwarded: [PATCH] nilfs2: fix NULL i_assoc_inode dereference " syzbot
2026-03-17 8:29 ` [PATCH] nilfs2: no longer save to shadow map if the num of members is too small Edward Adam Davis
2026-03-17 15:13 ` Deepanshu Kartikey
2026-03-17 15:15 ` Deepanshu Kartikey [this message]
2026-03-17 16:51 ` Ryusuke Konishi
2026-03-17 23:00 ` Ryusuke Konishi
2026-03-18 0:08 ` Edward Adam Davis
2026-03-18 0:54 ` Ryusuke Konishi
2026-03-18 1:16 ` Edward Adam Davis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260317151506.881298-1-kartikey406@gmail.com \
--to=kartikey406@gmail.com \
--cc=eadavis@qq.com \
--cc=konishi.ryusuke@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nilfs@vger.kernel.org \
--cc=slava@dubeyko.com \
--cc=syzbot+4b4093b1f24ad789bf37@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®