basic: detect_vm_cpuid: fix hypervisor detection
authorMike Gilbert <floppym@gentoo.org>
Sat, 30 Dec 2017 17:48:20 +0000 (12:48 -0500)
committerLennart Poettering <lennart@poettering.net>
Tue, 2 Jan 2018 11:12:57 +0000 (12:12 +0100)
commit8481e3e71e704a10af0b6d53d4b015b2b8e1e16b
treece552ddf3621a302dd252dca15b97ce71ca8cad8
parentad552e587f21bf00013d41d48737009a20be6479
basic: detect_vm_cpuid: fix hypervisor detection

The __get_cpuid() function only calls __cpuid() if __get_cpuid_max()
returns a value that is less than or equal to the leaf value.

In QEMU/KVM, I found that the special hypervisor leaf value (0x40000000U)
is always larger than the value retured by __get_cpuid_max().

Avoid this problem by calling the __cpuid() macro directly once we have
checked the hypervisor bit from leaf 1.

Fixes: d31b0033b7743393562a2e9d3c1e74afea981c13
src/basic/virt.c