1.6 KiB
1.6 KiB
Test Case: Out-of-Bounds FLAT_PLAIN Start Block
Test ID: TC114-out-of-bounds-block Category: Error Handling Priority: Critical
Objective
Verify checked data mapping rejects /plain.bin when its resolved
startblk_lo equals the declared filesystem block count, while valid files in
the same mounted image remain readable.
Fixture Qualification
work=$(mktemp -d /tmp/repo22-tc114.XXXXXX)
tests/prepare_error_fixtures.sh "$work/fixtures"
cc -O2 -Wall -Wextra -std=c17 tests/read_probe.c -o "$work/read_probe"
python3 tests/erofs_fixture.py inspect \
"$work/fixtures/oob-start-block.erofs" --path /plain.bin
grep '^oob-start-block ' "$work/fixtures/fixture-evidence.txt"
sha256 -q "$work/fixtures/oob-start-block.erofs"
The mutator proves a nonempty FLAT_PLAIN path, records its NID and inode field
offset, sets startblk_lo to blocks_lo, recomputes CRC32C, and preserves
provider length.
FreeBSD Procedure
mkdir "$work/mnt"
unit=$(mdconfig -a -t vnode -f "$work/fixtures/oob-start-block.erofs")
mount -t erofs -o ro "/dev/$unit" "$work/mnt"
cmp "$work/fixtures/source/control.txt" "$work/mnt/control.txt"
truss -o "$work/read.truss" "$work/read_probe" expect-error \
"$work/mnt/plain.bin" 97 | tee "$work/error.out"
grep -q 'expected_errno=97' "$work/error.out"
grep -E 'read.*ERR#97' "$work/read.truss"
cmp "$work/fixtures/source/control.txt" "$work/mnt/control.txt"
umount "$work/mnt"
mdconfig -d -u "${unit#md}"
Expected Results
The target read returns errno 97 (EINTEGRITY) without issuing bytes from a
different range. Control data remains exact and cleanup is complete.