From a53e5e0e2f574f9943f09a5de0a510620b22798d Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 29 Jun 2022 06:17:44 +0900 Subject: [PATCH] virt: fix detection of Parallels virtualization If Parallels virtualization is detected from DMI, then trust that over CPUID. Fixes issue caused by 28b1a3eac252d471de4fbb6f317353af30d68878. Fixes #23856. (cherry picked from commit 840a49f3dcee9a5243f9a31ede2edaa0a3b89e26) (cherry picked from commit 0c36233a84c0f6c9b46523390960e60a9adae37c) --- src/basic/virt.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/basic/virt.c b/src/basic/virt.c index 284ad95277..f6063e9859 100644 --- a/src/basic/virt.c +++ b/src/basic/virt.c @@ -432,18 +432,22 @@ int detect_vm(void) { /* We have to use the correct order here: * - * → First, try to detect Oracle Virtualbox and Amazon EC2 Nitro, even if they use KVM, as well as Xen even if - * it cloaks as Microsoft Hyper-V. Attempt to detect uml at this stage also since it runs as a user-process - * nested inside other VMs. Also check for Xen now, because Xen PV mode does not override CPUID when nested - * inside another hypervisor. + * → First, try to detect Oracle Virtualbox, Amazon EC2 Nitro, and Parallels, even if they use KVM, + * as well as Xen even if it cloaks as Microsoft Hyper-V. Attempt to detect uml at this stage also + * since it runs as a user-process nested inside other VMs. Also check for Xen now, because Xen PV + * mode does not override CPUID when nested inside another hypervisor. * - * → Second, try to detect from CPUID, this will report KVM for whatever software is used even if info in DMI is - * overwritten. + * → 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 (IN_SET(dmi, VIRTUALIZATION_ORACLE, VIRTUALIZATION_XEN, VIRTUALIZATION_AMAZON)) { + if (IN_SET(dmi, + VIRTUALIZATION_ORACLE, + VIRTUALIZATION_XEN, + VIRTUALIZATION_AMAZON, + VIRTUALIZATION_PARALLELS)) { r = dmi; goto finish; }