Lines Matching +full:fault +full:- +full:inject

1 // SPDX-License-Identifier: GPL-2.0
27 bool fault; in sgx_get_encls_gva() local
29 /* Skip vmcs.GUEST_DS retrieval for 64-bit mode to avoid VMREADs. */ in sgx_get_encls_gva()
37 fault = true; in sgx_get_encls_gva()
40 fault = is_noncanonical_address(*gva, vcpu, 0); in sgx_get_encls_gva()
43 fault = (s.unusable) || in sgx_get_encls_gva()
47 (((u64)*gva + size - 1) > s.limit + 1)); in sgx_get_encls_gva()
49 if (fault) in sgx_get_encls_gva()
51 return fault ? -EINVAL : 0; in sgx_get_encls_gva()
67 return -EFAULT; in sgx_read_hva()
85 return -EFAULT; in sgx_gva_to_gpa()
96 return -EFAULT; in sgx_gpa_to_hva()
109 * A non-EPCM #PF indicates a bad userspace HVA. This *should* check in sgx_inject_fault()
119 * If the guest thinks it's running on SGX2 hardware, inject an SGX in sgx_inject_fault()
120 * #PF if the fault matches an EPCM fault signature (#GP on SGX1, in sgx_inject_fault()
145 struct sgx_secs *contents = (struct sgx_secs *)pageinfo->contents; in __handle_encls_ecreate()
159 miscselect = contents->miscselect; in __handle_encls_ecreate()
160 attributes = contents->attributes; in __handle_encls_ecreate()
161 xfrm = contents->xfrm; in __handle_encls_ecreate()
162 size = contents->size; in __handle_encls_ecreate()
165 if (!vcpu->kvm->arch.sgx_provisioning_allowed && in __handle_encls_ecreate()
167 if (sgx_12_1->eax & SGX_ATTR_PROVISIONKEY) in __handle_encls_ecreate()
179 if ((u32)miscselect & ~sgx_12_0->ebx || in __handle_encls_ecreate()
180 (u32)attributes & ~sgx_12_1->eax || in __handle_encls_ecreate()
181 (u32)(attributes >> 32) & ~sgx_12_1->ebx || in __handle_encls_ecreate()
182 (u32)xfrm & ~sgx_12_1->ecx || in __handle_encls_ecreate()
183 (u32)(xfrm >> 32) & ~sgx_12_1->edx || in __handle_encls_ecreate()
184 xfrm & ~(vcpu->arch.guest_supported_xcr0 | XFEATURE_MASK_FPSSE) || in __handle_encls_ecreate()
191 max_size_log2 = (attributes & SGX_ATTR_MODE64BIT) ? sgx_12_0->edx >> 8 : in __handle_encls_ecreate()
192 sgx_12_0->edx; in __handle_encls_ecreate()
201 * 2) -EFAULT: ECREATE was run but faulted, and trapnr was set to the in __handle_encls_ecreate()
203 * 3) -EINVAL: access_ok() on @secs_hva failed. This should never in __handle_encls_ecreate()
210 if (ret == -EFAULT) in __handle_encls_ecreate()
253 * Resume the guest on failure to inject a #PF. in handle_encls_ecreate()
278 return -ENOMEM; in handle_encls_ecreate()
311 * Resume the guest on failure to inject a #PF. in handle_encls_einit()
331 vmx->msr_ia32_sgxlepubkeyhash, &trapnr); in handle_encls_einit()
333 if (ret == -EFAULT) in handle_encls_einit()
337 * sgx_virt_einit() returns -EINVAL when access_ok() fails on @sig_hva, in handle_encls_einit()
377 return (to_vmx(vcpu)->msr_ia32_feature_control & bits) == bits; in sgx_enabled_in_guest_bios()
396 vcpu->run->exit_reason = KVM_EXIT_UNKNOWN; in handle_encls()
397 vcpu->run->hw.hardware_exit_reason = EXIT_REASON_ENCLS; in handle_encls()
411 * MSRs exist but are read-only (locked and not writable). in setup_default_sgx_lepubkeyhash()
431 memcpy(vmx->msr_ia32_sgxlepubkeyhash, sgx_pubkey_hash, in vcpu_setup_sgx_lepubkeyhash()
437 * restrictions if the guest's allowed-1 settings diverge from hardware.
444 if (!vcpu->kvm->arch.sgx_provisioning_allowed) in sgx_intercept_encls_ecreate()
452 if (guest_cpuid->ebx != ebx || guest_cpuid->edx != edx) in sgx_intercept_encls_ecreate()
460 if (guest_cpuid->eax != eax || guest_cpuid->ebx != ebx || in sgx_intercept_encls_ecreate()
461 guest_cpuid->ecx != ecx || guest_cpuid->edx != edx) in sgx_intercept_encls_ecreate()
473 * host, trap all ENCLS leafs and inject #UD/#GP as needed to emulate in vmx_write_encls_bitmap()
476 u64 bitmap = -1ull; in vmx_write_encls_bitmap()
497 * The MSRs are not loaded/saved on VM-Enter/VM-Exit as writing in vmx_write_encls_bitmap()
506 bitmap |= vmcs12->encls_exiting_bitmap; in vmx_write_encls_bitmap()