Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:Update
xen.15652
5b8fb5af-tools-xl-refuse-to-set-number-of-vcpus...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 5b8fb5af-tools-xl-refuse-to-set-number-of-vcpus-to-0-via-xl-vcpu-set.patch of Package xen.15652
Subject: tools/xl: refuse to set number of vcpus to 0 via xl vcpu-set From: Juergen Gross jgross@suse.com Mon Sep 3 14:59:42 2018 +0200 Date: Wed Sep 5 11:53:35 2018 +0100: Git: 2c0b1824b1cb33a2610f3f55299247f9e0464466 Trying to set the number of vcpus of a domain to 0 isn't refused. We should not allow that. Signed-off-by: Juergen Gross <jgross@suse.com> Acked-by: Wei Liu <wei.liu2@citrix.com> Signed-off-by: Wei Liu <wei.liu2@citrix.com> Index: xen-4.11.2-testing/tools/libxl/libxl_domain.c =================================================================== --- xen-4.11.2-testing.orig/tools/libxl/libxl_domain.c +++ xen-4.11.2-testing/tools/libxl/libxl_domain.c @@ -1369,6 +1369,12 @@ int libxl_set_vcpuonline(libxl_ctx *ctx, } maxcpus = libxl_bitmap_count_set(cpumap); + if (maxcpus == 0) + { + LOGED(ERROR, domid, "Requested 0 VCPUs!"); + rc = ERROR_FAIL; + goto out; + } if (maxcpus > info.vcpu_max_id + 1) { LOGED(ERROR, domid, "Requested %d VCPUs, however maxcpus is %d!", Index: xen-4.11.2-testing/tools/xl/xl_vcpu.c =================================================================== --- xen-4.11.2-testing.orig/tools/xl/xl_vcpu.c +++ xen-4.11.2-testing/tools/xl/xl_vcpu.c @@ -13,6 +13,7 @@ */ #include <stdlib.h> +#include <limits.h> #include <libxl.h> #include <libxl_utils.h> @@ -327,13 +328,14 @@ int main_vcpupin(int argc, char **argv) static int vcpuset(uint32_t domid, const char* nr_vcpus, int check_host) { char *endptr; - unsigned int max_vcpus, i; + unsigned int i; + unsigned long max_vcpus; libxl_bitmap cpumap; int rc; libxl_bitmap_init(&cpumap); max_vcpus = strtoul(nr_vcpus, &endptr, 10); - if (nr_vcpus == endptr) { + if (nr_vcpus == endptr || max_vcpus > INT_MAX) { fprintf(stderr, "Error: Invalid argument.\n"); return 1; } @@ -354,7 +356,7 @@ static int vcpuset(uint32_t domid, const if (max_vcpus > online_vcpus && max_vcpus > host_cpu) { fprintf(stderr, "You are overcommmitting! You have %d physical" \ - " CPUs and want %d vCPUs! Aborting, use --ignore-host to" \ + " CPUs and want %ld vCPUs! Aborting, use --ignore-host to" \ " continue\n", host_cpu, max_vcpus); return 1; } @@ -371,7 +373,7 @@ static int vcpuset(uint32_t domid, const if (rc == ERROR_DOMAIN_NOTFOUND) fprintf(stderr, "Domain %u does not exist.\n", domid); else if (rc) - fprintf(stderr, "libxl_set_vcpuonline failed domid=%u max_vcpus=%d," \ + fprintf(stderr, "libxl_set_vcpuonline failed domid=%u max_vcpus=%ld," \ " rc: %d\n", domid, max_vcpus, rc); libxl_bitmap_dispose(&cpumap);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor