mirror of
https://github.com/torvalds/linux.git
synced 2026-05-31 18:43:33 +02:00
KVM: VMX: Use is_64_bit_mode() to check 64-bit mode in SGX handler
sgx_get_encls_gva() uses is_long_mode() to check 64-bit mode, however,
SGX system leaf instructions are valid in compatibility mode, should
use is_64_bit_mode() instead.
Fixes: 70210c044b ("KVM: VMX: Add SGX ENCLS[ECREATE] handler to enforce CPUID restrictions")
Signed-off-by: Binbin Wu <binbin.wu@linux.intel.com>
Reviewed-by: Kai Huang <kai.huang@intel.com>
Link: https://lore.kernel.org/r/20230404032502.27798-1-binbin.wu@linux.intel.com
Signed-off-by: Sean Christopherson <seanjc@google.com>
This commit is contained in:
parent
f6cde92083
commit
548bd27428
|
|
@ -29,14 +29,14 @@ static int sgx_get_encls_gva(struct kvm_vcpu *vcpu, unsigned long offset,
|
|||
|
||||
/* Skip vmcs.GUEST_DS retrieval for 64-bit mode to avoid VMREADs. */
|
||||
*gva = offset;
|
||||
if (!is_long_mode(vcpu)) {
|
||||
if (!is_64_bit_mode(vcpu)) {
|
||||
vmx_get_segment(vcpu, &s, VCPU_SREG_DS);
|
||||
*gva += s.base;
|
||||
}
|
||||
|
||||
if (!IS_ALIGNED(*gva, alignment)) {
|
||||
fault = true;
|
||||
} else if (likely(is_long_mode(vcpu))) {
|
||||
} else if (likely(is_64_bit_mode(vcpu))) {
|
||||
fault = is_noncanonical_address(*gva, vcpu);
|
||||
} else {
|
||||
*gva &= 0xffffffff;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user