]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
virt: fix detection of Parallels virtualization
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 28 Jun 2022 21:17:44 +0000 (06:17 +0900)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 29 Jun 2022 12:03:54 +0000 (14:03 +0200)
If Parallels virtualization is detected from DMI, then trust that over CPUID.

Fixes issue caused by 28b1a3eac252d471de4fbb6f317353af30d68878.

Fixes #23856.

src/basic/virt.c

index c7ae2afc0069f5982fa6b697754612c21519f6a1..5cc1011ae8eea90e6f1adc8703a6d59301ea8e86 100644 (file)
@@ -436,18 +436,22 @@ Virtualization 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)) {
                 v = dmi;
                 goto finish;
         }