tools/xl: vcpu-pin: Skip global affinity when the hard affinity is not changed

After XSA-273, it is not possible to modify the vCPU soft affinity using
xl vcpu-pin without modifying the hard affinity. Instead the command
will crash.

42sh> gdb /usr/local/sbin/xl
(gdb) r vcpu-pin 0 0 - 10
[...]
Program received signal SIGSEGV, Segmentation fault.
[...]
(gdb) bt

This is happening because 'xl' will use NULL when an affinity doesn't
need to be modified. However, we will still try to apply the global
affinity in the this case.

As the hard affinity is not changed, then we don't need to apply the
global affinity. So skip it when hard is NULL.

Backport: 4.6+ # Any release with XSA-273
Fixes: aa67b97ed3 ("xl.conf: Add global affinity masks")
Reported-by: Pawel Wieczorkiewicz <wipawel@amazon.de>
Signed-off-by: Julien Grall <jgrall@amazon.com>
Acked-by: Wei Liu <wl@xen.org>
This commit is contained in:
Julien Grall committed 2020-05-11 10:18:22 +01:00
1 parent 190c60f12d
commit 3748c81fa1
1 file changed
+1 -1
+1 -1
View File
@@ -283,7 +283,7 @@ int main_vcpupin(int argc, char **argv)
}
/* Only hard affinity matters here */
if (!ignore_masks) {
if (!ignore_masks && hard) {
libxl_dominfo dominfo;
if (libxl_domain_info(ctx, &dominfo, domid)) {
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.