Skip to contentSkip to conversation

Fix infinite loop in xenconsoled

PATCH In review Kouya Shimura 2 participants 2 messages Aug 14, 2007

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix infinite loop in xenconsoled

xenconsoled hungs when domid=(DOMID_FIRST_RESERVED-1). (i.e. domid + 1 == DOMID_SELF)
Attached patch fixes it.

Thanks,
Kouya

tools/console/daemon/io.c +2 -0
diff -r 7953164cebb6 tools/console/daemon/io.c
@@ -569,6 +569,8 @@ void enum_domains(void)
 				create_domain(dominfo.domid);
 		}
 		domid = dominfo.domid + 1;
+		if (domid >= DOMID_FIRST_RESERVED)
+			break;
 	}
 }
 
tools/libxc/xc_domain.c +4 -0
diff -r 7953164cebb6 tools/libxc/xc_domain.c
@@ -205,6 +205,10 @@ int xc_domain_getinfo(int xc_handle,
                sizeof(xen_domain_handle_t));
 
         next_domid = (uint16_t)domctl.domain + 1;
+        if (next_domid >= DOMID_FIRST_RESERVED) {
+            nr_doms++;
+            break;
+        }
         info++;
     }
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#1 lore raw

Wow, that's nasty. The better fix is just not to have getdomaininfo() recognise DOMID_SELF. No good can come of it and noone relies on it, I'm certain. This was introduced by c/s 8394 but there's never been a user in the tree.

That's the fix I'll apply to -unstable.

Thanks for tracking this one down!

-- Keir

Quoted 39 lines · Kouya Shimura

xenconsoled hungs when domid=(DOMID_FIRST_RESERVED-1). (i.e. domid + 1 == DOMID_SELF)
Attached patch fixes it.

Thanks,
Kouya

diff -r 7953164cebb6 tools/console/daemon/io.c

tools/console/daemon/io.c Tue Aug 14 15:36:23 2007 +0900 renamed from tools/console/daemon/io.c Tue Aug 07 09:07:29 2007 +0100 +2 -0
@@ -569,6 +569,8 @@ void enum_domains(void)
 create_domain(dominfo.domid);
 }
 domid = dominfo.domid + 1;
+  if (domid >= DOMID_FIRST_RESERVED)
+   break;
 }
 }
 

diff -r 7953164cebb6 tools/libxc/xc_domain.c

tools/libxc/xc_domain.c Tue Aug 14 15:36:23 2007 +0900 renamed from tools/libxc/xc_domain.c Tue Aug 07 09:07:29 2007 +0100 +4 -0
@@ -205,6 +205,10 @@ int xc_domain_getinfo(int xc_handle,
                sizeof(xen_domain_handle_t));
 
         next_domid = (uint16_t)domctl.domain + 1;
+        if (next_domid >= DOMID_FIRST_RESERVED) {
+            nr_doms++;
+            break;
+        }
         info++;
     }
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel