58f7db26f2
Some AMD processors expose the PKRU extended save state even if they do not have the related PKU feature in CPUID. Worse, when they do they report a size of 64, whereas the expected size of the PKRU extended save state is 8, therefore the esa->size == eax assertion does not hold. The state is already ignored by KVM_GET_SUPPORTED_CPUID because it was not enabled in the host XCR0. However, QEMU kvm_cpu_xsave_init() runs before QEMU invokes arch_prctl() to enable dynamically-enabled save states such as XTILEDATA, and KVM_GET_SUPPORTED_CPUID hides save states that have yet to be enabled. Therefore, kvm_cpu_xsave_init() needs to consult the host CPUID instead of KVM_GET_SUPPORTED_CPUID, and dies with an assertion failure. When setting up the ExtSaveArea array to match the host, ignore features that KVM does not report as supported. This will cause QEMU to skip the incorrect CPUID leaf instead of tripping the assertion. Closes: https://gitlab.com/qemu-project/qemu/-/issues/916 Reported-by: Daniel P. Berrangé <berrange@redhat.com> Analyzed-by: Yang Zhong <yang.zhong@intel.com> Reported-by: Peter Krempa <pkrempa@redhat.com> Tested-by: Daniel P. Berrangé <berrange@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> |
||
---|---|---|
.. | ||
hax | ||
hvf | ||
kvm | ||
nvmm | ||
tcg | ||
whpx | ||
arch_dump.c | ||
arch_memory_mapping.c | ||
cpu-dump.c | ||
cpu-internal.h | ||
cpu-param.h | ||
cpu-qom.h | ||
cpu-sysemu.c | ||
cpu.c | ||
cpu.h | ||
gdbstub.c | ||
helper.c | ||
helper.h | ||
host-cpu.c | ||
host-cpu.h | ||
Kconfig | ||
machine.c | ||
meson.build | ||
monitor.c | ||
ops_sse_header.h | ||
ops_sse.h | ||
sev-sysemu-stub.c | ||
sev.c | ||
sev.h | ||
shift_helper_template.h | ||
svm.h | ||
trace-events | ||
trace.h | ||
xsave_helper.c |