Skip to content

validate vGPU capability record lengths - #1994

Open
kvalliyurnatt wants to merge 1 commit into
NVIDIA:mainfrom
kvalliyurnatt:vgpu_capability_parse
Open

validate vGPU capability record lengths#1994
kvalliyurnatt wants to merge 1 commit into
NVIDIA:mainfrom
kvalliyurnatt:vgpu_capability_parse

Conversation

@kvalliyurnatt

Copy link
Copy Markdown

Summary

Fixes vGPU capability parsing so malformed PCI records cannot cause GPU Feature Discovery to hang or read outside the capability buffer.

Details

A nonterminal vGPU capability record with a zero-length field caused Device.GetInfo() to repeatedly process the same record, resulting in an infinite loop and 100% CPU usage.

This change:

Uses an int cursor to prevent uint8 wraparound.
Requires nonterminal records to include at least their two-byte header.
Validates record boundaries before reading or advancing.
Validates the host-driver record and payload length.
Adds tests for zero-length, truncated, undersized, oversized, and valid records.

Signed-off-by: Karthikeyan Valliyurnatt <kvalliyurnat@nvidia.com>
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.

1 participant