Repository navigation
virt_mshv_vtl: fix TDX legacy LGDT/LIDT descriptor decode panic - #5238
Open
Sunil Muthuswamy (sunilmut) wants to merge 1 commit into
Open
Sunil Muthuswamy (sunilmut) wants to merge 1 commit into
Sunil Muthuswamy (sunilmut) wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block approval of the legacy descriptor-decoding fix.
No open issues 🎉
What changed in this PR
Fixes a panic in OpenHCL’s TDX emulation of legacy LGDT/LIDT instructions while preserving long-mode descriptor decoding.
Changes:
- Extracts descriptor decoding into a helper that zero-extends legacy 32-bit bases and preserves full 64-bit bases.
- Adds regression tests for both descriptor formats and the tracing-enabled test dependency.
| File | Description |
|---|---|
openhcl/virt_mshv_vtl/src/processor/tdx/mod.rs |
Adds the decoding helper, integrates it into descriptor loads, and tests both formats. |
openhcl/virt_mshv_vtl/Cargo.toml |
Adds test_with_tracing as a development dependency. |
Cargo.lock |
Records the new test dependency for virt_mshv_vtl. |
Review effort: Balanced
Legacy-mode LGDT/LIDT descriptors carry a 4-byte base, but the decoder always converted the base bytes to a u64, panicking on valid input. Zero-extend the legacy 32-bit base and validate the descriptor length. Test changes: - Verify a legacy 6-byte descriptor decodes without panicking. - Verify a long-mode 10-byte descriptor keeps its full 64-bit base.
Sunil Muthuswamy (sunilmut)
force-pushed
the
user/sunilmut/tdx-legacy-descriptor-repro
branch
from
November 26, 2026 22:36
987e160 to
af793ce
Compare
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.
For LGDT/LIDT outside long mode, TDX descriptor-table emulation correctly
reads a 6-byte operand (2-byte limit, 4-byte base), but then converted the
4 base bytes with
u64::from_le_bytes(buf[2..len].try_into().unwrap()),which always panics for a valid legacy operand.
This change moves the decode into
decode_table_register, which accepts only6- or 10-byte descriptors and zero-extends the little-endian base into a
64-bit value. The decoding no longer contains any fallible conversions.
Test changes:
before the fix).