diff mbox series

generic/574: don't fail the test on intentional coredump

Message ID 20240312145720.GE6188@frogsfrogsfrogs (mailing list archive)
State New, archived
Headers show
Series generic/574: don't fail the test on intentional coredump | expand

Commit Message

Darrick J. Wong March 12, 2024, 2:57 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

Don't fail this test just because the mmap read of a corrupt verity file
causes xfs_io to segfault and then dump core.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 tests/generic/574 |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Bill O'Donnell March 12, 2024, 3:30 p.m. UTC | #1
On Tue, Mar 12, 2024 at 07:57:20AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Don't fail this test just because the mmap read of a corrupt verity file
> causes xfs_io to segfault and then dump core.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>

Looks fine.
Reviewed-by: Bill O'Donnell <bodonnel@redhat.com>

> ---
>  tests/generic/574 |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/generic/574 b/tests/generic/574
> index 067b3033a8..cb42baaa67 100755
> --- a/tests/generic/574
> +++ b/tests/generic/574
> @@ -74,7 +74,8 @@ mread()
>  	# shell instance from optimizing out the fork and directly exec'ing
>  	# xfs_io.  The easiest way to do that is to append 'true' to the
>  	# commands, so that xfs_io is no longer the last command the shell sees.
> -	bash -c "trap '' SIGBUS; $XFS_IO_PROG -r $file \
> +	# Don't let it write core files to the filesystem.
> +	bash -c "trap '' SIGBUS; ulimit -c 0; $XFS_IO_PROG -r $file \
>  		-c 'mmap -r 0 $map_len' \
>  		-c 'mread -v $offset $length'; true"
>  }
>
Eric Biggers March 12, 2024, 4:43 p.m. UTC | #2
On Tue, Mar 12, 2024 at 07:57:20AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Don't fail this test just because the mmap read of a corrupt verity file
> causes xfs_io to segfault and then dump core.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
>  tests/generic/574 |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/generic/574 b/tests/generic/574
> index 067b3033a8..cb42baaa67 100755
> --- a/tests/generic/574
> +++ b/tests/generic/574
> @@ -74,7 +74,8 @@ mread()
>  	# shell instance from optimizing out the fork and directly exec'ing
>  	# xfs_io.  The easiest way to do that is to append 'true' to the
>  	# commands, so that xfs_io is no longer the last command the shell sees.
> -	bash -c "trap '' SIGBUS; $XFS_IO_PROG -r $file \
> +	# Don't let it write core files to the filesystem.
> +	bash -c "trap '' SIGBUS; ulimit -c 0; $XFS_IO_PROG -r $file \
>  		-c 'mmap -r 0 $map_len' \
>  		-c 'mread -v $offset $length'; true"
>  }

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

- Eric
diff mbox series

Patch

diff --git a/tests/generic/574 b/tests/generic/574
index 067b3033a8..cb42baaa67 100755
--- a/tests/generic/574
+++ b/tests/generic/574
@@ -74,7 +74,8 @@  mread()
 	# shell instance from optimizing out the fork and directly exec'ing
 	# xfs_io.  The easiest way to do that is to append 'true' to the
 	# commands, so that xfs_io is no longer the last command the shell sees.
-	bash -c "trap '' SIGBUS; $XFS_IO_PROG -r $file \
+	# Don't let it write core files to the filesystem.
+	bash -c "trap '' SIGBUS; ulimit -c 0; $XFS_IO_PROG -r $file \
 		-c 'mmap -r 0 $map_len' \
 		-c 'mread -v $offset $length'; true"
 }