From: Eric Biggers <ebiggers@kernel.org>
To: fstests@vger.kernel.org
Cc: linux-fscrypt@vger.kernel.org
Subject: [PATCH] generic/574: fix sporadic failure with test_dummy_encryption
Date: Mon, 17 Aug 2020 23:30:23 -0700 [thread overview]
Message-ID: <20200818063023.93833-1-ebiggers@kernel.org> (raw)
From: Eric Biggers <ebiggers@google.com>
When the "test_dummy_encryption" mount option is specified, the
fs-verity file corruption test generic/574 is flaky; it fails about 1%
of the time. This happens because in the three test cases where a
single byte of the test file is corrupted, sometimes the new byte
happens to be the same as the original. This is specific to
test_dummy_encryption because the encrypted data is nondeterministic
(and appears random), unlike the unencrypted data.
Fix this by corrupting 5 bytes instead of 1, so that the probability of
failure becomes effectively zero.
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
tests/generic/574 | 11 ++++++++---
tests/generic/574.out | 6 +++---
2 files changed, 11 insertions(+), 6 deletions(-)
diff --git a/tests/generic/574 b/tests/generic/574
index 246f0858..da776a24 100755
--- a/tests/generic/574
+++ b/tests/generic/574
@@ -135,10 +135,15 @@ corruption_test()
fi
}
-corruption_test 131072 0 1
-corruption_test 131072 4095 1
+# Note: these tests just overwrite some bytes without checking their original
+# values. Therefore, make sure to overwrite at least 5 or so bytes, to make it
+# nearly guaranteed that there will be a change -- even when the test file is
+# encrypted due to the test_dummy_encryption mount option being specified.
+
+corruption_test 131072 0 5
+corruption_test 131072 4091 5
corruption_test 131072 65536 65536
-corruption_test 131072 131071 1
+corruption_test 131072 131067 5
# Non-zeroed bytes in the final partial block beyond EOF should cause reads to
# fail too. Such bytes would be visible via mmap().
diff --git a/tests/generic/574.out b/tests/generic/574.out
index 5b304c83..d43474c5 100644
--- a/tests/generic/574.out
+++ b/tests/generic/574.out
@@ -1,6 +1,6 @@
QA output created by 574
-# Corruption test: file_len=131072 zap_offset=0 zap_len=1
+# Corruption test: file_len=131072 zap_offset=0 zap_len=5
0dfbe8aa4c20b52e1b8bf3cb6cbdf193 SCRATCH_MNT/file.fsv
Corrupting bytes...
Validating corruption (reading full file)...
@@ -14,7 +14,7 @@ Bus error
Validating corruption (reading just corrupted part via mmap)...
Bus error
-# Corruption test: file_len=131072 zap_offset=4095 zap_len=1
+# Corruption test: file_len=131072 zap_offset=4091 zap_len=5
0dfbe8aa4c20b52e1b8bf3cb6cbdf193 SCRATCH_MNT/file.fsv
Corrupting bytes...
Validating corruption (reading full file)...
@@ -42,7 +42,7 @@ Bus error
Validating corruption (reading just corrupted part via mmap)...
Bus error
-# Corruption test: file_len=131072 zap_offset=131071 zap_len=1
+# Corruption test: file_len=131072 zap_offset=131067 zap_len=5
0dfbe8aa4c20b52e1b8bf3cb6cbdf193 SCRATCH_MNT/file.fsv
Corrupting bytes...
Validating corruption (reading full file)...
--
2.28.0
reply other threads:[~2020-08-18 6:31 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20200818063023.93833-1-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=linux-fscrypt@vger.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;
as well as URLs for NNTP newsgroup(s).