netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gabriel Krisman Bertazi <krisman@suse.de>
To: Lizhi Xu <lizhi.xu@windriver.com>
Cc: <adilger.kernel@dilger.ca>,  <coreteam@netfilter.org>,
	<davem@davemloft.net>,  <ebiggers@kernel.org>,  <fw@strlen.de>,
	<jaegeuk@kernel.org>,  <kadlec@netfilter.org>,  <kuba@kernel.org>,
	<linux-ext4@vger.kernel.org>,  <linux-fscrypt@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>,  <lkp@intel.com>,
	<llvm@lists.linux.dev>,  <netdev@vger.kernel.org>,
	<netfilter-devel@vger.kernel.org>,
	 <oe-kbuild-all@lists.linux.dev>, <pablo@netfilter.org>,
	<syzbot+340581ba9dceb7e06fb3@syzkaller.appspotmail.com>,
	<syzkaller-bugs@googlegroups.com>,  <tytso@mit.edu>
Subject: Re: [PATCH V5] ext4: check hash version and filesystem casefolded consistent
Date: Tue, 04 Jun 2024 15:06:32 -0400	[thread overview]
Message-ID: <87le3kle87.fsf@mailhost.krisman.be> (raw)
In-Reply-To: <20240604011718.3360272-1-lizhi.xu@windriver.com> (Lizhi Xu's message of "Tue, 4 Jun 2024 09:17:17 +0800")

Lizhi Xu <lizhi.xu@windriver.com> writes:

> On Mon, 03 Jun 2024 10:50:51 -0400, Gabriel Krisman Bertazi wrote:
>> > When mounting the ext4 filesystem, if the hash version and casefolded are not
>> > consistent, exit the mounting.
>> >
>> > Reported-by: syzbot+340581ba9dceb7e06fb3@syzkaller.appspotmail.com
>> > Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
>> > ---
>> >  fs/ext4/super.c | 5 +++++
>> >  1 file changed, 5 insertions(+)
>> >
>> > diff --git a/fs/ext4/super.c b/fs/ext4/super.c
>> > index c682fb927b64..0ad326504c50 100644
>> > --- a/fs/ext4/super.c
>> > +++ b/fs/ext4/super.c
>> > @@ -5262,6 +5262,11 @@ static int __ext4_fill_super(struct fs_context *fc, struct super_block *sb)
>> >  		goto failed_mount;
>> >  
>> >  	ext4_hash_info_init(sb);
>> > +	if (es->s_def_hash_version == DX_HASH_SIPHASH && 
>> > +	    !ext4_has_feature_casefold(sb)) {
>> 
>> Can we ever have DX_HASH_SIPHASH set up in the super block?  I thought
>> it was used solely for directories where ext4_hash_in_dirent(inode) is
>> true.
> The value of s'def_hash_version is obtained by reading the super block from the
> buffer cache of the block device in ext4_load_super().

Yes, I know.  My point is whether this check should just be:

if (es->s_def_hash_version == DX_HASH_SIPHASH)
	goto failed_mount;

Since, IIUC, DX_HASH_SIPHASH is done per-directory and not written to
the sb.

>> If this is only for the case of a superblock corruption, perhaps we
>> should always reject the mount, whether casefold is enabled or not?
> Based on the existing information, it cannot be confirmed whether the superblock
> is corrupt, but one thing is clear: if the default hash version of the superblock
> is set to DX_HASH_SIPHASH, but the casefold feature is not set at the same time,
> it is definitely an error.


-- 
Gabriel Krisman Bertazi

  reply	other threads:[~2024-06-04 19:06 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-29 20:41 [syzbot] [fscrypt?] WARNING in fscrypt_fname_siphash syzbot
2024-05-30  7:41 ` [PATCH] ext4: add casefolded file check Lizhi Xu
2024-05-31  1:05   ` Eric Biggers
2024-05-31  1:47     ` Lizhi Xu
2024-05-31  2:20       ` Eric Biggers
2024-05-31  3:07     ` [PATCH V2] ext4: add casefolded feature check before setup encrypted info Lizhi Xu
2024-05-31  3:11       ` Eric Biggers
2024-05-31  8:58       ` kernel test robot
2024-05-31  9:06         ` [PATCH V4] ext4: check hash version and filesystem casefolded consistent Lizhi Xu
2024-05-31 18:55           ` Eric Biggers
2024-06-01 11:37             ` [PATCH V5] " Lizhi Xu
2024-06-03 14:50               ` Gabriel Krisman Bertazi
2024-06-04  1:17                 ` Lizhi Xu
2024-06-04 19:06                   ` Gabriel Krisman Bertazi [this message]
2024-06-05  1:16                     ` Lizhi Xu
2024-06-05  1:23                     ` [PATCH V6] fs/ext4: Filesystem without casefold feature cannot be mounted with spihash Lizhi Xu
2024-08-22 15:00                       ` Theodore Ts'o
2024-08-27 20:16                         ` [PATCH] ext4: Fix error message when rejecting the default hash Gabriel Krisman Bertazi
2024-09-05 14:53                           ` Theodore Ts'o
2024-06-06  6:27                     ` [PATCH V5] ext4: check hash version and filesystem casefolded consistent Eric Biggers
2024-05-31  3:30     ` [PATCH V2] ext4: add casefolded feature check before setup encrypted info Lizhi Xu
2024-05-31  3:34       ` Eric Biggers
2024-05-31  8:56         ` [PATCH V3] ext4: check hash version and filesystem casefolded consistent Lizhi Xu
2024-06-04  9:27           ` Dan Carpenter
2024-06-04  9:36             ` Lizhi Xu

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=87le3kle87.fsf@mailhost.krisman.be \
    --to=krisman@suse.de \
    --cc=adilger.kernel@dilger.ca \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=ebiggers@kernel.org \
    --cc=fw@strlen.de \
    --cc=jaegeuk@kernel.org \
    --cc=kadlec@netfilter.org \
    --cc=kuba@kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizhi.xu@windriver.com \
    --cc=lkp@intel.com \
    --cc=llvm@lists.linux.dev \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=pablo@netfilter.org \
    --cc=syzbot+340581ba9dceb7e06fb3@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --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;
as well as URLs for NNTP newsgroup(s).