Bug 1220265 - libvirt format a (null) in ./devices/shmem/msi[@ioeventfd] when pass a invalid ioeventfd
Summary: libvirt format a (null) in ./devices/shmem/msi[@ioeventfd] when pass a invali...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.2
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Martin Kletzander
QA Contact: Virtualization Bugs
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-05-11 07:07 UTC by Luyao Huang
Modified: 2015-11-19 06:30 UTC (History)
4 users (show)

Fixed In Version: libvirt-1.2.16-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 06:30:36 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2015:2202 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2015-11-19 08:17:58 UTC

Description Luyao Huang 2015-05-11 07:07:55 UTC
Description of problem:
libvirt format a (null) in ./devices/shmem/msi[@ioeventfd] when pass a invalid ioeventfd

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

How reproducible:
100%

Steps to Reproduce:
1. add this shmem in a guest xml:

# virsh edit test3

    <shmem name='my_shmem0'>
      <size unit='M'>2</size>
      <server path='/tmp/socket-shmem'/>
      <msi vectors='32' ioeventfd='aaa'/>
    </shmem>


2. check the xml
# virsh dumpxml test3 
     <shmem name='my_shmem0'>
      <size unit='M'>2</size>
      <server path='/tmp/socket-shmem'/>
      <msi vectors='32' ioeventfd='(null)'/>
    </shmem>

3.

Actual results:
libvirt format a (null) at ./devices/shmem/msi[@ioeventfd] when pass a invalid ioeventfd

Expected results:
output error when we set a invalid ioeventfd or just drop the wrong settings.

Additional info:

Comment 1 Luyao Huang 2015-05-11 13:00:44 UTC
Another try (version 2):

https://www.redhat.com/archives/libvir-list/2015-May/msg00305.html

Comment 2 Ján Tomko 2015-05-14 12:19:54 UTC
commit c49b9032a212538ff28786d1b9922ebf549ea5ca
Author:     Luyao Huang <lhuang@redhat.com>
AuthorDate: 2015-05-11 20:59:37 +0800
Commit:     Martin Kletzander <mkletzan@redhat.com>
CommitDate: 2015-05-11 16:05:07 +0200

    conf: Report error for unknown shmem ioeventfd value
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1220265
    
    Passing the return value to an enum directly is not safe.  Fix this by
    comparing the true integer result of virTristateSwitchTypeFromString().
    
    Signed-off-by: Luyao Huang <lhuang@redhat.com>

git describe: v1.2.15-56-gc49b903

Comment 4 hongming 2015-08-07 07:58:15 UTC
Verify it as follows. The result is expected. Move its status to VERIFIED.

# rpm -q libvirt
libvirt-1.2.17-3.el7.x86_64

# virsh edit test4

    <shmem name='my_shmem0'>
      <size unit='M'>2</size>
      <server path='/tmp/socket-shmem'/>
      <msi vectors='32' ioeventfd='aaa'/>
    </shmem>

error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Extra element devices in interleave
Element domain failed to validate content


# virsh edit test4

    <shmem name='my_shmem0'>
      <size unit='M'>2</size>
      <server path='/tmp/socket-shmem'/>
      <msi vectors='32' ioeventfd=' '/>
    </shmem>

Failed. Try again? [y,n,i,f,?]: 
error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Extra element devices in interleave
Element domain failed to validate content

# virsh edit test4

    <shmem name='my_shmem0'>
      <size unit='M'>2</size>
      <server path='/tmp/socket-shmem'/>
      <msi vectors='32' ioeventfd='111'/>
    </shmem>


Failed. Try again? [y,n,i,f,?]: 
error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Extra element devices in interleave
Element domain failed to validate content


# virsh edit test4

    <shmem name='my_shmem0'>
      <size unit='M'>2</size>
      <server path='/tmp/socket-shmem'/>
      <msi vectors='32' ioeventfd='on'/>
    </shmem>

Domain test4 XML configuration edited.


# virsh edit test4

    <shmem name='my_shmem0'>
      <size unit='M'>2</size>
      <server path='/tmp/socket-shmem'/>
      <msi vectors='32' ioeventfd='off'/>
    </shmem>

Domain test4 XML configuration edited.

Comment 5 Martin Kletzander 2015-08-07 08:03:28 UTC
(In reply to hongming from comment #4)
Did you also try it without the RNG validation?  For example with 'virsh define' or by pressing 'i' when the XML error pops out?

Comment 6 hongming 2015-08-18 05:44:15 UTC
# cat r7.xml |grep /shmem -B4
    <shmem name='my_shmem0'>
      <size unit='M'>2</size>
      <server path='/tmp/socket-shmem'/>
      <msi vectors='32' ioeventfd='aaa'/>
    </shmem>
# virsh define r7.xml
error: Failed to define domain from r7.xml
error: XML error: invalid msi ioeventfd setting for shmem: 'aaa'

# vim r7.xml
# cat r7.xml |grep /shmem -B4
    <shmem name='my_shmem0'>
      <size unit='M'>2</size>
      <server path='/tmp/socket-shmem'/>
      <msi vectors='32' ioeventfd=' '/>
    </shmem>
# virsh define r7.xml
error: Failed to define domain from r7.xml
error: XML error: invalid msi ioeventfd setting for shmem: ' '

# vim r7.xml
# cat r7.xml |grep /shmem -B4
    <shmem name='my_shmem0'>
      <size unit='M'>2</size>
      <server path='/tmp/socket-shmem'/>
      <msi vectors='32' ioeventfd='111'/>
    </shmem>
# virsh define r7.xml
error: Failed to define domain from r7.xml
error: XML error: invalid msi ioeventfd setting for shmem: '111'


# virsh edit r7.1
error: XML document failed to validate against schema: Unable to validate doc against /usr/share/libvirt/schemas/domain.rng
Extra element devices in interleave
Element domain failed to validate content

Failed. Try again? [y,n,i,f,?]: 
error: XML error: invalid msi ioeventfd setting for shmem: 'aaa'
Failed. Try again? [y,n,f,?]:

Comment 8 errata-xmlrpc 2015-11-19 06:30:36 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://rhn.redhat.com/errata/RHBA-2015-2202.html


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