libvirt reporting incorrect value of 4k (small) pages

Bug #1811870 reported by Stephen Finucane
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Won't Fix
High
Stephen Finucane

Bug Description

libvirt < 4.3.0 had an issue whereby assigning more than 4 GB of huge pages would result in an incorrect value for the number of 4k (small) pages. This was tracked and fixed via rhbz#1569678 and the fixes appear to have been backported to the libvirt versions for RHEL 7.4+. However, this is still an issue with the versions of libvirt available on Ubuntu 16.04, 18.04 and who knows what else. We should either alert the user that the bug exists or, better again, work around the issue using the rest of the (correct) values for different page sizes.

# Incorrect value (Ubuntu 16.04, libvirt 4.0.0)

$ virsh capabilities | xmllint --xpath /capabilities/host/topology/cells/cell[1] -
<cell id="0">
  <memory unit="KiB">16298528</memory>
  <pages unit="KiB" size="4">3075208</pages>
  <pages unit="KiB" size="2048">4000</pages>
  <pages unit="KiB" size="1048576">0</pages>
  ...
</cell>

(3075208 * 4) + (4000 * 2048) != 16298528

# Correct values (Fedora ??, libvirt 4.10)

$ virsh capabilities | xmllint --xpath /capabilities/host/topology/cells/cell[1] -
<cell id='0'>
  <memory unit='KiB'>32359908</memory>
  <pages unit='KiB' size='4'>8038777</pages>
  <pages unit='KiB' size='2048'>100</pages>
  <pages unit='KiB' size='1048576'>0</pages>
  ...
</cell>

(8038777 * 4) + (100 * 2048) == 32359908

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1569678

Tags: libvirt
description: updated
Changed in nova:
assignee: nobody → Stephen Finucane (stephenfinucane)
status: New → In Progress
Revision history for this message
sean mooney (sean-k-mooney) wrote :

setting this to high as while people generally dont use expcit small pages this was
considerd sevear enough to include in a redhat security update for libvirt.

https://www.redhat.com/archives/rhsa-announce/2018-June/msg00038.html

there is no cve related to this to my knoladge and the issue has been public on the
libivrt side for some time so i dont think this should be treated as an openstack seurity bug
since we also already have patches available for public review and have been discussing this as
part of code review for another bug.

i have confirmed this locally on ubuntu 18.04 and stephen has reported it on 16.04

i have also seen this on centos 7 in the past but it is now fixed.

<memory unit='KiB'>8388060</memory>
          <pages unit='KiB' size='4'>1329015</pages>
          <pages unit='KiB' size='2048'>1500</pages>

(8388060-(1500*2048))/4=1329015

once you allocate more then 4G of hugepages we would expect to triger the
overfow.
<memory unit='KiB'>8388060</memory>
          <pages unit='KiB' size='4'>1021815</pages>
          <pages unit='KiB' size='2048'>2100</pages>
          <pages unit='KiB' size='1048576'>0</pages>

on centos7 with libvirt 3.9.0-14.el7_5.8 this does not happen but on ubunu the overflow is observed.

even with that backport however there could still be unpatch centos 7 systems
and it is not clear that suse or oracle linux would have simlarly backported this so i
think this should be "fixed" in nova even though the root case is a libvirt bug.

Changed in nova:
importance: Undecided → High
status: In Progress → Confirmed
tags: added: libvirt
Changed in nova:
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (stable/ussuri)

Fix proposed to branch: stable/ussuri
Review: https://review.opendev.org/757524

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (master)

Change abandoned by Stephen Finucane (<email address hidden>) on branch: master
Review: https://review.opendev.org/631038
Reason: No longer applies to master. Stable-only change proposed at https://review.opendev.org/#/c/757524/

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on nova (stable/ussuri)

Change abandoned by "Stephen Finucane <email address hidden>" on branch: stable/ussuri
Review: https://review.opendev.org/c/openstack/nova/+/757524

Changed in nova:
status: In Progress → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.