We lost several production VMs during an in-place QEMU update. Each had
its guest memory bound to a host node with host-nodes. The new QEMU
re-ran mbind() on the inherited RAM, got EINVAL and exited, taking the
guest with it. The likely trigger is the host's memory manager moving
the emulator cgroup's cpuset.mems to other nodes while the VMs ran;
doing exactly that reproduces the failure.

Patch 1 stops the new QEMU from rebinding and preallocating memory it
inherited over CPR. Patch 2 adds a qtest that reproduces the failure
without root: the exec'd QEMU asks for a host node mbind() rejects,
which is what a narrowed cpuset looks like to it.

Tested with migration-test on x86_64: mode/exec/numa fails without
patch 1 and passes with it, the rest of the suite passes. A standalone
reproducer that moves a real cgroup v2 cpuset.mems between nodes while
the VM runs shows the same before and after on a four-node host.

Signed-off-by: Denis V. Lunev <[email protected]>
Cc: David Hildenbrand <[email protected]>
Cc: Igor Mammedov <[email protected]>
Cc: "Maciej S. Szmigiero" <[email protected]>
Cc: Peter Xu <[email protected]>
Cc: Fabiano Rosas <[email protected]>
Cc: Mark Kanda <[email protected]>
Cc: Ben Chaney <[email protected]>
Cc: Steve Sistare <[email protected]>
Cc: Andrey Drobyshev <[email protected]>

Denis V. Lunev (2):
  hostmem: fix cpr-exec of VMs with bound guest memory
  tests/qtest/migration: add a cpr-exec test for bound guest memory

 backends/hostmem.c                |  5 ++++
 tests/qtest/migration/cpr-tests.c | 38 ++++++++++++++++++++++++++++---
 2 files changed, 40 insertions(+), 3 deletions(-)


base-commit: 942229961efea74b153c44c59188eb08375f10f1
-- 
2.53.0


Reply via email to