Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1511775 - Integer overflows when set video ram/vram to a value in range (2^31, 2^32)
Summary: Integer overflows when set video ram/vram to a value in range (2^31, 2^32)
Keywords:
Status: ASSIGNED
Alias: None
Product: Red Hat Enterprise Linux Advanced Virtualization
Classification: Red Hat
Component: libvirt
Version: 8.0
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: rc
: ---
Assignee: Pavel Hrdina
QA Contact: Lili Zhu
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-11-10 05:45 UTC by Fangge Jin
Modified: 2019-02-22 22:09 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)

Description Fangge Jin 2017-11-10 05:45:30 UTC
Description of problem:
Integer overflows when set video ram/vram to a value in range (2^31, 2^32)

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

How reproducible:
100%

Steps to Reproduce:
1. "virsh edit" the video ram/vram to a value in range (2^31, 2^32) and save, for example:
      <model type='qxl' ram='2147483649' vram='2147483649' vgamem='16384' heads='3' primary='yes'/>


2. Check ram/vram value in xml, they are changed to 65536:
# virsh dumpxml $guest | grep ram
      <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='3' primary='yes'/>


Actual results:
As step2

Expected results:
Report error when "virsh edit"&&"save". 
   error: numerical overflow: value for 'vram' must be less than or equal to '2097152'

Here, why the boundary value is 2097152(2^21) instead of 4194303(2^22-1) is because that a value more than 2097152(2^21) is invalid actually, as a non-power-of-2 value for ram/varm will be up-rounded by libvirt automatically.


Additional info:
1. When set ram/vram to a value in range (2^21, 2^31], it reports error:
   error: numerical overflow: value for 'vram' must be less than '4194303'

   This boundary value in this error message should be fixed too.

2. By the way, libvirt doesn't up-round the value for vgamem/vram64, this behaviour is not consistent with ram/vram



2097152=2^21
4194304=2^22
2147483648=2^31
4294967296=2^32


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