FS/XFS testing framework
 help / color / mirror / Atom feed
From: Jan Prusakowski <jprusakowski@google.com>
To: Zorro Lang <zlang@kernel.org>, Chao Yu <chao@kernel.org>,
	fstests@vger.kernel.org
Cc: jaegeuk@kernel.org, linux-f2fs-devel@lists.sourceforge.net,
	 Eric Biggers <ebiggers@google.com>,
	Jan Prusakowski <jprusakowski@google.com>
Subject: [PATCH v1] common/encrypt: Do not run _verify_ciphertext_for_encryption_policy on compressed FS
Date: Thu,  4 Sep 2025 10:54:49 +0200	[thread overview]
Message-ID: <20250904085449.290354-1-jprusakowski@google.com> (raw)

_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


             reply	other threads:[~2025-09-04  8:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-04  8:54 Jan Prusakowski [this message]
2025-09-04 17:39 ` [PATCH v1] common/encrypt: Do not run _verify_ciphertext_for_encryption_policy on compressed FS Eric Biggers
2025-09-12 13:11   ` Jan Prusakowski

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=20250904085449.290354-1-jprusakowski@google.com \
    --to=jprusakowski@google.com \
    --cc=chao@kernel.org \
    --cc=ebiggers@google.com \
    --cc=fstests@vger.kernel.org \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=zlang@kernel.org \
    /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