diff mbox series

[v7,1/5] verity: require corruption functionality

Message ID 73ea99df928e64baf172fa38a0648fb21494e864.1647382272.git.boris@bur.io (mailing list archive)
State New, archived
Headers show
Series tests for btrfs fsverity | expand

Commit Message

Boris Burkov March 15, 2022, 10:15 p.m. UTC
Corrupting ext4 and f2fs relies on xfs_io fiemap. Btrfs corruption
testing will rely on a btrfs specific corruption utility. Add the
ability to require corruption functionality to make this properly
modular. To start, just check for fiemap, as that is needed
universally for _fsv_scratch_corrupt_bytes.

Signed-off-by: Boris Burkov <boris@bur.io>
---
 common/verity     | 6 ++++++
 tests/generic/574 | 1 +
 tests/generic/576 | 1 +
 3 files changed, 8 insertions(+)

Comments

Eric Biggers March 16, 2022, 5:21 p.m. UTC | #1
On Tue, Mar 15, 2022 at 03:15:57PM -0700, Boris Burkov wrote:
> Corrupting ext4 and f2fs relies on xfs_io fiemap. Btrfs corruption
> testing will rely on a btrfs specific corruption utility. Add the
> ability to require corruption functionality to make this properly
> modular. To start, just check for fiemap, as that is needed
> universally for _fsv_scratch_corrupt_bytes.
> 
> Signed-off-by: Boris Burkov <boris@bur.io>
> ---
>  common/verity     | 6 ++++++
>  tests/generic/574 | 1 +
>  tests/generic/576 | 1 +
>  3 files changed, 8 insertions(+)
> 
> diff --git a/common/verity b/common/verity
> index 38eea157..1afe4a82 100644
> --- a/common/verity
> +++ b/common/verity
> @@ -141,6 +141,12 @@ _require_fsverity_dump_metadata()
>  	_fail "Unexpected output from 'fsverity dump_metadata': $(<"$tmpfile")"
>  }
>  
> +# Check for userspace tools needed to corrupt verity data or metadata.
> +_require_fsverity_corruption()
> +{
> +       _require_xfs_io_command "fiemap"
> +}
> +
>  _scratch_mkfs_verity()
>  {
>  	case $FSTYP in
> diff --git a/tests/generic/574 b/tests/generic/574
> index 882baa21..17fdea52 100755
> --- a/tests/generic/574
> +++ b/tests/generic/574
> @@ -28,6 +28,7 @@ _cleanup()
>  _supported_fs generic
>  _require_scratch_verity
>  _disable_fsverity_signatures
> +_require_fsverity_corruption
>  
>  _scratch_mkfs_verity &>> $seqres.full
>  _scratch_mount
> diff --git a/tests/generic/576 b/tests/generic/576
> index 82fbdd71..d3e0a2d6 100755
> --- a/tests/generic/576
> +++ b/tests/generic/576
> @@ -28,6 +28,7 @@ _supported_fs generic
>  _require_scratch_verity
>  _require_scratch_encryption
>  _require_command "$KEYCTL_PROG" keyctl
> +_require_fsverity_corruption
>  _disable_fsverity_signatures
>  
>  _scratch_mkfs_encrypted_verity &>> $seqres.full

Reviewed-by: Eric Biggers <ebiggers@google.com>

- Eric
diff mbox series

Patch

diff --git a/common/verity b/common/verity
index 38eea157..1afe4a82 100644
--- a/common/verity
+++ b/common/verity
@@ -141,6 +141,12 @@  _require_fsverity_dump_metadata()
 	_fail "Unexpected output from 'fsverity dump_metadata': $(<"$tmpfile")"
 }
 
+# Check for userspace tools needed to corrupt verity data or metadata.
+_require_fsverity_corruption()
+{
+       _require_xfs_io_command "fiemap"
+}
+
 _scratch_mkfs_verity()
 {
 	case $FSTYP in
diff --git a/tests/generic/574 b/tests/generic/574
index 882baa21..17fdea52 100755
--- a/tests/generic/574
+++ b/tests/generic/574
@@ -28,6 +28,7 @@  _cleanup()
 _supported_fs generic
 _require_scratch_verity
 _disable_fsverity_signatures
+_require_fsverity_corruption
 
 _scratch_mkfs_verity &>> $seqres.full
 _scratch_mount
diff --git a/tests/generic/576 b/tests/generic/576
index 82fbdd71..d3e0a2d6 100755
--- a/tests/generic/576
+++ b/tests/generic/576
@@ -28,6 +28,7 @@  _supported_fs generic
 _require_scratch_verity
 _require_scratch_encryption
 _require_command "$KEYCTL_PROG" keyctl
+_require_fsverity_corruption
 _disable_fsverity_signatures
 
 _scratch_mkfs_encrypted_verity &>> $seqres.full