From abffa868a834d12952d86bf1e554d61ecad47db6 Mon Sep 17 00:00:00 2001 From: zhaoshuang Date: Tue, 11 Aug 2026 11:00:55 +0800 Subject: [PATCH] virt: detect Alibaba Cloud ECS as KVM MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Alibaba Cloud ECS instances expose "Alibaba Cloud ECS" in DMI product_name/bios_vendor and "Alibaba Cloud" in sys_vendor. None of these match dmi_vendor_table[], so systemd-detect-virt --vm reports "none" on these machines, even though they run on a KVM-based hypervisor. This is especially visible on ARM64 instances, where the CPUID fallback does not exist (x86 only) and /proc/device-tree is not populated. Add "Alibaba Cloud ECS" to dmi_vendor_table[], mapping to VIRTUALIZATION_KVM. The narrower prefix avoids matching the bare "Alibaba Cloud" sys_vendor value, reducing the false-positive surface for Alibaba's bare-metal (X-Dragon) instances compared to the original broader prefix. bios_vendor also carries the same string on ECS VMs though, so the protection is not complete — fully resolving the VM-vs-bare-metal ambiguity would need the SMBIOS BIOS-Characteristics bit check that the Amazon EC2 entry uses. The existing "back to DMI" fallback path in detect_vm() reports "kvm" on both x86 and ARM64. --- src/basic/virt.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/basic/virt.c b/src/basic/virt.c index aa3f4f2b58..6ccb015e52 100644 --- a/src/basic/virt.c +++ b/src/basic/virt.c @@ -180,6 +180,7 @@ static Virtualization detect_vm_dmi_vendor(void) { { "KVM", VIRTUALIZATION_KVM }, { "OpenStack", VIRTUALIZATION_KVM }, /* Detect OpenStack instance as KVM in non x86 architecture */ { "KubeVirt", VIRTUALIZATION_KVM }, /* Detect KubeVirt instance as KVM in non x86 architecture */ + { "Alibaba Cloud ECS", VIRTUALIZATION_KVM }, /* narrower than bare "Alibaba Cloud" sys_vendor */ { "Amazon EC2", VIRTUALIZATION_AMAZON }, { "QEMU", VIRTUALIZATION_QEMU }, { "VMware", VIRTUALIZATION_VMWARE }, /* https://kb.vmware.com/s/article/1009458 */