virtio-devices: Check MSI-X vector bounds before table access - #8138
Merged
Conversation
weltling
force-pushed
the
msix-vector-oob-panic
branch
from
May 4, 2026 21:29
d0e1116 to
089c689
Compare
rbradford
reviewed
May 4, 2026
| } | ||
|
|
||
| if vector as usize >= self.msix_table_size { | ||
| warn!("MSI-X vector {vector} out of range, no notifier"); |
Member
There was a problem hiding this comment.
What does "no notifier" mean here? is it "not notifying" ?
Member
Author
There was a problem hiding this comment.
As the notifier() method returns the EventFd associated with a given MSI-X vector, when the vector is out of range there's none exists. Rephrased to "notifier unavailable" to make that clearer.
Thanks
A malicious or buggy guest can write an out-of-bounds value to queue_msix_vector or msix_config. When the device later triggers an interrupt, it indexes into table_entries with the unchecked vector, causing a panic. Validate the vector against the MSI-X table size in both trigger() and notifier() paths, logging a warning and returning early when the vector exceeds the table bounds. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
Verify that firing an interrupt with a queue vector beyond the MSI-X table size returns Ok without panicking. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
Verify that triggering an interrupt when the vector is set to VIRTQ_MSI_NO_VECTOR short-circuits and returns Ok. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
Verify that requesting a notifier with an out-of-bounds MSI-X vector returns None instead of panicking. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
Verify that a valid in bounds vector with MSI-X enabled successfully triggers the interrupt source group. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
Verify that firing a config change interrupt with msix_config vector beyond the table size returns Ok without panicking. Signed-off-by: Anatol Belski <anbelski@linux.microsoft.com>
weltling
force-pushed
the
msix-vector-oob-panic
branch
from
May 4, 2026 21:56
089c689 to
7614530
Compare
rbradford
approved these changes
May 5, 2026
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.
A malicious or buggy guest can write an out-of-bounds value to queue_msix_vector or msix_config. When the device later triggers an interrupt, it indexes into table_entries with the unchecked vector, causing a panic.
Validate the vector against the MSI-X table size in both trigger() and notifier() paths, logging a warning and returning early when the vector exceeds the table bounds.
Added also initial unit tests module and tests covering the behavior.