All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vitaly Chikunov <vt@altlinux.org>
To: Mimi Zohar <zohar@linux.ibm.com>,
	Dmitry Kasatkin <dmitry.kasatkin@gmail.com>,
	linux-integrity@vger.kernel.org
Subject: [PATCH ima-evm-utils] Fix fsverity.test mount failure for ppc64
Date: Sat, 11 Mar 2023 12:16:44 +0300	[thread overview]
Message-ID: <20230311091644.647214-1-vt@altlinux.org> (raw)

fsverity requires fs blocksize to be equal to pagesoze, which is
different on ppc64 (64K). Default mkfs blocksize if 4K. This difference
causes mount failure and following error message:

  INFO: Mounting loopback filesystem
  mount: /tmp/fsverity-test: wrong fs type, bad option, bad superblock on /dev/loop0, missing codepage or helper program, or other error.
         dmesg(1) may have more information after failed mount system call.
  FAILURE: mounting loopback filesystem

It's said this limitation is removed in Linux v6.3, but for backward
compatibility better to leave workaround for it.

Fixes: b259a2b ("tests: add fsverity measurement test")
Signed-off-by: Vitaly Chikunov <vt@altlinux.org>
---
 tests/fsverity.test | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/fsverity.test b/tests/fsverity.test
index 01d5c35..5ad7634 100755
--- a/tests/fsverity.test
+++ b/tests/fsverity.test
@@ -120,6 +120,9 @@ create_loopback_file() {
 	case $fs_type in
 	ext4|f2fs)
 		options="-O verity"
+		# verity requires blocksize to be equal to pagesize.
+		pagesize=$(getconf PAGE_SIZE)
+		[ "$pagesize" -eq 4096 ] || options+=" -b $pagesize"
 		;;
 	btrfs)
 		;;
@@ -136,7 +139,7 @@ create_loopback_file() {
 	fi
 
 	echo "INFO: Building an $fs_type filesystem"
-	if ! mkfs -t "$fs_type" -q "${TST_IMG}" "$options"; then
+	if ! mkfs -t "$fs_type" -q "${TST_IMG}" $options; then
 		echo "${RED}FAILURE: Creating $fs_type filesystem${NORM}"
 		exit "$FAIL"
 	fi
-- 
2.33.7


             reply	other threads:[~2023-03-11  9:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-11  9:16 Vitaly Chikunov [this message]
2023-03-14 13:27 ` [PATCH ima-evm-utils] Fix fsverity.test mount failure for ppc64 R Nageswara Sastry
2023-03-14 22:38 ` Mimi Zohar

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=20230311091644.647214-1-vt@altlinux.org \
    --to=vt@altlinux.org \
    --cc=dmitry.kasatkin@gmail.com \
    --cc=linux-integrity@vger.kernel.org \
    --cc=zohar@linux.ibm.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.