ext4: only allow test_dummy_encryption when supported
Eric Biggers
maintainerPATCH v4 1/1 ext4: only allow test_dummy_encryption when supported
From: Eric Biggers <[email protected]>
Make the test_dummy_encryption mount option require that the encrypt feature flag be already enabled on the filesystem, rather than automatically enabling it. Practically, this means that "-O encrypt" will need to be included in MKFS_OPTIONS when running xfstests with the test_dummy_encryption mount option. (ext4/053 also needs an update.)
Moreover, as long as the preconditions for test_dummy_encryption are being tightened anyway, take the opportunity to start rejecting it when !CONFIG_FS_ENCRYPTION rather than ignoring it.
The motivation for requiring the encrypt feature flag is that:
- Having the filesystem auto-enable feature flags is problematic, as it bypasses the usual sanity checks. The specific issue which came up recently is that in kernel versions where ext4 supports casefold but not encrypt+casefold (v5.1 through v5.10), the kernel will happily add the encrypt flag to a filesystem that has the casefold flag, making it unmountable -- but only for subsequent mounts, not the initial one. This confused the casefold support detection in xfstests, causing generic/556 to fail rather than be skipped.
- The xfstests-bld test runners (kvm-xfstests et al.) already use the required mkfs flag, so they will not be affected by this change. Only users of test_dummy_encryption alone will be affected. But, this option has always been for testing only, so it should be fine to require that the few users of this option update their test scripts.
- f2fs already requires it (for its equivalent feature flag).
---
v4: Fixed an unused variable warning when !CONFIG_FS_ENCRYPTION, and
removed DUMMY_ENCRYPTION_ENABLED() which is no longer used.
fs/ext4/ext4.h | 6 ----- fs/ext4/super.c | 60 +++++++++++++++++++++++++++++++------------------ 2 files changed, 38 insertions(+), 28 deletions(-)
fs/ext4/ext4.h +0 -6
@@ -1442,12 +1442,6 @@ struct ext4_super_block {#ifdef __KERNEL__ -#ifdef CONFIG_FS_ENCRYPTION -#define DUMMY_ENCRYPTION_ENABLED (sbi) ((sbi)->s_dummy_enc_policy.policy != NULL) -#else -#define DUMMY_ENCRYPTION_ENABLED (sbi) (0) -#endif -/* Number of quota types we support */ #define EXT4_MAXQUOTAS 3
fs/ext4/super.c +38 -22
93 lines not on this page · raw message
Signature · 1 line
2.36.1
Quoted 29 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Make the
test_dummy_encryptionmount option require that the encrypt feature flag be already enabled on the filesystem, rather than automatically enabling it. Practically, this means that "-O encrypt" will need to be included inMKFS_OPTIONSwhen running xfstests with thetest_dummy_encryptionmount option. (ext4/053 also needs an update.)Moreover, as long as the preconditions for
test_dummy_encryptionare being tightened anyway, take the opportunity to start rejecting it when !CONFIG_FS_ENCRYPTION rather than ignoring it.The motivation for requiring the encrypt feature flag is that:
- Having the filesystem auto-enable feature flags is problematic, as it bypasses the usual sanity checks. The specific issue which came up recently is that in kernel versions where ext4 supports casefold but not encrypt+casefold (v5.1 through v5.10), the kernel will happily add the encrypt flag to a filesystem that has the casefold flag, making it unmountable -- but only for subsequent mounts, not the initial one. This confused the casefold support detection in xfstests, causing generic/556 to fail rather than be skipped.
- The xfstests-bld test runners (kvm-xfstests et al.) already use the required mkfs flag, so they will not be affected by this change. Only users of
test_dummy_encryptionalone will be affected. But, this option has always been for testing only, so it should be fine to require that the few users of this option update their test scripts.
Quoted 3 lines
- f2fs already requires it (for its equivalent feature flag).
Signed-off-by Eric Biggers <[email protected]>
Makes sense to me and code looks good. Please add:
Signature · 1 line
Gabriel Krisman Bertazi
Theodore Ts'o
maintainerQuoted 9 lines · Eric Biggers
From: Eric Biggers <[email protected]>
Make the
test_dummy_encryptionmount option require that the encrypt feature flag be already enabled on the filesystem, rather than automatically enabling it. Practically, this means that "-O encrypt" will need to be included inMKFS_OPTIONSwhen running xfstests with thetest_dummy_encryptionmount option. (ext4/053 also needs an update.)[...]
I've replaced the older version of the commit with this one, thanks!
[1/1] ext4: only allow test_dummy_encryption when supported
commit: d177c151d74881536aa6b58f450c70fd5a7b6c1a
Best regards,
Signature · 1 line
Theodore Ts'o <[email protected]>