From: sashiko-bot@kernel.org
To: "Edward Adam Davis" <eadavis@sina.com>
Cc: linux-ext4@vger.kernel.org, tytso@mit.edu
Subject: Re: [PATCH] ext4: Add validity checks for the casefold feature
Date: Mon, 30 Nov 2026 11:14:42 +0000 [thread overview]
Message-ID: <sashiko-outbox-240927@kernel.org> (raw)
In-Reply-To: <20261130110526.116017-1-eadavis@sina.com>
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] ext4: build failure in ext4_validate_tune_sb_params() when
!CONFIG_UNICODE
- [High] ext4: !sb->s_encoding check in ext4_validate_tune_sb_params()
breaks casefold
--
commit b69d2db6559fe89244b924e5c930a3c0e5ee3784
Author: Edward Adam Davis <eadavis@sina.com>
ext4: Add validity checks for the casefold feature
This commit rejects setting EXT4_FEATURE_INCOMPAT_CASEFOLD in
ext4_validate_tune_sb_params() when sb->s_encoding is not initialized.
> diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
> index 83630cd40712c..48d30c5294908 100644
> --- a/fs/ext4/ioctl.c
> +++ b/fs/ext4/ioctl.c
> @@ -1464,7 +1464,10 @@ static int ext4_validate_tune_sb_params(struct super_block *sb,
> (params->clear_feature_incompat_mask &
> ~EXT4_TUNE_CLEAR_INCOMPAT_SUPP) ||
> (params->clear_feature_ro_compat_mask &
> - ~EXT4_TUNE_CLEAR_RO_COMPAT_SUPP))
> + ~EXT4_TUNE_CLEAR_RO_COMPAT_SUPP) ||
> + (params->set_feature_incompat_mask &
> + EXT4_FEATURE_INCOMPAT_CASEFOLD &&
> + !sb->s_encoding))
> return -EOPNOTSUPP;
>
> /*
[Severity: High]
Does accessing sb->s_encoding directly break the build when
CONFIG_UNICODE is disabled? struct super_block only defines s_encoding
under #if IS_ENABLED(CONFIG_UNICODE), and CONFIG_EXT4_FS does not depend
on CONFIG_UNICODE.
[Severity: High]
Does requiring sb->s_encoding here make it impossible to ever enable
EXT4_FEATURE_INCOMPAT_CASEFOLD via EXT4_IOC_SET_TUNE_SB_PARAM?
At mount time, ext4_encoding_init() only populates sb->s_encoding if
EXT4_FEATURE_INCOMPAT_CASEFOLD is already set in the superblock:
fs/ext4/super.c:ext4_encoding_init() {
if (!ext4_has_feature_casefold(sb) || sb->s_encoding)
return 0;
When the feature is not yet set, sb->s_encoding is NULL and this check
returns -EOPNOTSUPP. When the feature was already set at mount time,
ext4_validate_tune_sb_params() clears already-enabled features from
params->set_feature_incompat_mask right below, so the enabling_casefold
branch and the EXT4_TUNE_FL_ENCODING handling become unreachable dead
code (and test_validate_tune_sb_params() in fs/ext4/ioctl-test.c fails).
If EXT4_IOC_SET_TUNE_SB_PARAM is meant to write the feature to the
superblock for subsequent mounts without loading sb->s_encoding online,
should ext4_ioctl_setflags() check sb_has_encoding(sb) alongside
ext4_has_feature_casefold(sb) before allowing EXT4_CASEFOLD_FL to be set
on a directory?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130110526.116017-1-eadavis@sina.com?part=1
prev parent reply other threads:[~2026-11-30 11:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-30 2:39 [syzbot] [ext4?] general protection fault in utf8nlookup (2) syzbot
2026-11-30 11:05 ` [PATCH] ext4: Add validity checks for the casefold feature Edward Adam Davis
2026-11-30 11:14 ` sashiko-bot [this message]
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=sashiko-outbox-240927@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=eadavis@sina.com \
--cc=linux-ext4@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tytso@mit.edu \
/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