Skip to content

validate number of indirect desc in pop_avail - #1188

Merged
papertigers merged 4 commits into
spr/papertigers/master.validate-number-of-indirect-desc-in-pop_availfrom
spr/papertigers/validate-number-of-indirect-desc-in-pop_avail
Aug 12, 2026
Merged

validate number of indirect desc in pop_avail#1188
papertigers merged 4 commits into
spr/papertigers/master.validate-number-of-indirect-desc-in-pop_availfrom
spr/papertigers/validate-number-of-indirect-desc-in-pop_avail

Conversation

@papertigers

@papertigers papertigers commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

The pop_avail function now validates that the number of indirect descriptors is not larger than the size of the virtio queue.

Stack:

@papertigers
papertigers changed the base branch from spr/papertigers/master.validate-number-of-indirect-desc-in-pop_avail to spr/papertigers/bump-rust-to-1971 July 29, 2026 00:28
@papertigers
papertigers changed the base branch from spr/papertigers/bump-rust-to-1971 to spr/papertigers/master.validate-number-of-indirect-desc-in-pop_avail July 29, 2026 00:32
Comment thread lib/propolis/src/hw/virtio/queue.rs Outdated

if flags.contains(DescFlag::NEXT) {
if count == self.size() {
// XXX: signal error condition?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to address #1190 to properly solve this.
Currently return None and we also fail to return the descriptor to the used ring, this can leave the queue stalled or in an overall bad state.

@papertigers papertigers mentioned this pull request Jul 29, 2026
@papertigers
papertigers requested a review from iximeow August 3, 2026 18:39

@iximeow iximeow left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small thought on the comment but it probably applies to all the XXX: signal error condition? in here anyway. thanks for the improvement 🙏

Comment thread lib/propolis/src/hw/virtio/queue.rs Outdated

if flags.contains(DescFlag::NEXT) {
if count == self.size() {
// XXX: signal error condition?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in particular we can gate this on if count >= self.size() { .. } because VirtIO says

A driver MUST NOT create a descriptor chain longer than the Queue Size of the device

and it's probably useful to future readers to know this is a "driver MUST NOT" when actually signalling an error (rather than a "we'd really rather you not" like "the table shouldn't be gargantuan either please" - i don't see VirtIO describing a max size of the dscriptor table, just the length of the chainthrough it...)

@papertigers papertigers Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the updated language here, if it looks good we can probably merge this

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, seems fair!

@papertigers
papertigers merged commit d5dc507 into spr/papertigers/master.validate-number-of-indirect-desc-in-pop_avail Aug 12, 2026
8 checks passed
@papertigers
papertigers deleted the spr/papertigers/validate-number-of-indirect-desc-in-pop_avail branch August 12, 2026 17:05
@papertigers
papertigers restored the spr/papertigers/validate-number-of-indirect-desc-in-pop_avail branch August 12, 2026 17:06
@papertigers

Copy link
Copy Markdown
Contributor Author

I am an idiot and I merged this into the wrong branch so the real commit will come in via #1196

@papertigers
papertigers deleted the spr/papertigers/validate-number-of-indirect-desc-in-pop_avail branch August 12, 2026 17:38
Sign up for free to 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