* Re: [PATCH V2] ext4: add casefolded feature check before setup encrypted info
[not found] <20240531010513.GA9629@sol.localdomain>
@ 2024-05-31 3:30 ` Lizhi Xu
2024-05-31 3:34 ` Eric Biggers
0 siblings, 1 reply; 5+ messages in thread
From: Lizhi Xu @ 2024-05-31 3:30 UTC (permalink / raw)
To: ebiggers
Cc: coreteam, davem, fw, jaegeuk, kadlec, kuba, linux-fscrypt,
linux-kernel, lizhi.xu, netdev, netfilter-devel, pablo,
syzbot+340581ba9dceb7e06fb3, syzkaller-bugs, tytso,
adilger.kernel, linux-ext4
On Thu, 30 May 2024 20:11:33 -0700, Eric Biggers wrote:
> > Due to the current file system not supporting the casefolded feature, only
> > i_crypt_info was initialized when creating encrypted information, without actually
> > setting the sighash. Therefore, when creating an inode, if the system does not
> > support the casefolded feature, encrypted information will not be created.
> >
> > Reported-by: syzbot+340581ba9dceb7e06fb3@syzkaller.appspotmail.com
> > Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
> > ---
> > fs/ext4/ialloc.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
> > index e9bbb1da2d0a..47b75589fdf4 100644
> > --- a/fs/ext4/ialloc.c
> > +++ b/fs/ext4/ialloc.c
> > @@ -983,7 +983,8 @@ struct inode *__ext4_new_inode(struct mnt_idmap *idmap,
> > ei->i_projid = make_kprojid(&init_user_ns, EXT4_DEF_PROJID);
> >
> > if (!(i_flags & EXT4_EA_INODE_FL)) {
> > - err = fscrypt_prepare_new_inode(dir, inode, &encrypt);
> > + if (ext4_has_feature_casefold(inode->i_sb))
> > + err = fscrypt_prepare_new_inode(dir, inode, &encrypt);
> > if (err)
> > goto out;
>
> No, this is not correct at all. This just disables encryption on filesystems
> with the casefold feature.
If filesystems not support casefold feature, Why do I need to setup encrypted
information when creating a directory? Can encrypted information not include *hash?
>
> As I said before, please also use the correct mailing lists.
Added.
Lizhi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2] ext4: add casefolded feature check before setup encrypted info
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
0 siblings, 1 reply; 5+ messages in thread
From: Eric Biggers @ 2024-05-31 3:34 UTC (permalink / raw)
To: Lizhi Xu
Cc: coreteam, davem, fw, jaegeuk, kadlec, kuba, linux-fscrypt,
linux-kernel, netdev, netfilter-devel, pablo,
syzbot+340581ba9dceb7e06fb3, syzkaller-bugs, tytso,
adilger.kernel, linux-ext4
On Fri, May 31, 2024 at 11:30:44AM +0800, 'Lizhi Xu' via syzkaller-bugs wrote:
> On Thu, 30 May 2024 20:11:33 -0700, Eric Biggers wrote:
> > > Due to the current file system not supporting the casefolded feature, only
> > > i_crypt_info was initialized when creating encrypted information, without actually
> > > setting the sighash. Therefore, when creating an inode, if the system does not
> > > support the casefolded feature, encrypted information will not be created.
> > >
> > > Reported-by: syzbot+340581ba9dceb7e06fb3@syzkaller.appspotmail.com
> > > Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com>
> > > ---
> > > fs/ext4/ialloc.c | 3 ++-
> > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
> > > index e9bbb1da2d0a..47b75589fdf4 100644
> > > --- a/fs/ext4/ialloc.c
> > > +++ b/fs/ext4/ialloc.c
> > > @@ -983,7 +983,8 @@ struct inode *__ext4_new_inode(struct mnt_idmap *idmap,
> > > ei->i_projid = make_kprojid(&init_user_ns, EXT4_DEF_PROJID);
> > >
> > > if (!(i_flags & EXT4_EA_INODE_FL)) {
> > > - err = fscrypt_prepare_new_inode(dir, inode, &encrypt);
> > > + if (ext4_has_feature_casefold(inode->i_sb))
> > > + err = fscrypt_prepare_new_inode(dir, inode, &encrypt);
> > > if (err)
> > > goto out;
> >
> > No, this is not correct at all. This just disables encryption on filesystems
> > with the casefold feature.
> If filesystems not support casefold feature, Why do I need to setup encrypted
> information when creating a directory? Can encrypted information not include *hash?
Encryption is a separate feature. It is supported both with and without
casefold.
- Eric
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH V3] ext4: check hash version and filesystem casefolded consistent
2024-05-31 3:34 ` Eric Biggers
@ 2024-05-31 8:56 ` Lizhi Xu
2024-06-04 9:27 ` Dan Carpenter
0 siblings, 1 reply; 5+ messages in thread
From: Lizhi Xu @ 2024-05-31 8:56 UTC (permalink / raw)
To: ebiggers
Cc: adilger.kernel, coreteam, davem, fw, jaegeuk, kadlec, kuba,
linux-ext4, linux-fscrypt, linux-kernel, lizhi.xu, netdev,
netfilter-devel, pablo, syzbot+340581ba9dceb7e06fb3,
syzkaller-bugs, tytso
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 | 3 +++
1 file changed, 3 insertions(+)
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index c682fb927b64..c0036e3922c2 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5262,6 +5262,9 @@ 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))
+ goto failed_mount;
err = ext4_handle_clustersize(sb);
if (err)
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V3] ext4: check hash version and filesystem casefolded consistent
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
0 siblings, 1 reply; 5+ messages in thread
From: Dan Carpenter @ 2024-06-04 9:27 UTC (permalink / raw)
To: oe-kbuild, Lizhi Xu, ebiggers
Cc: lkp, oe-kbuild-all, adilger.kernel, coreteam, davem, fw, jaegeuk,
kadlec, kuba, linux-ext4, linux-fscrypt, linux-kernel, lizhi.xu,
netdev, netfilter-devel, pablo, syzbot+340581ba9dceb7e06fb3,
syzkaller-bugs, tytso
Hi Lizhi,
kernel test robot noticed the following build warnings:
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Lizhi-Xu/ext4-check-hash-version-and-filesystem-casefolded-consistent/20240531-170046
base: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
patch link: https://lore.kernel.org/r/20240531085647.2918240-1-lizhi.xu%40windriver.com
patch subject: [PATCH V3] ext4: check hash version and filesystem casefolded consistent
config: i386-randconfig-141-20240601 (https://download.01.org/0day-ci/archive/20240602/202406020752.Ii2MU4KP-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202406020752.Ii2MU4KP-lkp@intel.com/
smatch warnings:
fs/ext4/super.c:5287 __ext4_fill_super() warn: missing error code 'err'
vim +/err +5287 fs/ext4/super.c
d4fab7b28e2f5d7 Theodore Ts'o 2023-04-27 5280 err = ext4_block_group_meta_init(sb, silent);
d4fab7b28e2f5d7 Theodore Ts'o 2023-04-27 5281 if (err)
0d1ee42f27d30ee Alexandre Ratchov 2006-10-11 5282 goto failed_mount;
0b8e58a140cae2b Andreas Dilger 2009-06-03 5283
db9345d9e6f075e Jason Yan 2023-03-23 5284 ext4_hash_info_init(sb);
66b3f078839bbdb Lizhi Xu 2024-05-31 5285 if (es->s_def_hash_version == DX_HASH_SIPHASH &&
66b3f078839bbdb Lizhi Xu 2024-05-31 5286 !ext4_has_feature_casefold(sb))
66b3f078839bbdb Lizhi Xu 2024-05-31 @5287 goto failed_mount;
Should this be an error path? err = something?
ac27a0ec112a089 Dave Kleikamp 2006-10-11 5288
d4fab7b28e2f5d7 Theodore Ts'o 2023-04-27 5289 err = ext4_handle_clustersize(sb);
d4fab7b28e2f5d7 Theodore Ts'o 2023-04-27 5290 if (err)
281b59959707dfa Theodore Ts'o 2011-09-09 5291 goto failed_mount;
960fd856fdc3b08 Theodore Ts'o 2013-07-05 5292
d4fab7b28e2f5d7 Theodore Ts'o 2023-04-27 5293 err = ext4_check_geometry(sb, es);
d4fab7b28e2f5d7 Theodore Ts'o 2023-04-27 5294 if (err)
bfe0a5f47ada40d Theodore Ts'o 2018-06-17 5295 goto failed_mount;
bfe0a5f47ada40d Theodore Ts'o 2018-06-17 5296
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V3] ext4: check hash version and filesystem casefolded consistent
2024-06-04 9:27 ` Dan Carpenter
@ 2024-06-04 9:36 ` Lizhi Xu
0 siblings, 0 replies; 5+ messages in thread
From: Lizhi Xu @ 2024-06-04 9:36 UTC (permalink / raw)
To: dan.carpenter
Cc: adilger.kernel, coreteam, davem, ebiggers, fw, jaegeuk, kadlec,
kuba, linux-ext4, linux-fscrypt, linux-kernel, lizhi.xu, lkp,
netdev, netfilter-devel, oe-kbuild-all, oe-kbuild, pablo,
syzbot+340581ba9dceb7e06fb3, syzkaller-bugs, tytso
On Tue, 4 Jun 2024 12:27:06 +0300, Dan Carpenter wrote:
> kernel test robot noticed the following build warnings:
>
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
>
> url: https://github.com/intel-lab-lkp/linux/commits/Lizhi-Xu/ext4-check-hash-version-and-filesystem-casefolded-consistent/20240531-170046
> base: https://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4.git dev
> patch link: https://lore.kernel.org/r/20240531085647.2918240-1-lizhi.xu%40windriver.com
> patch subject: [PATCH V3] ext4: check hash version and filesystem casefolded consistent
> config: i386-randconfig-141-20240601 (https://download.01.org/0day-ci/archive/20240602/202406020752.Ii2MU4KP-lkp@intel.com/config)
> compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202406020752.Ii2MU4KP-lkp@intel.com/
>
> smatch warnings:
> fs/ext4/super.c:5287 __ext4_fill_super() warn: missing error code 'err'
>
> vim +/err +5287 fs/ext4/super.c
>
> d4fab7b28e2f5d7 Theodore Ts'o 2023-04-27 5280 err = ext4_block_group_meta_init(sb, silent);
> d4fab7b28e2f5d7 Theodore Ts'o 2023-04-27 5281 if (err)
> 0d1ee42f27d30ee Alexandre Ratchov 2006-10-11 5282 goto failed_mount;
> 0b8e58a140cae2b Andreas Dilger 2009-06-03 5283
> db9345d9e6f075e Jason Yan 2023-03-23 5284 ext4_hash_info_init(sb);
> 66b3f078839bbdb Lizhi Xu 2024-05-31 5285 if (es->s_def_hash_version == DX_HASH_SIPHASH &&
> 66b3f078839bbdb Lizhi Xu 2024-05-31 5286 !ext4_has_feature_casefold(sb))
> 66b3f078839bbdb Lizhi Xu 2024-05-31 @5287 goto failed_mount;
This warning has been resolved in the following patch:
https://lore.kernel.org/all/20240601113749.473058-1-lizhi.xu@windriver.com/
Lizhi
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-06-04 9:37 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20240531010513.GA9629@sol.localdomain>
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
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox