On 9/18/23 19:16, Jim Fehlig wrote: > When Domain-0 autoballooning is enabled, it's possible that memory may > need to be ballooned down in Domain-0 to accommodate the needs of another > virtual machine. libxlDomainFreeMemory handles this task, but due to a > logic bug is underflowing the variable containing Domain-0 new > target memory. The resulting huge numbers are filtered by > libxlSetMemoryTargetWrapper and memory is not changed. > > Under the covers, libxlDomainFreeMemory uses Xen's libxl_set_memory_target > API, which includes a 'relative' parameter for specifying how to set the > target. If true, the target is an increment/decrement value over the > current memory, otherwise target is taken as an absolute value. > libxlDomainFreeMemory sets 'relative' to true, but never allows for > negative values by declaring the target memory variable as an unsigned. > Fix by declaring the variable as signed, which also requried adjusting > libxlSetMemoryTargetWrapper. > > Signed-off-by: Jim Fehlig <jfehlig@xxxxxxxx> > --- > src/libxl/libxl_api_wrapper.h | 16 ++++++---------- > src/libxl/libxl_domain.c | 2 +- > 2 files changed, 7 insertions(+), 11 deletions(-) Reviewed-by: Michal Privoznik <mprivozn@xxxxxxxxxx> Michal