Repository navigation
Conversation
…rting Allow driver writes (including byte/word sub-field accesses) to both writable virtio-balloon configuration fields (`actual` and `poison_val`) while continuing to reject writes to read-only or out-of-bounds offsets. Track negotiated `BalloonFeature` flags in `Balloon::activate` (and clear `driver_feature`, `actual`, and `poison_val` in `Balloon::reset`). Per Virtio v1.4 Sec 5.5.6.6, when `VIRTIO_BALLOON_F_PAGE_POISON` is negotiated, the device must not modify reported free pages to a value other than `poison_val`. Skip `madvise(MADV_DONTNEED)` in `free_reporting` when `PAGE_POISON` is negotiated with a non-zero `poison_val`, while continuing to reclaim pages when `PAGE_POISON` is not negotiated or `poison_val == 0`. Signed-off-by: Changyuan Lyu <changyuanl@google.com>
Coverage Report for CI Build 42955367146Coverage increased (+0.9%) to 44.524%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats💛 - Coveralls |
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.
Summary
BalloonConfig::poison_valas well asBalloonConfig::actual, while continuing to reject writes to read-only fields (num_pages,free_page_hint_cmd_id), cross-field boundaries, invalid access widths, and out-of-bounds offsets.BalloonFeaturebits onBalloonduringVirtioMio::activate, and cleardriver_feature,actual, andpoison_valonVirtioMio::reset.VIRTIO_BALLOON_F_PAGE_POISONis negotiated: skipmadvise(..., MADV_DONTNEED)whenpoison_val != 0so reported free pages are not overwritten with zeroes, while continuing to reclaim reported pages whenPAGE_POISONis not negotiated orpoison_val == 0.alioth/src/virtio/dev/balloon_test.rscoveringBalloonConfigMmioread/write validation,free_reportingunder allPAGE_POISON/poison_valcombinations, and devicereset+ re-activation on both 4 KiB and 16 KiB page hosts.Verification
cargo +nightly fmt --checkcargo test -p alioth virtio::dev::ballooncargo clippy --all-targets -- -D warningscargo clippy --all-targets --target x86_64-unknown-linux-gnu -- -D warnings