Skip to content

fix(virtio): route invalid queue_sel in queue_notify_off to a reserved slot - #483

Merged
Lencerf merged 1 commit into
google:mainfrom
Lencerf:fix/virtio/oob-notify
Aug 26, 2026
Merged

fix(virtio): route invalid queue_sel in queue_notify_off to a reserved slot#483
Lencerf merged 1 commit into
google:mainfrom
Lencerf:fix/virtio/oob-notify

Conversation

@Lencerf

Copy link
Copy Markdown
Collaborator

When a driver selects an out-of-bounds queue index (queue_sel >= num_queues) and reads LAYOUT_QUEUE_NOTIFY_OFF, returning queue_sel as-is causes the driver to calculate a notify address past the mapped BAR memory, resulting in an undefined behavior.

Allocate an additional 4-byte slot at the end of the notify capability and MMIO region, and return min(queue_sel, num_queues) for LAYOUT_QUEUE_NOTIFY_OFF. This routes invalid queue notifications to the reserved slot, which is safely ignored by the MMIO handler without accessing unmapped memory or falsely triggering valid queues.

…d slot
When a driver selects an out-of-bounds queue index (queue_sel >=
num_queues) and reads LAYOUT_QUEUE_NOTIFY_OFF, returning queue_sel as-is
causes the driver to calculate a notify address past the mapped BAR
memory, resulting in an undefined behavior.
Allocate an additional 4-byte slot at the end of the notify capability
and MMIO region, and return min(queue_sel, num_queues) for
LAYOUT_QUEUE_NOTIFY_OFF. This routes invalid queue notifications to the
reserved slot, which is safely ignored by the MMIO handler without
accessing unmapped memory or falsely triggering valid queues.
Signed-off-by: Changyuan Lyu <changyuanl@google.com>
@Lencerf
Lencerfforce-pushed the fix/virtio/oob-notify branch from d5fb74f to da8a354CompareAugust 26, 2026 08:25
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 32947717444

Coverage increased (+0.2%) to 28.142%

Details

  • Coverage increased (+0.2%) from the base build.
  • Patch coverage: 6 uncovered changes across 1 file (2 of 8 lines covered, 25.0%).
  • 4 coverage regressions across 2 files.

Uncovered Changes

FileChangedCovered%
alioth/src/virtio/pci.rs8225.0%

Coverage Regressions

4 previously-covered lines in 2 files lost coverage.

FileLines Losing CoverageCoverage
alioth/src/virtio/dev/vsock/uds_vsock.rs283.13%
alioth/src/virtio/pci.rs215.86%

Coverage Stats

Coverage Status
Relevant Lines:14826
Covered Lines:4047
Line Coverage:27.3%
Relevant Branches:1342
Covered Branches:503
Branch Coverage:37.48%
Branches in Coverage %:Yes
Coverage Strength:39.86 hits per line

💛 - Coveralls

@Lencerf
Lencerf merged commit da8a354 into google:mainAug 26, 2026
12 checks passed
@Lencerf
Lencerf deleted the fix/virtio/oob-notify branch August 26, 2026 08:32
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@Lencerf@coveralls