diff options
author | Lennart Poettering <lennart@poettering.net> | 2018-04-30 12:23:03 +0200 |
---|---|---|
committer | Sven Eden <yamakuzure@gmx.net> | 2018-06-28 09:24:07 +0200 |
commit | 66d2662419346ffc68a88899db65ce23bd0f1237 (patch) | |
tree | 946f3037762afe2b12a0adadba0934aaa963e898 /src/basic/virt.c | |
parent | f3a488f8e59dee114d4dc975c45b78d3da1fd9c6 (diff) |
virt: if we detect Xen by DMI, trust that over CPUID
Apparently Xen sometimes lies about its identity when queried via CPUID.
Let's hence prefer DMI tests for CPUID
Fixes: #8844
(cherry picked from commit f2fe2865cd19cd4318b82d01b9b62d22b1697b3a)
Diffstat (limited to 'src/basic/virt.c')
-rw-r--r-- | src/basic/virt.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/basic/virt.c b/src/basic/virt.c index aaff4ea58..9290dff3b 100644 --- a/src/basic/virt.c +++ b/src/basic/virt.c @@ -333,13 +333,16 @@ int detect_vm(void) { /* We have to use the correct order here: * - * -> First try to detect Oracle Virtualbox, even if it uses KVM. - * -> Second try to detect from cpuid, this will report KVM for - * whatever software is used even if info in dmi is overwritten. - * -> Third try to detect from dmi. */ + * → First, try to detect Oracle Virtualbox, even if it uses KVM, as well as Xen even if it cloaks as Microsoft + * Hyper-V. + * + * → Second, try to detect from CPUID, this will report KVM for whatever software is used even if info in DMI is + * overwritten. + * + * → Third, try to detect from DMI. */ dmi = detect_vm_dmi(); - if (dmi == VIRTUALIZATION_ORACLE) { + if (IN_SET(dmi, VIRTUALIZATION_ORACLE, VIRTUALIZATION_XEN)) { r = dmi; goto finish; } |