Linux EXT4 FS development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Shuai Liu" <847807867@qq.com>, linux-ext4@vger.kernel.org
Cc: tytso@mit.edu
Subject: Re: [PATCH v4] ext4: reject runtime casefold enablement
Date: Fri, 04 Dec 2026 00:56:21 +0000	[thread overview]
Message-ID: <sashiko-outbox-248860@kernel.org> (raw)
In-Reply-To: <tencent_06514DECB95B4A2BB120C9373541E0D2890A@qq.com>

Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [Medium] ext4: TUNE_OPS_SUPPORTED still advertises rejected encoding
  flags
- [Low] ext4: commit message falsely claims CONFIG_UNICODE=n build fix
--

commit 226964cc255f5ef2fe20fd74e60878c891e8efda
Author: Shuai Liu <847807867@qq.com>

ext4: reject runtime casefold enablement

This commit removes EXT4_FEATURE_INCOMPAT_CASEFOLD from
EXT4_TUNE_SET_INCOMPAT_SUPP and unconditionally rejects
EXT4_TUNE_FL_ENCODING and EXT4_TUNE_FL_ENCODING_FLAGS in
ext4_validate_tune_sb_params(), disallowing runtime casefold enablement
through EXT4_IOC_SET_TUNE_SB_PARAM.

Link: https://syzbot.org/bug?extid=68178aa1e39c8606392e
Link: https://lore.kernel.org/all/20261202100056.1419-1-zhaimingbing@cmss.chinamobile.com/

> This also fixes a build failure with CONFIG_UNICODE=n, where
> ext4_ioctl_set_tune_sb() referenced sb->s_encoding, which struct
> super_block only defines when CONFIG_UNICODE is enabled.

[ ... ]

> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/20261203190908.N2uDMQIX-lkp@intel.com/

[Severity: Low]
Should this paragraph and the kernel test robot trailers be removed from
the commit message?  Neither the baseline tree nor this diff references
sb->s_encoding in ext4_ioctl_set_tune_sb(), so the CONFIG_UNICODE=n build
failure only existed in the unmerged earlier revisions.

[ ... ]

> diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c
> index 83630cd40712c..a2e0fef6ff0ab 100644
> --- a/fs/ext4/ioctl.c
> +++ b/fs/ext4/ioctl.c

[ ... ]

> @@ -1514,20 +1499,10 @@ static int ext4_validate_tune_sb_params(struct super_block *sb,
>  			}
>  		}
>  	}
> -	if (params->set_flags & EXT4_TUNE_FL_ENCODING) {
> -		if (!enabling_casefold)
> -			return -EINVAL;
> -		if (params->encoding == 0)
> -			params->encoding = EXT4_ENC_UTF8_12_1;
> -		else if (params->encoding != EXT4_ENC_UTF8_12_1)
> -			return -EINVAL;
> -	}
> -	if (params->set_flags & EXT4_TUNE_FL_ENCODING_FLAGS) {
> -		if (!enabling_casefold)
> -			return -EINVAL;
> -		if (params->encoding_flags & ~SB_ENC_SUPP_MASK)
> -			return -EINVAL;
> -	}
> +	if (params->set_flags & EXT4_TUNE_FL_ENCODING)
> +		return -EINVAL;
> +	if (params->set_flags & EXT4_TUNE_FL_ENCODING_FLAGS)
> +		return -EINVAL;
>  
>  	return 0;
>  }

[Severity: Medium]
Should EXT4_TUNE_FL_ENCODING and EXT4_TUNE_FL_ENCODING_FLAGS also be
dropped from TUNE_OPS_SUPPORTED?

ext4_ioctl_get_tune_sb() copies TUNE_OPS_SUPPORTED into ret.set_flags, so
EXT4_IOC_GET_TUNE_SB_PARAM still advertises both flags to userspace (such
as tune2fs) as supported even though EXT4_IOC_SET_TUNE_SB_PARAM now
unconditionally rejects them.

Keeping them in TUNE_OPS_SUPPORTED also lets a request combining
EXT4_FEATURE_COMPAT_DIR_INDEX with an encoding flag bypass the early
~TUNE_OPS_SUPPORTED check, mutate sbi->s_hash_seed,
sbi->s_def_hash_version, and sbi->s_hash_unsigned on the live superblock,
and only then fail here with -EINVAL instead of -EOPNOTSUPP.

In addition, the EXT4_TUNE_FL_ENCODING and EXT4_TUNE_FL_ENCODING_FLAGS
branches in ext4_sb_setparams() are now dead code on the ioctl path.
Removing both flags from TUNE_OPS_SUPPORTED keeps capability discovery
accurate, rejects them early with -EOPNOTSUPP before any sbi mutation, and
allows dropping both checks here and the dead branches in
ext4_sb_setparams().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/tencent_06514DECB95B4A2BB120C9373541E0D2890A@qq.com?part=1

      reply	other threads:[~2026-12-04  0:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-04  0:34 [PATCH v4] ext4: reject runtime casefold enablement Shuai Liu
2026-12-04  0:56 ` 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-248860@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=847807867@qq.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