chiark / gitweb /
virt: use /proc/xen as indicator for a Xen domain (#6442, #6662) (#7555)
authorOlaf Hering <olaf@aepfle.de>
Wed, 6 Dec 2017 18:59:30 +0000 (19:59 +0100)
committerSven Eden <yamakuzure@gmx.net>
Wed, 6 Dec 2017 18:59:30 +0000 (19:59 +0100)
commit9c0f52cbba6e4ef251e4305110d92fd69cfac07f
treed6bca108826ef5fc00e65f150039a82a71cf566a
parentb15a0ea0022adc98ca5d1b9377f8f481e2acb6ad
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")
src/basic/virt.c