Enable virt-what to detect WSL2
resolves: RHEL-89794
This commit is contained in:
parent
37f0a34704
commit
874c656a82
@ -1,97 +0,0 @@
|
||||
From 059cbff66740ef74cd663f88c5f96a80a8d6d6ea Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Tue, 30 Jul 2024 10:46:46 +0100
|
||||
Subject: [PATCH] Fix CVM detection on Azure with TDX
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The current TDX support was tested on Azure, however, since that time
|
||||
they now block the CPUID leaf we were using. Instead it is required to
|
||||
issue the Azure specific CPUID calls as we were already doing for SNP.
|
||||
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
---
|
||||
virt-what-cvm.c | 14 +++++++++-----
|
||||
virt-what-cvm.pod | 4 ++--
|
||||
2 files changed, 11 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/virt-what-cvm.c b/virt-what-cvm.c
|
||||
index 52b3426bc..0daa6ac35 100644
|
||||
--- a/virt-what-cvm.c
|
||||
+++ b/virt-what-cvm.c
|
||||
@@ -92,6 +92,7 @@ static bool dodebug = false;
|
||||
|
||||
#define CPUID_HYPERV_ISOLATION_TYPE_MASK 0xf
|
||||
#define CPUID_HYPERV_ISOLATION_TYPE_SNP 2
|
||||
+#define CPUID_HYPERV_ISOLATION_TYPE_TDX 3
|
||||
|
||||
#if defined(__x86_64__)
|
||||
|
||||
@@ -147,7 +148,7 @@ msr (off_t index)
|
||||
}
|
||||
|
||||
static bool
|
||||
-cpu_sig_amd_hyperv (void)
|
||||
+cpu_sig_cvm_hyperv (uint32_t isoltype)
|
||||
{
|
||||
uint32_t eax, ebx, ecx, edx;
|
||||
char sig[13];
|
||||
@@ -175,8 +176,7 @@ cpu_sig_amd_hyperv (void)
|
||||
ebx = ecx = edx = 0;
|
||||
cpuid(&eax, &ebx, &ecx, &edx);
|
||||
|
||||
- if ((ebx & CPUID_HYPERV_ISOLATION_TYPE_MASK) ==
|
||||
- CPUID_HYPERV_ISOLATION_TYPE_SNP) {
|
||||
+ if ((ebx & CPUID_HYPERV_ISOLATION_TYPE_MASK) == isoltype) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -212,7 +212,7 @@ cpu_sig_amd (void)
|
||||
if (!(eax & (1 << 1))) {
|
||||
debug ("No sev in CPUID, try hyperv CPUID\n");
|
||||
|
||||
- if (cpu_sig_amd_hyperv ()) {
|
||||
+ if (cpu_sig_cvm_hyperv (CPUID_HYPERV_ISOLATION_TYPE_SNP)) {
|
||||
puts ("amd-sev-snp");
|
||||
puts ("hyperv-hcl");
|
||||
} else {
|
||||
@@ -252,8 +252,12 @@ cpu_sig_intel (void)
|
||||
memset (sig, 0, sizeof sig);
|
||||
cpuid_leaf (CPUID_INTEL_TDX_ENUMERATION, sig, true);
|
||||
|
||||
- if (memcmp (sig, CPUID_SIG_INTEL_TDX, sizeof(sig)) == 0)
|
||||
+ if (memcmp (sig, CPUID_SIG_INTEL_TDX, sizeof(sig)) == 0) {
|
||||
puts ("intel-tdx");
|
||||
+ } else if (cpu_sig_cvm_hyperv (CPUID_HYPERV_ISOLATION_TYPE_TDX)) {
|
||||
+ puts ("intel-tdx");
|
||||
+ puts ("hyperv-hcl");
|
||||
+ }
|
||||
}
|
||||
|
||||
static bool
|
||||
diff --git a/virt-what-cvm.pod b/virt-what-cvm.pod
|
||||
index 0f9076569..70213abd7 100644
|
||||
--- a/virt-what-cvm.pod
|
||||
+++ b/virt-what-cvm.pod
|
||||
@@ -50,7 +50,7 @@ Status: tested on Fedora 38 QEMU+KVM SEV-SNP (devel snapshot)
|
||||
|
||||
This is a confidential guest running with Intel TDX technology
|
||||
|
||||
-Status: tested on Microsoft Azure TDX CVM (preview)
|
||||
+Status: tested on Microsoft Azure TDX CVM
|
||||
|
||||
=item B<hyperv-hcl>
|
||||
|
||||
@@ -58,7 +58,7 @@ This is a confidential guest running unenlightened under the
|
||||
HyperV (Azure) HCL (Host Compatibility Layer). This will be
|
||||
paired with B<amd-sev-snp>.
|
||||
|
||||
-Status: tested on Microsoft Azure SEV-SNP CVM
|
||||
+Status: tested on Microsoft Azure SEV-SNP & TDX CVM
|
||||
|
||||
=back
|
||||
|
||||
--
|
||||
2.43.0
|
||||
|
||||
513
0001-virt-what-detect-systemd-nspawn.patch
Normal file
513
0001-virt-what-detect-systemd-nspawn.patch
Normal file
@ -0,0 +1,513 @@
|
||||
From 5315e2b57b2df54b294893adc5185c474985bcc2 Mon Sep 17 00:00:00 2001
|
||||
From: Jochen Kellner <jochen@jochen.org>
|
||||
Date: Mon, 9 Sep 2024 19:18:42 +0200
|
||||
Subject: [PATCH 1/2] virt-what: detect systemd-nspawn
|
||||
|
||||
The following patch adds detection of systemd-nspawn containers to
|
||||
virt-what for me. It is inspired by systemd-detect-virt which also
|
||||
looks at /proc/1/environ.
|
||||
---
|
||||
configure.ac | 2 +
|
||||
tests/nspawn/Makefile.am | 30 +++
|
||||
tests/nspawn/proc/1/environ | Bin 0 -> 262 bytes
|
||||
tests/nspawn/proc/cpuinfo | 224 +++++++++++++++++++++++
|
||||
tests/nspawn/proc/self/status | 61 ++++++
|
||||
tests/nspawn/run/host/container-manager | 5 +
|
||||
tests/nspawn/sbin/dmidecode | 7 +
|
||||
tests/nspawn/sbin/uname | 2 +
|
||||
tests/nspawn/sbin/virt-what-cpuid-helper | 2 +
|
||||
tests/nspawn/test.sh | 32 ++++
|
||||
virt-what.in | 6 +
|
||||
virt-what.pod | 6 +
|
||||
12 files changed, 377 insertions(+)
|
||||
create mode 100644 tests/nspawn/Makefile.am
|
||||
create mode 100644 tests/nspawn/proc/1/environ
|
||||
create mode 100644 tests/nspawn/proc/cpuinfo
|
||||
create mode 100644 tests/nspawn/proc/self/status
|
||||
create mode 100755 tests/nspawn/run/host/container-manager
|
||||
create mode 100755 tests/nspawn/sbin/dmidecode
|
||||
create mode 100755 tests/nspawn/sbin/uname
|
||||
create mode 100755 tests/nspawn/sbin/virt-what-cpuid-helper
|
||||
create mode 100755 tests/nspawn/test.sh
|
||||
|
||||
diff --git a/configure.ac b/configure.ac
|
||||
index e93d237..2882db4 100644
|
||||
--- a/configure.ac
|
||||
+++ b/configure.ac
|
||||
@@ -59,6 +59,7 @@ tests="\
|
||||
lkvm-arm \
|
||||
lx86 \
|
||||
lxc \
|
||||
+ nspawn \
|
||||
nutanix-ahv \
|
||||
oci \
|
||||
parallels-desktop \
|
||||
@@ -112,6 +113,7 @@ AC_CONFIG_FILES([Makefile
|
||||
tests/lkvm-arm/Makefile
|
||||
tests/lx86/Makefile
|
||||
tests/lxc/Makefile
|
||||
+ tests/nspawn/Makefile
|
||||
tests/nutanix-ahv/Makefile
|
||||
tests/oci/Makefile
|
||||
tests/parallels-desktop/Makefile
|
||||
diff --git a/tests/nspawn/Makefile.am b/tests/nspawn/Makefile.am
|
||||
new file mode 100644
|
||||
index 0000000..e566063
|
||||
--- /dev/null
|
||||
+++ b/tests/nspawn/Makefile.am
|
||||
@@ -0,0 +1,30 @@
|
||||
+# Makefile for virt-what
|
||||
+# Copyright (C) 2008-2024 Red Hat Inc.
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
+
|
||||
+CLEANFILES = *~
|
||||
+
|
||||
+TESTS = test.sh
|
||||
+
|
||||
+EXTRA_DIST = \
|
||||
+ test.sh \
|
||||
+ proc/1/environ \
|
||||
+ proc/cpuinfo \
|
||||
+ proc/self/status \
|
||||
+ run/host/container-manager \
|
||||
+ sbin/dmidecode \
|
||||
+ sbin/uname \
|
||||
+ sbin/virt-what-cpuid-helper
|
||||
diff --git a/tests/nspawn/proc/1/environ b/tests/nspawn/proc/1/environ
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..918a77694ad4a0821246c14db4c5976f001a6982
|
||||
GIT binary patch
|
||||
literal 262
|
||||
zcmZ9ET?>LR7=`zT#>!MG*hPeWP->)IbS0ac^g_LhZ5ICf$e^UV^PGos4vTWbS?esj
|
||||
znp#|$lYsL9fAJ^!>Vp!H)CRo()Rw!>d3{q9-CaD9Z1ObW%o^j#sYs5zPy2kGEz;xz
|
||||
z-)Yshpm;1I5h$&xid93y$)u*!D5_}~H(JV3D4JkKvb@}`&Q*~wcS*^aZINA!^9+rL
|
||||
arW;(o+v=gM1A`SPJ`VmRD6X^wf#d~ua$48`
|
||||
|
||||
literal 0
|
||||
HcmV?d00001
|
||||
|
||||
diff --git a/tests/nspawn/proc/cpuinfo b/tests/nspawn/proc/cpuinfo
|
||||
new file mode 100644
|
||||
index 0000000..243aa53
|
||||
--- /dev/null
|
||||
+++ b/tests/nspawn/proc/cpuinfo
|
||||
@@ -0,0 +1,224 @@
|
||||
+processor : 0
|
||||
+vendor_id : GenuineIntel
|
||||
+cpu family : 6
|
||||
+model : 94
|
||||
+model name : Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
|
||||
+stepping : 3
|
||||
+microcode : 0xf0
|
||||
+cpu MHz : 800.000
|
||||
+cache size : 8192 KB
|
||||
+physical id : 0
|
||||
+siblings : 8
|
||||
+core id : 0
|
||||
+cpu cores : 4
|
||||
+apicid : 0
|
||||
+initial apicid : 0
|
||||
+fpu : yes
|
||||
+fpu_exception : yes
|
||||
+cpuid level : 22
|
||||
+wp : yes
|
||||
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb pti ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp vnmi md_clear flush_l1d arch_capabilities
|
||||
+vmx flags : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple shadow_vmcs pml
|
||||
+bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit srbds mmio_stale_data retbleed gds
|
||||
+bogomips : 6799.81
|
||||
+clflush size : 64
|
||||
+cache_alignment : 64
|
||||
+address sizes : 39 bits physical, 48 bits virtual
|
||||
+power management:
|
||||
+
|
||||
+processor : 1
|
||||
+vendor_id : GenuineIntel
|
||||
+cpu family : 6
|
||||
+model : 94
|
||||
+model name : Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
|
||||
+stepping : 3
|
||||
+microcode : 0xf0
|
||||
+cpu MHz : 3999.967
|
||||
+cache size : 8192 KB
|
||||
+physical id : 0
|
||||
+siblings : 8
|
||||
+core id : 1
|
||||
+cpu cores : 4
|
||||
+apicid : 2
|
||||
+initial apicid : 2
|
||||
+fpu : yes
|
||||
+fpu_exception : yes
|
||||
+cpuid level : 22
|
||||
+wp : yes
|
||||
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb pti ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp vnmi md_clear flush_l1d arch_capabilities
|
||||
+vmx flags : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple shadow_vmcs pml
|
||||
+bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit srbds mmio_stale_data retbleed gds
|
||||
+bogomips : 6799.81
|
||||
+clflush size : 64
|
||||
+cache_alignment : 64
|
||||
+address sizes : 39 bits physical, 48 bits virtual
|
||||
+power management:
|
||||
+
|
||||
+processor : 2
|
||||
+vendor_id : GenuineIntel
|
||||
+cpu family : 6
|
||||
+model : 94
|
||||
+model name : Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
|
||||
+stepping : 3
|
||||
+microcode : 0xf0
|
||||
+cpu MHz : 800.000
|
||||
+cache size : 8192 KB
|
||||
+physical id : 0
|
||||
+siblings : 8
|
||||
+core id : 2
|
||||
+cpu cores : 4
|
||||
+apicid : 4
|
||||
+initial apicid : 4
|
||||
+fpu : yes
|
||||
+fpu_exception : yes
|
||||
+cpuid level : 22
|
||||
+wp : yes
|
||||
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb pti ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp vnmi md_clear flush_l1d arch_capabilities
|
||||
+vmx flags : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple shadow_vmcs pml
|
||||
+bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit srbds mmio_stale_data retbleed gds
|
||||
+bogomips : 6799.81
|
||||
+clflush size : 64
|
||||
+cache_alignment : 64
|
||||
+address sizes : 39 bits physical, 48 bits virtual
|
||||
+power management:
|
||||
+
|
||||
+processor : 3
|
||||
+vendor_id : GenuineIntel
|
||||
+cpu family : 6
|
||||
+model : 94
|
||||
+model name : Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
|
||||
+stepping : 3
|
||||
+microcode : 0xf0
|
||||
+cpu MHz : 3975.686
|
||||
+cache size : 8192 KB
|
||||
+physical id : 0
|
||||
+siblings : 8
|
||||
+core id : 3
|
||||
+cpu cores : 4
|
||||
+apicid : 6
|
||||
+initial apicid : 6
|
||||
+fpu : yes
|
||||
+fpu_exception : yes
|
||||
+cpuid level : 22
|
||||
+wp : yes
|
||||
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb pti ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp vnmi md_clear flush_l1d arch_capabilities
|
||||
+vmx flags : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple shadow_vmcs pml
|
||||
+bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit srbds mmio_stale_data retbleed gds
|
||||
+bogomips : 6799.81
|
||||
+clflush size : 64
|
||||
+cache_alignment : 64
|
||||
+address sizes : 39 bits physical, 48 bits virtual
|
||||
+power management:
|
||||
+
|
||||
+processor : 4
|
||||
+vendor_id : GenuineIntel
|
||||
+cpu family : 6
|
||||
+model : 94
|
||||
+model name : Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
|
||||
+stepping : 3
|
||||
+microcode : 0xf0
|
||||
+cpu MHz : 800.000
|
||||
+cache size : 8192 KB
|
||||
+physical id : 0
|
||||
+siblings : 8
|
||||
+core id : 0
|
||||
+cpu cores : 4
|
||||
+apicid : 1
|
||||
+initial apicid : 1
|
||||
+fpu : yes
|
||||
+fpu_exception : yes
|
||||
+cpuid level : 22
|
||||
+wp : yes
|
||||
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb pti ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp vnmi md_clear flush_l1d arch_capabilities
|
||||
+vmx flags : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple shadow_vmcs pml
|
||||
+bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit srbds mmio_stale_data retbleed gds
|
||||
+bogomips : 6799.81
|
||||
+clflush size : 64
|
||||
+cache_alignment : 64
|
||||
+address sizes : 39 bits physical, 48 bits virtual
|
||||
+power management:
|
||||
+
|
||||
+processor : 5
|
||||
+vendor_id : GenuineIntel
|
||||
+cpu family : 6
|
||||
+model : 94
|
||||
+model name : Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
|
||||
+stepping : 3
|
||||
+microcode : 0xf0
|
||||
+cpu MHz : 3955.023
|
||||
+cache size : 8192 KB
|
||||
+physical id : 0
|
||||
+siblings : 8
|
||||
+core id : 1
|
||||
+cpu cores : 4
|
||||
+apicid : 3
|
||||
+initial apicid : 3
|
||||
+fpu : yes
|
||||
+fpu_exception : yes
|
||||
+cpuid level : 22
|
||||
+wp : yes
|
||||
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb pti ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp vnmi md_clear flush_l1d arch_capabilities
|
||||
+vmx flags : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple shadow_vmcs pml
|
||||
+bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit srbds mmio_stale_data retbleed gds
|
||||
+bogomips : 6799.81
|
||||
+clflush size : 64
|
||||
+cache_alignment : 64
|
||||
+address sizes : 39 bits physical, 48 bits virtual
|
||||
+power management:
|
||||
+
|
||||
+processor : 6
|
||||
+vendor_id : GenuineIntel
|
||||
+cpu family : 6
|
||||
+model : 94
|
||||
+model name : Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
|
||||
+stepping : 3
|
||||
+microcode : 0xf0
|
||||
+cpu MHz : 3846.764
|
||||
+cache size : 8192 KB
|
||||
+physical id : 0
|
||||
+siblings : 8
|
||||
+core id : 2
|
||||
+cpu cores : 4
|
||||
+apicid : 5
|
||||
+initial apicid : 5
|
||||
+fpu : yes
|
||||
+fpu_exception : yes
|
||||
+cpuid level : 22
|
||||
+wp : yes
|
||||
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb pti ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp vnmi md_clear flush_l1d arch_capabilities
|
||||
+vmx flags : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple shadow_vmcs pml
|
||||
+bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit srbds mmio_stale_data retbleed gds
|
||||
+bogomips : 6799.81
|
||||
+clflush size : 64
|
||||
+cache_alignment : 64
|
||||
+address sizes : 39 bits physical, 48 bits virtual
|
||||
+power management:
|
||||
+
|
||||
+processor : 7
|
||||
+vendor_id : GenuineIntel
|
||||
+cpu family : 6
|
||||
+model : 94
|
||||
+model name : Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
|
||||
+stepping : 3
|
||||
+microcode : 0xf0
|
||||
+cpu MHz : 3892.180
|
||||
+cache size : 8192 KB
|
||||
+physical id : 0
|
||||
+siblings : 8
|
||||
+core id : 3
|
||||
+cpu cores : 4
|
||||
+apicid : 7
|
||||
+initial apicid : 7
|
||||
+fpu : yes
|
||||
+fpu_exception : yes
|
||||
+cpuid level : 22
|
||||
+wp : yes
|
||||
+flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb pti ssbd ibrs ibpb stibp tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp vnmi md_clear flush_l1d arch_capabilities
|
||||
+vmx flags : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple shadow_vmcs pml
|
||||
+bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit srbds mmio_stale_data retbleed gds
|
||||
+bogomips : 6799.81
|
||||
+clflush size : 64
|
||||
+cache_alignment : 64
|
||||
+address sizes : 39 bits physical, 48 bits virtual
|
||||
+power management:
|
||||
+
|
||||
diff --git a/tests/nspawn/proc/self/status b/tests/nspawn/proc/self/status
|
||||
new file mode 100644
|
||||
index 0000000..e1c867a
|
||||
--- /dev/null
|
||||
+++ b/tests/nspawn/proc/self/status
|
||||
@@ -0,0 +1,61 @@
|
||||
+Name: cat
|
||||
+Umask: 0022
|
||||
+State: R (running)
|
||||
+Tgid: 2359
|
||||
+Ngid: 0
|
||||
+Pid: 2359
|
||||
+PPid: 2049
|
||||
+TracerPid: 0
|
||||
+Uid: 0 0 0 0
|
||||
+Gid: 0 0 0 0
|
||||
+FDSize: 256
|
||||
+Groups:
|
||||
+NStgid: 2359
|
||||
+NSpid: 2359
|
||||
+NSpgid: 2359
|
||||
+NSsid: 2049
|
||||
+Kthread: 0
|
||||
+VmPeak: 3044 kB
|
||||
+VmSize: 3044 kB
|
||||
+VmLck: 0 kB
|
||||
+VmPin: 0 kB
|
||||
+VmHWM: 1408 kB
|
||||
+VmRSS: 1408 kB
|
||||
+RssAnon: 0 kB
|
||||
+RssFile: 1408 kB
|
||||
+RssShmem: 0 kB
|
||||
+VmData: 360 kB
|
||||
+VmStk: 132 kB
|
||||
+VmExe: 20 kB
|
||||
+VmLib: 1520 kB
|
||||
+VmPTE: 44 kB
|
||||
+VmSwap: 0 kB
|
||||
+HugetlbPages: 0 kB
|
||||
+CoreDumping: 0
|
||||
+THP_enabled: 1
|
||||
+untag_mask: 0xffffffffffffffff
|
||||
+Threads: 1
|
||||
+SigQ: 0/127646
|
||||
+SigPnd: 0000000000000000
|
||||
+ShdPnd: 0000000000000000
|
||||
+SigBlk: 0000000000000000
|
||||
+SigIgn: 0000000000000000
|
||||
+SigCgt: 0000000000000000
|
||||
+CapInh: 0000000000000000
|
||||
+CapPrm: 00000000fdecbfff
|
||||
+CapEff: 00000000fdecbfff
|
||||
+CapBnd: 00000000fdecbfff
|
||||
+CapAmb: 0000000000000000
|
||||
+NoNewPrivs: 0
|
||||
+Seccomp: 2
|
||||
+Seccomp_filters: 5
|
||||
+Speculation_Store_Bypass: thread vulnerable
|
||||
+SpeculationIndirectBranch: conditional enabled
|
||||
+Cpus_allowed: ff
|
||||
+Cpus_allowed_list: 0-7
|
||||
+Mems_allowed: 00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
|
||||
+Mems_allowed_list: 0
|
||||
+voluntary_ctxt_switches: 0
|
||||
+nonvoluntary_ctxt_switches: 0
|
||||
+x86_Thread_features:
|
||||
+x86_Thread_features_locked:
|
||||
diff --git a/tests/nspawn/run/host/container-manager b/tests/nspawn/run/host/container-manager
|
||||
new file mode 100755
|
||||
index 0000000..e8bd250
|
||||
--- /dev/null
|
||||
+++ b/tests/nspawn/run/host/container-manager
|
||||
@@ -0,0 +1,5 @@
|
||||
+#!/bin/sh -
|
||||
+cat <<'EOF'
|
||||
+systemd-nspawn
|
||||
+EOF
|
||||
+exit 0
|
||||
diff --git a/tests/nspawn/sbin/dmidecode b/tests/nspawn/sbin/dmidecode
|
||||
new file mode 100755
|
||||
index 0000000..78e5cea
|
||||
--- /dev/null
|
||||
+++ b/tests/nspawn/sbin/dmidecode
|
||||
@@ -0,0 +1,7 @@
|
||||
+#!/bin/sh -
|
||||
+cat <<'EOF'
|
||||
+# dmidecode 3.4
|
||||
+Scanning /dev/mem for entry point.
|
||||
+/dev/mem: No such file or directory
|
||||
+EOF
|
||||
+exit 1
|
||||
diff --git a/tests/nspawn/sbin/uname b/tests/nspawn/sbin/uname
|
||||
new file mode 100755
|
||||
index 0000000..ab0ec89
|
||||
--- /dev/null
|
||||
+++ b/tests/nspawn/sbin/uname
|
||||
@@ -0,0 +1,2 @@
|
||||
+#!/bin/sh -
|
||||
+echo x86_64
|
||||
diff --git a/tests/nspawn/sbin/virt-what-cpuid-helper b/tests/nspawn/sbin/virt-what-cpuid-helper
|
||||
new file mode 100755
|
||||
index 0000000..481e1e6
|
||||
--- /dev/null
|
||||
+++ b/tests/nspawn/sbin/virt-what-cpuid-helper
|
||||
@@ -0,0 +1,2 @@
|
||||
+#!/bin/sh -
|
||||
+# no output
|
||||
diff --git a/tests/nspawn/test.sh b/tests/nspawn/test.sh
|
||||
new file mode 100755
|
||||
index 0000000..09e5b9a
|
||||
--- /dev/null
|
||||
+++ b/tests/nspawn/test.sh
|
||||
@@ -0,0 +1,32 @@
|
||||
+# Test for systemd-nspawn
|
||||
+# Copyright (C) 2008-2024 Red Hat Inc.
|
||||
+#
|
||||
+# This program is free software; you can redistribute it and/or modify
|
||||
+# it under the terms of the GNU General Public License as published by
|
||||
+# the Free Software Foundation; either version 2 of the License, or
|
||||
+# (at your option) any later version.
|
||||
+#
|
||||
+# This program is distributed in the hope that it will be useful,
|
||||
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+# GNU General Public License for more details.
|
||||
+#
|
||||
+# You should have received a copy of the GNU General Public License
|
||||
+# along with this program; if not, write to the Free Software
|
||||
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
+
|
||||
+output="$(PATH=../..:$PATH virt-what --test-root=. 2>&1)"
|
||||
+expected="systemd_nspawn"
|
||||
+
|
||||
+if [ "$output" != "$expected" ]; then
|
||||
+ echo "$0: test failed because output did not match expected"
|
||||
+ echo "Expected output was:"
|
||||
+ echo "----------------------------------------"
|
||||
+ echo "$expected"
|
||||
+ echo "----------------------------------------"
|
||||
+ echo "But the actual output of the program was:"
|
||||
+ echo "----------------------------------------"
|
||||
+ echo "$output"
|
||||
+ echo "----------------------------------------"
|
||||
+ exit 1
|
||||
+fi
|
||||
diff --git a/virt-what.in b/virt-what.in
|
||||
index ba35cc5..39f0497 100644
|
||||
--- a/virt-what.in
|
||||
+++ b/virt-what.in
|
||||
@@ -238,6 +238,12 @@ elif grep -qF /libpod- "${root}/proc/self/cgroup" 2>/dev/null; then
|
||||
echo podman
|
||||
fi
|
||||
|
||||
+# Check for container=systemd-nspawn
|
||||
+if [ -e "${root}/proc/1/environ" ] &&
|
||||
+ cat "${root}/proc/1/environ" | tr '\000' '\n' | grep -Eiq '^container=systemd-nspawn'; then
|
||||
+ echo systemd_nspawn
|
||||
+fi
|
||||
+
|
||||
# Check for Linux-VServer
|
||||
if test -e "${root}/proc/self/status" \
|
||||
&& cat "${root}/proc/self/status" | grep -q "VxID: [0-9]*"; then
|
||||
diff --git a/virt-what.pod b/virt-what.pod
|
||||
index d5eeb76..0eb0b93 100644
|
||||
--- a/virt-what.pod
|
||||
+++ b/virt-what.pod
|
||||
@@ -270,6 +270,12 @@ The guest is running on the Red Hat hypervisor.
|
||||
|
||||
Status: confirmed by RWMJ
|
||||
|
||||
+=item B<systemd_nspawn>
|
||||
+
|
||||
+This process is running in a systemd nspawn container.
|
||||
+
|
||||
+Status: contributed by Jochen Kellner
|
||||
+
|
||||
=item B<uml>
|
||||
|
||||
This is a User-Mode Linux (UML) guest.
|
||||
--
|
||||
2.49.0
|
||||
|
||||
1172
0002-Add-support-for-WSL2.patch
Normal file
1172
0002-Add-support-for-WSL2.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,65 +0,0 @@
|
||||
From 037689fbe95e403b050c1eb736ebc8fdc2e601a5 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= <berrange@redhat.com>
|
||||
Date: Fri, 2 Aug 2024 16:07:46 +0100
|
||||
Subject: [PATCH] Add support for detecting protected virtualization on s390x
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
|
||||
---
|
||||
virt-what-cvm.c | 21 ++++++++++++++++++++-
|
||||
virt-what-cvm.pod | 5 +++++
|
||||
2 files changed, 25 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/virt-what-cvm.c b/virt-what-cvm.c
|
||||
index 0daa6ac35..320df478b 100644
|
||||
--- a/virt-what-cvm.c
|
||||
+++ b/virt-what-cvm.c
|
||||
@@ -295,7 +295,26 @@ cpu_sig (void)
|
||||
cpu_sig_intel ();
|
||||
}
|
||||
|
||||
-#else /* !x86_64 */
|
||||
+#elif defined(__s390x__)
|
||||
+
|
||||
+#define SYSFS_PROT_VIRT "/sys/firmware/uv/prot_virt_guest"
|
||||
+
|
||||
+static void
|
||||
+cpu_sig (void)
|
||||
+{
|
||||
+ int fd = open("/sys/firmware/uv/prot_virt_guest", O_RDONLY);
|
||||
+ char c;
|
||||
+ if (fd < 0)
|
||||
+ return;
|
||||
+
|
||||
+ if (read(fd, &c, 1) == 1 && c == '1')
|
||||
+ puts("s390-protvirt");
|
||||
+
|
||||
+ close(fd);
|
||||
+}
|
||||
+
|
||||
+
|
||||
+#else /* ! x86_64 && ! s390x */
|
||||
|
||||
static void
|
||||
cpu_sig (void)
|
||||
diff --git a/virt-what-cvm.pod b/virt-what-cvm.pod
|
||||
index 70213abd7..00e21cb70 100644
|
||||
--- a/virt-what-cvm.pod
|
||||
+++ b/virt-what-cvm.pod
|
||||
@@ -60,6 +60,11 @@ paired with B<amd-sev-snp>.
|
||||
|
||||
Status: tested on Microsoft Azure SEV-SNP & TDX CVM
|
||||
|
||||
+=item B<s390x-protvirt>
|
||||
+
|
||||
+This is a confidential guest running on s390x with the
|
||||
+Protected Virtualization (Secure Execution) technology
|
||||
+
|
||||
=back
|
||||
|
||||
=head1 EXIT STATUS
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@ -1,28 +0,0 @@
|
||||
From 963676c4dd4c2a9c070b76da6f8835ceb131dbe0 Mon Sep 17 00:00:00 2001
|
||||
From: "Richard W.M. Jones" <rjones@redhat.com>
|
||||
Date: Tue, 13 Aug 2024 13:23:06 +0100
|
||||
Subject: [PATCH] virt-what-cvm.pod: Fix man page typo s390x-protvirt ->
|
||||
s390-protvirt
|
||||
|
||||
Reported-by: Yongkui Guo
|
||||
Fixes: commit 037689fbe95e403b050c1eb736ebc8fdc2e601a5
|
||||
---
|
||||
virt-what-cvm.pod | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/virt-what-cvm.pod b/virt-what-cvm.pod
|
||||
index 00e21cb70..a76717984 100644
|
||||
--- a/virt-what-cvm.pod
|
||||
+++ b/virt-what-cvm.pod
|
||||
@@ -60,7 +60,7 @@ paired with B<amd-sev-snp>.
|
||||
|
||||
Status: tested on Microsoft Azure SEV-SNP & TDX CVM
|
||||
|
||||
-=item B<s390x-protvirt>
|
||||
+=item B<s390-protvirt>
|
||||
|
||||
This is a confidential guest running on s390x with the
|
||||
Protected Virtualization (Secure Execution) technology
|
||||
--
|
||||
2.43.0
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: virt-what
|
||||
Version: 1.27
|
||||
Release: 2%{?dist}
|
||||
Release: 3%{?dist}
|
||||
Summary: Detect if we are running in a virtual machine
|
||||
License: GPL-2.0-or-later
|
||||
|
||||
@ -14,6 +14,11 @@ Source2: libguestfs.keyring
|
||||
# Maintainer script which helps with handling patches.
|
||||
Source3: copy-patches.sh
|
||||
|
||||
# Add detection of systemd-nspawn (upstream)
|
||||
Patch: 0001-virt-what-detect-systemd-nspawn.patch
|
||||
# Add detection of WSL2 (upstream)
|
||||
Patch: 0002-Add-support-for-WSL2.patch
|
||||
|
||||
BuildRequires: gcc
|
||||
BuildRequires: make
|
||||
BuildRequires: git
|
||||
@ -121,6 +126,11 @@ fi
|
||||
|
||||
|
||||
%changelog
|
||||
* Tue May 06 2025 Richard W.M. Jones <rjones@redhat.com> - 1.27-2
|
||||
- Rebase to Fedora Rawhide
|
||||
- Enable virt-what to detect WSL2
|
||||
resolves: RHEL-89794
|
||||
|
||||
* Tue Oct 29 2024 Troy Dawson <tdawson@redhat.com> - 1.27-2
|
||||
- Bump release for October 2024 mass rebuild:
|
||||
Resolves: RHEL-64018
|
||||
|
||||
Loading…
Reference in New Issue
Block a user