Bug 573771

Summary: should set ISVM bit (ECX:31) for CPUID leaf 0x00000001
Product: Red Hat Enterprise Linux 5 Reporter: Paolo Bonzini <pbonzini>
Component: kernel-xenAssignee: Paolo Bonzini <pbonzini>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: low    
Version: 5.4CC: dhoward, jlv, jpirko, jzheng, llim, mshao, qcai, xen-maint, yuzhang
Target Milestone: rcKeywords: ZStream
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Microsoft's Server Virtualization Validation Test contains an IsVM component, which directs that applications should be able to determine if they are running inside a virtualized environment by performing a CPUID check. With this update, applications running on a Windows operating system are able to determine whether they are running inside a virtualized environment.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-01-13 21:17:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 514489, 518435, 599734    
Attachments:
Description Flags
program to aid verification
none
`x86info -r` for HVM on AMD none

Description Paolo Bonzini 2010-03-15 18:30:28 UTC
From http://msdn.microsoft.com/en-us/library/dd871279%28v=MSDN.10%29.aspx

IsVM TEST

To support utility or application software that may need to determine if it is executing in a virtualized environment, the IsVM test determines if virtualization products correctly expose the CPUID information to the virtual instance of Windows or applications. Software in the virtual instance of Windows can determine if it is running within a virtualized environment by executing the CPUID instruction with an input (EAX register) value of 1. When the CPUID instruction is executed by the software and it checks bit 31 of register ECX, the “hypervisor-present” bit should be set by the virtualization product.

Comment 1 Paolo Bonzini 2010-03-16 09:54:05 UTC
Created attachment 400419 [details]
program to aid verification

This program will print one of the following four strings:

PV guest, hypervisor present bit set
HVM guest, hypervisor present bit set
PV guest, hypervisor present bit *NOT* set
HVM guest, hypervisor present bit *NOT* set

I used it for testing and it could be used for verification of this bug (especially for PV guests; for HVM you could use x86info -r too).

Comment 3 Jarod Wilson 2010-04-21 19:42:01 UTC
in kernel-2.6.18-197.el5
You can download this test kernel from http://people.redhat.com/jwilson/el5

Please update the appropriate value in the Verified field
(cf_verified) to indicate this fix has been successfully
verified. Include a comment with verification details.

Comment 8 Jinxin Zheng 2010-12-27 08:48:35 UTC
Created attachment 470817 [details]
`x86info -r` for HVM on AMD

Here is a test result using the code in the attachment.

(I conducted the test on -194 and -238 of kernel-xen, on both PV and HVM guests, and on Intel and AMD CPUs. The 'N' stands for 'hypervisor present bit *NOT* set', the 'Y' stands for 'hypervisor present bit set'.)

+------------+--------+--------------+
|            |        |      CPU     |
| kernel-xen | Guest  +-------+------+
|            |        |  Intel|  AMD |
+------------+--------+-------+------+
|            |  PV    |   N   |   N  |
|  -194.el5  +--------+-------+------+
|            |  HVM   |   N   |   N  |
+------------+--------+-------+------+
|            |  PV    |   Y   |   Y  |
|  -238.el5  +--------+-------+------+
|            |  HVM   |   Y   |   N  |
+------------+--------+-------+------+

The IsVM bit is present on none of the guests over -194 host. After upgraded to -238 host kernel, the IsVM bit is present on most of the guests, except for HVM on an AMD.

Comment 9 Jinxin Zheng 2010-12-27 08:52:11 UTC
(In reply to comment #8)
> Created attachment 470817 [details]
> `x86info -r` for HVM on AMD
> 
> Here is a test result using the code in the attachment.
> 

Confusing... I mean the code in Paolo's attachment in comment 1.

Comment 12 Jinxin Zheng 2010-12-28 05:39:22 UTC
OK. Since this works for Intel, I'll put it in VERIFIED.

For the AMD case I'll do more test and report in a new bug.

Comment 14 errata-xmlrpc 2011-01-13 21:17:50 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2011-0017.html