qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] target/i386: kvm: do not access uninitialized variable on


From: Peter Krempa
Subject: Re: [PATCH v2] target/i386: kvm: do not access uninitialized variable on older kernels
Date: Mon, 21 Mar 2022 09:21:55 +0100
User-agent: Mutt/2.1.5 (2021-12-30)

On Sun, Mar 20, 2022 at 20:39:14 +0100, Paolo Bonzini wrote:
> KVM support for AMX includes a new system attribute, KVM_X86_XCOMP_GUEST_SUPP.
> Commit 19db68ca68 ("x86: Grant AMX permission for guest", 2022-03-15) however
> did not fully consider the behavior on older kernels.  First, it warns
> too aggressively.  Second, it invokes the KVM_GET_DEVICE_ATTR ioctl
> unconditionally and then uses the "bitmask" variable, which remains
> uninitialized if the ioctl fails.  Third, kvm_ioctl returns -errno rather
> than -1 on errors.
> 
> While at it, explain why the ioctl is needed and KVM_GET_SUPPORTED_CPUID
> is not enough.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>         v1->v2: for error condition for kvm_ioctl [Volker]
>  target/i386/kvm/kvm.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)

Based on the commit message it seems that this is only for the problem
that Michal reported, right?

Because it doesn't still fix the assertion failure on my AMD box:

$  ./build/qemu-system-x86_64 -accel kvm
qemu-system-x86_64: ../target/i386/kvm/kvm-cpu.c:105: kvm_cpu_xsave_init: 
Assertion `esa->size == eax' failed.
Aborted (core dumped)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]