* [PATCH v1] common/encrypt: Do not run _verify_ciphertext_for_encryption_policy on compressed FS
@ 2025-09-04 8:54 Jan Prusakowski
2025-09-04 17:39 ` Eric Biggers
0 siblings, 1 reply; 3+ messages in thread
From: Jan Prusakowski @ 2025-09-04 8:54 UTC (permalink / raw)
To: Zorro Lang, Chao Yu, fstests
Cc: jaegeuk, linux-f2fs-devel, Eric Biggers, Jan Prusakowski
_verify_ciphertext_for_encryption_policy() checks if encryption works
correctly by reading encrypted file's contents directly from a block device and
comparing it to a known good ciphertext.
This, however, won't work if the file systems is also compressed. So this patch
disables tests using this function when a compressed FS is used.
Signed-off-by: Jan Prusakowski <jprusakowski@google.com>
---
common/config | 1 +
common/encrypt | 4 ++++
common/f2fs | 7 +++++++
common/rc | 3 +++
4 files changed, 15 insertions(+)
diff --git a/common/config b/common/config
index 22b52432..1420e35d 100644
--- a/common/config
+++ b/common/config
@@ -509,6 +509,7 @@ _source_specific_fs()
;;
f2fs)
[ "$MKFS_F2FS_PROG" = "" ] && _fatal "mkfs.f2fs not found"
+ . ./common/f2fs
;;
nfs)
. ./common/nfs
diff --git a/common/encrypt b/common/encrypt
index d4f6e3dc..43ec349b 100644
--- a/common/encrypt
+++ b/common/encrypt
@@ -989,6 +989,10 @@ _verify_ciphertext_for_encryption_policy()
fi
set_encpolicy_args=${set_encpolicy_args# }
+
+ # _verify_ciphertext_for_encryption_policy will fail if the FS is compressed.
+ _require_no_compress
+
_require_scratch_encryption $set_encpolicy_args -f $policy_flags
if $hw_wrapped_key; then
_require_hw_wrapped_key_support $SCRATCH_DEV
diff --git a/common/f2fs b/common/f2fs
index 1b39d8ce..c46e2aa2 100644
--- a/common/f2fs
+++ b/common/f2fs
@@ -25,3 +25,10 @@ _require_scratch_f2fs_compression()
_scratch_unmount
fi
}
+
+_require_f2fs_no_compress()
+{
+ if _normalize_mount_options "$MOUNT_OPTIONS" | grep -q "compress"; then
+ _notrun "This test requires no compression enabled"
+ fi
+}
\ No newline at end of file
diff --git a/common/rc b/common/rc
index 81587dad..882e0588 100644
--- a/common/rc
+++ b/common/rc
@@ -2112,6 +2112,9 @@ _require_no_compress()
btrfs)
_require_btrfs_no_compress
;;
+ f2fs)
+ _require_f2fs_no_compress
+ ;;
*)
;;
esac
--
2.51.0.355.g5224444f11-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v1] common/encrypt: Do not run _verify_ciphertext_for_encryption_policy on compressed FS
2025-09-04 8:54 [PATCH v1] common/encrypt: Do not run _verify_ciphertext_for_encryption_policy on compressed FS Jan Prusakowski
@ 2025-09-04 17:39 ` Eric Biggers
2025-09-12 13:11 ` Jan Prusakowski
0 siblings, 1 reply; 3+ messages in thread
From: Eric Biggers @ 2025-09-04 17:39 UTC (permalink / raw)
To: Jan Prusakowski; +Cc: Zorro Lang, Chao Yu, fstests, jaegeuk, linux-f2fs-devel
On Thu, Sep 04, 2025 at 10:54:49AM +0200, Jan Prusakowski wrote:
> _verify_ciphertext_for_encryption_policy() checks if encryption works
> correctly by reading encrypted file's contents directly from a block device and
> comparing it to a known good ciphertext.
>
> This, however, won't work if the file systems is also compressed. So this patch
> disables tests using this function when a compressed FS is used.
Apparently this is for f2fs. There isn't really any such thing as a
"compressed filesystem" for f2fs. Rather, f2fs supports compression on
a per-file basis: the filesystem can contain a mix of compressed and
uncompressed files. Probably you used 'compression_extension=*', which
caused f2fs to automatically enable compression on the files that
xfstests created, which caused the test failure. But that behavior is
specific to 'compress_extension=*', not to compression support per se.
> diff --git a/common/f2fs b/common/f2fs
> index 1b39d8ce..c46e2aa2 100644
> --- a/common/f2fs
> +++ b/common/f2fs
> @@ -25,3 +25,10 @@ _require_scratch_f2fs_compression()
> _scratch_unmount
> fi
> }
> +
> +_require_f2fs_no_compress()
> +{
> + if _normalize_mount_options "$MOUNT_OPTIONS" | grep -q "compress"; then
> + _notrun "This test requires no compression enabled"
> + fi
> +}
That just checks for compression support, not whether the test file is
actually compressed.
But also, we don't really need to skip these tests. Instead, how about
using 'chattr +m' to explicitly set the test file to uncompressed?
- Eric
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH v1] common/encrypt: Do not run _verify_ciphertext_for_encryption_policy on compressed FS
2025-09-04 17:39 ` Eric Biggers
@ 2025-09-12 13:11 ` Jan Prusakowski
0 siblings, 0 replies; 3+ messages in thread
From: Jan Prusakowski @ 2025-09-12 13:11 UTC (permalink / raw)
To: Eric Biggers; +Cc: Zorro Lang, Chao Yu, fstests, jaegeuk, linux-f2fs-devel
On Thu, Sep 4, 2025 at 7:39 PM Eric Biggers <ebiggers@kernel.org> wrote:
> Apparently this is for f2fs. There isn't really any such thing as a
> "compressed filesystem" for f2fs. Rather, f2fs supports compression on
> a per-file basis: the filesystem can contain a mix of compressed and
> uncompressed files. Probably you used 'compression_extension=*', which
> caused f2fs to automatically enable compression on the files that
> xfstests created, which caused the test failure. But that behavior is
> specific to 'compress_extension=*', not to compression support per se.
>
Yes, I used "compression_extension=*" in my tests.
> But also, we don't really need to skip these tests. Instead, how about
> using 'chattr +m' to explicitly set the test file to uncompressed?
I tried that and "chattr +m" does not work as it tries to
simultaneously set 2 mutually exclusive compression flags (FS_COMPR_FL
and FS_NOCOMP_FL). However, "chattr -c" on an empty file works, so let
me post a v2 attempt shortly.
Thanks!
Jan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-09-12 13:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-04 8:54 [PATCH v1] common/encrypt: Do not run _verify_ciphertext_for_encryption_policy on compressed FS Jan Prusakowski
2025-09-04 17:39 ` Eric Biggers
2025-09-12 13:11 ` Jan Prusakowski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox