RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1533125 - Libvirt may prefer $CPUModel over $CPUModel-IBRS when reporting host CPU model
Summary: Libvirt may prefer $CPUModel over $CPUModel-IBRS when reporting host CPU model
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.5
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: rc
: ---
Assignee: Jiri Denemark
QA Contact: Luyao Huang
URL:
Whiteboard:
Depends On:
Blocks: 1533415 1533418
TreeView+ depends on / blocked
 
Reported: 2018-01-10 14:08 UTC by Jiri Denemark
Modified: 2018-04-10 11:05 UTC (History)
9 users (show)

Fixed In Version: libvirt-3.9.0-8.el7
Doc Type: Bug Fix
Doc Text:
As a part of security update CVE-2017-5715, the libvirt service is expected to report whether the host CPU model was secured against the Kernel Side-channel Attacks exploit. However, in certain cases, libvirt incorrectly reported secured CPU models as unsecured. This problem has been fixed, and libvirt now reports the security status of the host CPU correctly.
Clone Of:
: 1533415 1533418 (view as bug list)
Environment:
Last Closed: 2018-04-10 11:04:21 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2018:0704 0 None None None 2018-04-10 11:05:38 UTC

Description Jiri Denemark 2018-01-10 14:08:52 UTC
Description of problem:

When libvirt tries to detect host CPU model, it may sometimes report the CPU as some non-IBRS model
(such as Skylake-Server, but this applies to all models) rather than its IBRS variant (e.g.,
Skylake-Server-IBRS) even though the microcode was properly updated to contain fixes for CVE-2017-5715
and "spec-ctrl" feature is present. Libvirt would even report the "spec-ctrl" feature so anyone using
host-model CPU will get it regardless. And starting a domain with the IBRS CPU model would work too, but
the host CPU model will not be reported as *-IBRS which may confuse people or tools.

This happens on a host with CPU signature that matches one of the signatures found in cpu_model.xml. For
example, on a Skylake-Server host with CPU family='6' and model='85' (06-55-* in Intel notation as 85 == 0x55)
libvirt will report the host CPU as Skylake-Server with or without "spec-ctrl", but it will not use
Skylake-Server-IBRS. However, the CPU model would be reported correctly on Skylake-Server with different
signature.

Version-Release number of selected component (if applicable):

libvirt-3.9.0-7.el7
libvirt-3.2.0-14.el7_4.7
libvirt-2.0.0-10.el7_3.10

How reproducible:

100%

Steps to Reproduce:
1. upgrade microcode on a host with CPU signature matching one of the signatures in /usr/share/libvirt/cpu_map.xml
2. virsh capabilities

Actual results:

    <cpu>
      <arch>x86_64</arch>
      <model>$CPUModel</model>
      <vendor>...</vendor>
      <microcode version='...'/>
      ...
      <feature name='spec-ctrl'/>
      ...
    </cpu>


Expected results:

    <cpu>
      <arch>x86_64</arch>
      <model>$CPUModel-IBRS</model>
      <vendor>...</vendor>
      <microcode version='...'/>
      ...
    </cpu>

And no <feature name='spec-ctrl'/> is mentioned there.

Additional info:

This applies to AMD's EPYC CPU model too, just replase -IBRS with -IBPB.

Comment 1 Jiri Denemark 2018-01-10 14:16:53 UTC
Fixed upstream by commit:

commit b427cf4831d0ea7aac9dd1a3aa7682478356a483
Refs: v3.10.0-154-gb427cf4831
Author:     Jiri Denemark <jdenemar>
AuthorDate: Fri Jan 5 17:43:03 2018 +0100
Commit:     Jiri Denemark <jdenemar>
CommitDate: Wed Jan 10 11:07:23 2018 +0100

    cpu_x86: Copy CPU signature from ancestor

    When specifying a new CPU model in cpu_map.xml as an extension to an
    existing model, we forgot to copy the signature (family + model) from
    the original CPU model.

    We don't use this way of specifying CPU models, but it's still supported
    and it becomes useful when someone wants to quickly hack up a CPU model
    for testing or when creating additional variants of existing models to
    help with fixing some spectral issues.

    Signed-off-by: Jiri Denemark <jdenemar>
    Reviewed-by: Pavel Hrdina <phrdina>

Comment 5 Luyao Huang 2018-01-18 06:31:37 UTC
Verify this bug with libvirt-3.9.0-8.el7.x86_64 on Skylake-server and EPYC host. 

1. 

# lscpu
Architecture:          x86_64
...
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 85
...
Flags:                 ...spec_ctrl ibpb_support...


2.
virsh # capabilities 
...
    <cpu>
      <arch>x86_64</arch>
      <model>Skylake-Server-IBRS</model>
      <vendor>Intel</vendor>
      <microcode version='33554492'/>
...

3. start a guest with host-model

# virsh start vm1
Domain vm1 started

4. check the guest xml and qemu cmdline:

  <cpu mode='custom' match='exact' check='full'>
    <model fallback='forbid'>Skylake-Server-IBRS</model>
    <vendor>Intel</vendor>
    <feature policy='require' name='ss'/>
    <feature policy='require' name='hypervisor'/>
    <feature policy='require' name='tsc_adjust'/>
    <feature policy='require' name='clflushopt'/>
    <feature policy='require' name='pku'/>
    <feature policy='disable' name='arat'/>
    <numa>
      <cell id='0' cpus='0-1' memory='512000' unit='KiB'/>
      <cell id='1' cpus='2-3' memory='512000' unit='KiB'/>
    </numa>
  </cpu>

# ps aux|grep qemu
... -cpu Skylake-Server-IBRS,ss=on,hypervisor=on,tsc_adjust=on,clflushopt=on,pku=on

Comment 10 errata-xmlrpc 2018-04-10 11:04:21 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2018:0704


Note You need to log in before you can comment on or make changes to this bug.