summaryrefslogtreecommitdiff
path: root/src/basic/virt.c
diff options
context:
space:
mode:
authorOlaf Hering <olaf@aepfle.de>2017-12-06 19:59:30 +0100
committerSven Eden <yamakuzure@gmx.net>2017-12-06 19:59:30 +0100
commit9c0f52cbba6e4ef251e4305110d92fd69cfac07f (patch)
treed6bca108826ef5fc00e65f150039a82a71cf566a /src/basic/virt.c
parentb15a0ea0022adc98ca5d1b9377f8f481e2acb6ad (diff)
virt: use /proc/xen as indicator for a Xen domain (#6442, #6662) (#7555)
The file /proc/xen/capabilities is only available if xenfs is mounted. With a classic xenlinux based kernel that file is available unconditionally. But with a modern pvops based kernel, xenfs must be mounted before the "capabilities" may appear. xenfs is mounted very late via .services files provided by the Xen toolstack. Other units may be scheduled before xenfs is mounted, which will confuse the detection of VIRTUALIZATION_XEN. In all Xen enabled kernels, and if that kernel is actually running on the Xen hypervisor, the "/proc/xen" directory is the reliable indicator that this instance runs in a "Xen guest". Adjust the code to check for /proc/xen instead of /proc/xen/capabilities. Fixes commit 3f61278b5 ("basic: Bugfix Detect XEN Dom0 as no virtualization")
Diffstat (limited to 'src/basic/virt.c')
-rw-r--r--src/basic/virt.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/basic/virt.c b/src/basic/virt.c
index d126bbf33..96ee4a7cb 100644
--- a/src/basic/virt.c
+++ b/src/basic/virt.c
@@ -219,13 +219,13 @@ static int detect_vm_dmi(void) {
static int detect_vm_xen(void) {
/* Check for Dom0 will be executed later in detect_vm_xen_dom0
- Thats why we dont check the content of /proc/xen/capabilities here. */
- if (access("/proc/xen/capabilities", F_OK) < 0) {
- log_debug("Virtualization XEN not found, /proc/xen/capabilities does not exist");
+ The presence of /proc/xen indicates some form of a Xen domain */
+ if (access("/proc/xen", F_OK) < 0) {
+ log_debug("Virtualization XEN not found, /proc/xen does not exist");
return VIRTUALIZATION_NONE;
}
- log_debug("Virtualization XEN found (/proc/xen/capabilities exists)");
+ log_debug("Virtualization XEN found (/proc/xen exists)");
return VIRTUALIZATION_XEN;
}
@@ -357,11 +357,10 @@ int detect_vm(void) {
}
/* x86 xen will most likely be detected by cpuid. If not (most likely
- * because we're not an x86 guest), then we should try the xen capabilities
- * file next. If that's not found, then we check for the high-level
- * hypervisor sysfs file:
- *
- * https://bugs.freedesktop.org/show_bug.cgi?id=77271 */
+ * because we're not an x86 guest), then we should try the /proc/xen
+ * directory next. If that's not found, then we check for the high-level
+ * hypervisor sysfs file.
+ */
r = detect_vm_xen();
if (r < 0)