Skip to contentSkip to conversation

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

PATCH In review Julien Grall 2 participants 2 messages Apr 30, 2020 – May 1, 2020

lore
Share & tools
lore
#0 lore raw

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

From: Julien Grall <[email protected]>

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 aa67b97ed342 ("xl.conf: Add global affinity masks")
---
 tools/xl/xl_vcpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/xl/xl_vcpu.c +1 -1
index 9ff5354f749b..66877a57dee4 100644
@@ -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)) {
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Julien Grall

From: Julien Grall <[email protected]>

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.

Quoted 7 lines

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 aa67b97ed342 ("xl.conf: Add global affinity masks")
Quoted 20 lines
---
 tools/xl/xl_vcpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/xl/xl_vcpu.c +1 -1
index 9ff5354f749b..66877a57dee4 100644
@@ -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)) {
Signature · 1 line
2.17.1