Bug 1155843 - Expose error when parsing wrong size and unit for shmem device
Summary: Expose error when parsing wrong size and unit for shmem device
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.1
Hardware: x86_64
OS: Linux
low
low
Target Milestone: rc
: ---
Assignee: Martin Kletzander
QA Contact: Virtualization Bugs
URL:
Whiteboard:
: 1160239 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-23 02:28 UTC by Jincheng Miao
Modified: 2015-11-19 05:54 UTC (History)
6 users (show)

Fixed In Version: libvirt-1.2.13-1.el7
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-19 05:54:20 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 Jincheng Miao 2014-10-23 02:28:27 UTC
Description of problem:
Libvirtd should expose the error message when the user passed wrong
size and unit for <shmem> element.

version:
libvirt-1.2.8-5.el7.x86_64
upstream qemu v2.1.0-1124-gb1d28ec

How reproducible:
100%

Step to reproduce:
1. config shmem with negative size in guest
# virsh edit r7
...
   <devices>
     ...
     <shmem name='shmem0'>
       <size unit='M'>-1</size>
     </shmem>
   </devices>
...

2. although edit pass, some error is recorded in log:
2014-10-21 08:45:28.853+0000: 26945: error : virScaleInteger:334 : 
numerical overflow: value too large: 18446744073709551615M

Expect results:
shmem's size doesn't accept negative value, and
the error message should be prompted in step 1.

Comment 1 Martin Kletzander 2014-10-30 07:50:13 UTC
Fixed upstream by v1.2.10-rc1-19-g6c9a8a4:

commit 6c9a8a49c796f025f097a2cddb94116403296af1
Author: Martin Kletzander <mkletzan@redhat.com>
Date:   Wed Oct 29 17:29:40 2014 +0100

    conf: forbid negative values in virDomainParseScaledValue

Comment 2 Martin Kletzander 2014-11-04 13:12:55 UTC
*** Bug 1160239 has been marked as a duplicate of this bug. ***

Comment 4 Luyao Huang 2015-05-12 04:00:43 UTC
I can reproduce this issue with libvirt-1.2.8-16.el7.x86_64:

1. add invalid xml in guest:

# virsh edit test3

     <shmem name='shmem0'>
       <size unit='M'>-1</size>
     </shmem>

Domain test3 XML configuration edited.


2. check the log in libvirtd.log:

2015-05-12 03:56:11.699+0000: 16181: error : virScaleInteger:334 : numerical overflow: value too large: 18446744073709551615M

And verify this bug with libvirt-1.2.15-1.el7.x86_64:

1. try to add the same xml in guest:

# virsh edit test3

     <shmem name='shmem0'>
       <size unit='M'>-1</size>
     </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

Failed. Try again? [y,n,i,f,?]: 
error: XML error: Invalid value '-1' for element or attribute './size[1]'
Failed. Try again? [y,n,f,?]:

Comment 7 errata-xmlrpc 2015-11-19 05:54:20 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.