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

hv: instr_emul: Correct handling of instruction length #8757

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jiaqingz-intel
Copy link
Contributor

The VM-exit instruction length(VMX_EXIT_INSTR_LEN) in VMCS is undefined on EPT violation, except during delivery of a software interrupt, privileged software exception, or software exception[1]. Although CPU is likely to set the field, it can be incorrect in certain cases, such as cmp+jcc and test+jcc.

Since hypervisor does not know exactly how much bytes needed, and GVA translation is costly, it first copies at most 15 (VIE_INST_SIZE) bytes within the page, then decodes the instruction. If more bytes are needed during decoding and copied length is less than 15, it copies remaining bytes.

[1] 29.2.5, https://cdrdv2-public.intel.com/671200/325462-sdm-vol-1-2abcd-3abcd.pdf

Tracked-On: #8756

The VM-exit instruction length(VMX_EXIT_INSTR_LEN) in VMCS is undefined
on EPT violation, except during delivery of a software interrupt,
privileged software exception, or software exception[1]. Although CPU
is likely to set the field, it can be incorrect in certain cases, such
as cmp+jcc and test+jcc.

Since hypervisor does not know exactly how much bytes needed, and GVA
translation is costly, it first copies at most 15 (VIE_INST_SIZE) bytes
within the page, then decodes the instruction. If more bytes are needed
during decoding and copied length is less than 15, it copies remaining
bytes.

[1] 29.2.5, https://cdrdv2-public.intel.com/671200/325462-sdm-vol-1-2abcd-3abcd.pdf

Tracked-On: projectacrn#8756
Signed-off-by: Jiaqing Zhao <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants