One of the test cases in generic/574 tests that if a file of length
130999 has fs-verity enabled, and if bytes 131000..131071 (i.e. some
bytes past EOF and in the same block as EOF) are corrupted with nonzero
values, then reads of the corrupted part should fail with EIO.
This isn't a valid test case, because reads that start at or past EOF
are allowed to simply return 0 without doing any I/O.
Therefore, don't run this test case.
This fixes a test failure caused by the kernel commit
8c8387ee3f55
("mm: stop filemap_read() from grabbing a superfluous page").
Note that the other test cases for this same corrupted file remain
valid, including testing that an error is reported during full file
reads and during mmap "reads". This is because the fs-verity Merkle
tree is defined over full blocks, so the file's last block won't be
readable if it contains corrupted (nonzero) bytes past EOF. This may
seem odd, but it's working as intended, especially considering that
bytes past EOF in a file's last block are exposed to userspace in mmaps.
Signed-off-by: Eric Biggers <ebiggers@google.com>
dd if=$fsv_file bs=$FSV_BLOCK_SIZE iflag=direct status=none \
of=/dev/null |& _filter_scratch
- if ! $is_merkle_tree; then
+ if (( zap_offset < file_len )) && ! $is_merkle_tree; then
echo "Validating corruption (reading just corrupted part)..."
dd if=$fsv_file bs=1 skip=$zap_offset count=$zap_len \
of=/dev/null status=none |& _filter_scratch
md5sum: SCRATCH_MNT/file.fsv: Input/output error
Validating corruption (direct I/O)...
dd: error reading 'SCRATCH_MNT/file.fsv': Input/output error
-Validating corruption (reading just corrupted part)...
-dd: error reading 'SCRATCH_MNT/file.fsv': Input/output error
Validating corruption (reading full file via mmap)...
Bus error
Validating corruption (reading just corrupted part via mmap)...