Repository navigation
fix(virtio): round up blk device capacity and zero-pad unaligned tail… - #580
Merged
Merged
Conversation
Coverage Report for CI Build 47580470799Coverage increased (+0.9%) to 49.145%Details
Uncovered Changes
Coverage Regressions1 previously-covered line in 1 file lost coverage.
Coverage Stats💛 - Coveralls |
Lencerf
force-pushed
the
alignfix
branch
2 times, most recently
from
December 5, 2026 15:31
20f6ef7 to
9d6841b
Compare
A read or write request was passed on to the disk image at whatever sector the driver asked for. A write beyond the capacity of the device extended the image on the host, and a large enough sector overflowed the offset in the image. Fail a request with IOERR unless its data is whole sectors within the capacity of the device. Fixes: 01f5cac ("feat(block): impl raw file backed virtio-block dev") Signed-off-by: Changyuan Lyu <changyuanl@google.com>
… reads A file-backed block device floored the file size to whole 512-byte sectors, making trailing bytes inaccessible from the VM. Round the capacity up to whole sectors and zero-pad reads that legitimately cross EOF in the final partial sector on both Mio and io_uring workers. Signed-off-by: Jacob Gorm Hansen <jacobgorm@gmail.com> Signed-off-by: Changyuan Lyu <changyuanl@google.com>
The io_uring worker parses a request from guest memory again when its I/O completes. A driver that changed the header in between, e.g. to an unsupported type or a sector out of range, got the request completed by the parsing, which the worker took as unreachable and panicked. Return the request to the driver with the status from the parsing. Fixes: 342e016 ("feat(blk): io_uring based virtio-blk device") Signed-off-by: Changyuan Lyu <changyuanl@google.com>
Collaborator
|
Thanks for the fix! I pushed a few updates on top of your branch to tighten bounds handling and cover a few edge cases. Here is a summary of what changed compared with your previous commit:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
… reads
A file-backed block device floored the file size to whole 512-byte sectors, making the tail bytes inaccessible from the VM.
Sometimes it can be useful to pass unaligned files as block devices to a VM, e.g, to be able to bootstrap a VM install from a .tar.gz file on the host.
Round the capacity up to whole sectors and serve reads that legitimately cross EOF with NUL padding, on both the Mio and io_uring workers; a read that starts beyond EOF still reports IOERR.