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 1460086 - No basic check for the cpu flag name for tcg or cpu mode is host-passthrough guest
Summary: No basic check for the cpu flag name for tcg or cpu mode is host-passthrough ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.4
Hardware: x86_64
OS: Linux
medium
medium
Target Milestone: rc
: ---
Assignee: Jiri Denemark
QA Contact: Luyao Huang
URL:
Whiteboard:
Depends On:
Blocks: libvirtCPUconfig
TreeView+ depends on / blocked
 
Reported: 2017-06-09 03:28 UTC by Luyao Huang
Modified: 2018-04-10 10:48 UTC (History)
4 users (show)

Fixed In Version: libvirt-3.8.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-04-10 10:46:43 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 10:48:00 UTC

Description Luyao Huang 2017-06-09 03:28:06 UTC
Description of problem:
No basic check for the cpu flag name for tcg or cpu mode is host-passthrough  guest

Version-Release number of selected component (if applicable):
libvirt-3.2.0-9.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1. tcg guest + invalid cpu flag name + check is full:

# virsh dumpxml r7
<domain type='qemu'>
...
  <cpu mode='host-model' check='full'>
    <model fallback='allow'/>
    <topology sockets='2' cores='4' threads='1'/>
    <feature policy='require' name='notexisted'/>


# virsh start r7
error: Failed to start domain r7
error: internal error: qemu unexpectedly closed the monitor: 2017-06-09T03:06:46.251886Z qemu-kvm: -chardev pty,id=charserial0: char device redirected to /dev/pts/1 (label charserial0)
2017-06-09T03:06:46.252285Z qemu-kvm: -chardev pty,id=charredir0: char device redirected to /dev/pts/2 (label charredir0)
2017-06-09T03:06:46.267520Z qemu-kvm: can't apply global Opteron_G4-x86_64-cpu.notexisted=on: Property '.notexisted' not found


2. kvm guest + host-passthrough :

  <cpu mode='host-passthrough' check='full'>
    <topology sockets='2' cores='4' threads='1'/>
    <feature policy='require' name='notexisted'/>
    <numa>
      <cell id='0' cpus='0-3' memory='512000' unit='KiB'/>
      <cell id='1' cpus='4-7' memory='512000' unit='KiB'/>
    </numa>
  </cpu>

# virsh start r7
error: Failed to start domain r7
error: internal error: qemu unexpectedly closed the monitor: 2017-06-09T03:11:13.455183Z qemu-kvm: -chardev pty,id=charserial0: char device redirected to /dev/pts/1 (label charserial0)
2017-06-09T03:11:13.455562Z qemu-kvm: -chardev pty,id=charredir0: char device redirected to /dev/pts/2 (label charredir0)
2017-06-09T03:11:13.468983Z qemu-kvm: can't apply global host-x86_64-cpu.notexisted=on: Property '.notexisted' not found

3.

Actual results:

Libvirt could still validate that the XML uses valid feature names from our cpu_map.xml.

Expected results:

libvirt catch these invalid flags and report error earlier 

Additional info:

Comment 1 Laszlo Ersek 2017-06-09 18:07:32 UTC
To anyone that lands here due to following the RHBZ URL in upstream libvirt commit 3596b1ddf912 ("qemu: report an error if usb keyboards are unsupported", 2017-06-09):

You are looking for bug 1460008 instead.

Comment 2 Jiri Denemark 2017-09-14 14:23:46 UTC
Patches sent upstream for review: https://www.redhat.com/archives/libvir-list/2017-September/msg00410.html

Comment 3 Jiri Denemark 2017-09-18 10:29:21 UTC
Fixed upstream by:

commit 6ef9c202f2a158fa5e7ad6b2a7da853da55ac395
Refs: v3.7.0-91-g6ef9c202f2
Author:     Jiri Denemark <jdenemar>
AuthorDate: Thu Sep 14 16:04:13 2017 +0200
Commit:     Jiri Denemark <jdenemar>
CommitDate: Mon Sep 18 10:40:12 2017 +0200

    cpu: Introduce virCPUValidateFeatures

    This new API may be used to check whether all features used in a CPU
    definition are valid (e.g., libvirt knows their name, their policy is
    supported, etc.). Leaving this API unimplemented in an arch subdriver
    means libvirt does not restrict CPU features usable on the associated
    architectures.

    Signed-off-by: Jiri Denemark <jdenemar>

commit 3f0193f7e5cc3fade291d5579354846dfba00972
Refs: v3.7.0-92-g3f0193f7e5
Author:     Jiri Denemark <jdenemar>
AuthorDate: Thu Sep 14 16:07:59 2017 +0200
Commit:     Jiri Denemark <jdenemar>
CommitDate: Mon Sep 18 10:40:12 2017 +0200

    qemu: Validate guest CPU features before starting a domain

    Signed-off-by: Jiri Denemark <jdenemar>

commit 20edbad7769df6bb23e1132aee186090db5e8856
Refs: v3.7.0-93-g20edbad776
Author:     Jiri Denemark <jdenemar>
AuthorDate: Thu Sep 14 16:09:35 2017 +0200
Commit:     Jiri Denemark <jdenemar>
CommitDate: Mon Sep 18 10:40:12 2017 +0200

    cpu_s390: Implement virCPUValidateFeatures

    Only feature policy is checked on s390, which was previously done in
    virCPUUpdate, but that's not the correct place for the check once we
    have virCPUValidateFeatures.

    Signed-off-by: Jiri Denemark <jdenemar>

commit ea9741f6009c4654ed865314dfb1fce3eec5adb1
Refs: v3.7.0-94-gea9741f600
Author:     Jiri Denemark <jdenemar>
AuthorDate: Thu Sep 14 16:14:40 2017 +0200
Commit:     Jiri Denemark <jdenemar>
CommitDate: Mon Sep 18 10:40:12 2017 +0200

    cpu_x86: Implement virCPUValidateFeatures

    The function checks whether all CPU features used in a CPU definition
    are specified in cpu_map.xml.

    https://bugzilla.redhat.com/show_bug.cgi?id=1460086

    Signed-off-by: Jiri Denemark <jdenemar>

Comment 5 Luyao Huang 2018-01-17 06:34:52 UTC
Verify this bug with libvirt-3.9.0-7.el7.x86_64:

1. tcg guest + invalid cpu flag name + check is full:

# virsh dumpxml r7
<domain type='qemu'>
...
  <cpu mode='host-model' check='full'>
    <model fallback='allow'/>
    <topology sockets='2' cores='4' threads='1'/>
    <feature policy='require' name='notexisted'/>


2. start guest:

# virsh start vm1
error: Failed to start domain vm1
error: unsupported configuration: unknown CPU feature: notexisted


3. kvm guest + host-passthrough:

  <cpu mode='host-passthrough' check='full'>
    <feature policy='require' name='notexisted'/>
    <numa>
      <cell id='0' cpus='0-1' memory='512000' unit='KiB'/>
      <cell id='1' cpus='2-3' memory='512000' unit='KiB'/>
    </numa>
  </cpu>

4. 

# virsh start vm1
error: Failed to start domain vm1
error: unsupported configuration: unknown CPU feature: notexisted

Comment 9 errata-xmlrpc 2018-04-10 10:46:43 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.