[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-commits] [qemu/qemu] 3ec5ad: target/i386: kvm: do not access unini
From: |
Peter Maydell |
Subject: |
[Qemu-commits] [qemu/qemu] 3ec5ad: target/i386: kvm: do not access uninitialized vari... |
Date: |
Tue, 22 Mar 2022 03:17:59 -0700 |
Branch: refs/heads/master
Home: https://github.com/qemu/qemu
Commit: 3ec5ad40081b14af28496198b4d08dbe13386790
https://github.com/qemu/qemu/commit/3ec5ad40081b14af28496198b4d08dbe13386790
Author: Paolo Bonzini <pbonzini@redhat.com>
Date: 2022-03-20 (Sun, 20 Mar 2022)
Changed paths:
M target/i386/kvm/kvm.c
Log Message:
-----------
target/i386: kvm: do not access uninitialized variable on older kernels
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>
Commit: 17e6ffa6a5d2674cb2ebfd967d28b1048261d977
https://github.com/qemu/qemu/commit/17e6ffa6a5d2674cb2ebfd967d28b1048261d977
Author: Paolo Bonzini <pbonzini@redhat.com>
Date: 2022-03-21 (Mon, 21 Mar 2022)
Changed paths:
M hw/i386/amd_iommu.c
Log Message:
-----------
hw/i386/amd_iommu: Fix maybe-uninitialized error with GCC 12
Be more explicit that the loop must roll at least once. Avoids the
following warning:
FAILED: libqemu-x86_64-softmmu.fa.p/hw_i386_amd_iommu.c.o
In function 'pte_get_page_mask',
inlined from 'amdvi_page_walk' at hw/i386/amd_iommu.c:945:25,
inlined from 'amdvi_do_translate' at hw/i386/amd_iommu.c:989:5,
inlined from 'amdvi_translate' at hw/i386/amd_iommu.c:1038:5:
hw/i386/amd_iommu.c:877:38: error: 'oldlevel' may be used uninitialized
[-Werror=maybe-uninitialized]
877 | return ~((1UL << ((oldlevel * 9) + 3)) - 1);
| ~~~~~~~~~~~~~~~~^~~~
hw/i386/amd_iommu.c: In function 'amdvi_translate':
hw/i386/amd_iommu.c:906:41: note: 'oldlevel' was declared here
906 | unsigned level, present, pte_perms, oldlevel;
| ^~~~~~~~
cc1: all warnings being treated as errors
Having:
$ gcc --version
gcc (Debian 12-20220313-1) 12.0.1 20220314 (experimental)
Reported-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Commit: 48fb0a826eea2e7b0135f49e7fa63e7efe2b7677
https://github.com/qemu/qemu/commit/48fb0a826eea2e7b0135f49e7fa63e7efe2b7677
Author: Peter Maydell <peter.maydell@linaro.org>
Date: 2022-03-21 (Mon, 21 Mar 2022)
Changed paths:
M hw/i386/amd_iommu.c
M target/i386/kvm/kvm.c
Log Message:
-----------
Merge tag 'for-upstream' of https://gitlab.com/bonzini/qemu into staging
Bugfixes.
# gpg: Signature made Mon 21 Mar 2022 14:57:57 GMT
# gpg: using RSA key F13338574B662389866C7682BFFBD25F78C7AE83
# gpg: issuer "pbonzini@redhat.com"
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>" [full]
# gpg: aka "Paolo Bonzini <pbonzini@redhat.com>" [full]
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4 E2F7 7E15 100C CD36 69B1
# Subkey fingerprint: F133 3857 4B66 2389 866C 7682 BFFB D25F 78C7 AE83
* tag 'for-upstream' of https://gitlab.com/bonzini/qemu:
hw/i386/amd_iommu: Fix maybe-uninitialized error with GCC 12
target/i386: kvm: do not access uninitialized variable on older kernels
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Compare: https://github.com/qemu/qemu/compare/330724977b10...48fb0a826eea