void kvm_vcpu_after_set_cpuid(struct kvm_vcpu *vcpu); struct kvm_cpuid_entry2 *kvm_find_cpuid_entry2(struct kvm_cpuid_entry2 *entries, int nent, u32 function, u64 index); /* * Magic value used by KVM when querying userspace-provided CPUID entries and * doesn't care about the CPIUD index because the index of the function in * question is not significant. Note, this magic value must have at least one * bit set in bits[63:32] and must be consumed as a u64 by kvm_find_cpuid_entry2() * to avoid false positives when processing guest CPUID input. * * KVM_CPUID_INDEX_NOT_SIGNIFICANT should never be used directly outside of * kvm_find_cpuid_entry2() and kvm_find_cpuid_entry().
*/ #define KVM_CPUID_INDEX_NOT_SIGNIFICANT -1ull
/* * XSAVES is a special snowflake. Due to lack of a dedicated intercept * on SVM, KVM must assume that XSAVES (and thus XRSTORS) is usable by * the guest if the host supports XSAVES and *XSAVE* is exposed to the * guest. Because the guest can execute XSAVES and XRSTORS, i.e. can * indirectly consume XSS, KVM must ensure XSS is zeroed when running * the guest, i.e. must set XSAVES in vCPU capabilities. But to reject * direct XSS reads and writes (to minimize the virtualization hole and * honor userspace's CPUID), KVM needs to check the raw guest CPUID, * not KVM's view of guest capabilities. * * For all other features, guest capabilities are accurate. Expand * this allowlist with extreme vigilance.
*/
BUILD_BUG_ON(x86_feature != X86_FEATURE_XSAVES);
entry = kvm_find_cpuid_entry_index(vcpu, cpuid.function, cpuid.index); if (!entry) return NULL;
reg = __cpuid_entry_get_reg(entry, cpuid.reg); if (!reg) returnfalse;
/* * Except for MWAIT, querying dynamic feature bits is disallowed, so * that KVM can defer runtime updates until the next CPUID emulation.
*/
BUILD_BUG_ON(x86_feature == X86_FEATURE_APIC ||
x86_feature == X86_FEATURE_OSXSAVE ||
x86_feature == X86_FEATURE_OSPKE);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.