Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes in VM Entry Checks for Guest Segment Registers #51

Closed
wants to merge 1 commit into from

Conversation

rei141
Copy link

@rei141 rei141 commented May 22, 2023

This pull request includes two critical fixes in the VM entry checks related to the segment registers, ensuring better conformity with the Intel Software Developer's Manual.

  1. Correction in checks for Code Segment (CS):
    Previously, the DPL of CS was incorrectly compared with its own RPL.
    According to Intel SDM, Vol. 3C, Chapter 27.3.1.2, for non-conforming code segments (type 9 or 11), the DPL of CS should be equal to the DPL of SS.
    And for conforming code segments (type 13 or 15), the DPL of CS cannot be greater than the DPL of SS.

  2. Correction in Type range checks for DS, ES, FS, GS:
    The original code erroneously applied the check for types less than 11, excluding types equal to 11.
    This is not in accordance with Intel SDM, Vol. 3C, Chapter 27.3.1.2, which states that the check should include types equal to or less than 11.
    This fix corrects this by including types equal to or less than 11 in the check.

stlintel pushed a commit that referenced this pull request Aug 20, 2023
Fixes in VM Entry Checks for Guest Segment Registers #51

Correction in Type range checks for DS, ES, FS, GS:
The original code erroneously applied the check for types less than 11, excluding types equal to 11.
This is not in accordance with Intel SDM, Vol. 3C, Chapter 27.3.1.2, which states that the check should include types equal to or less than 11.
This fix corrects this by including types equal to or less than 11 in the check.
@stlintel
Copy link
Contributor

part 2 merged to main, verifying part 1

stlintel pushed a commit that referenced this pull request Aug 20, 2023
from Fixes in VM Entry Checks for Guest Segment Registers #51

Correction in checks for Code Segment (CS):
Previously, the DPL of CS was incorrectly compared with its own RPL.
According to Intel SDM, Vol. 3C, Chapter 27.3.1.2, for non-conforming code segments (type 9 or 11), the DPL of CS should be equal to the DPL of SS.
And for conforming code segments (type 13 or 15), the DPL of CS cannot be greater than the DPL of SS.

This way VMCS is not accessed multiple times which is important for some usages
@stlintel
Copy link
Contributor

Merged into main with slightly different implementation.
Thanks !

@stlintel stlintel closed this Aug 20, 2023
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