This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] [PATCH] xc_domain_getinfo should zero info struct; can leave

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] xc_domain_getinfo should zero info struct; can leave crashed flag set otherwise
From: Josh Triplett <josht@xxxxxxxxxx>
Date: Mon, 20 Jun 2005 13:32:23 -0700
Delivery-date: Mon, 20 Jun 2005 20:32:20 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1
The xc_domain_getinfo does not clear the info structure before filling it in, and in some circumstances it doesn't completely fill in the structure for each domain. In particular, it sets the crashed flag if the domain has crashed, but does not clear it if the domain has not crashed, so the crashed flag may be random stack garbage from the calling program. With the attached patch (against the latest nightly), xc_domain_getinfo zeroes the array of info structures before filling them in.

Signed-off-by: Josh Triplett <josht@xxxxxxxxxx>

- Josh Triplett
diff -Nur xen-unstable.orig/tools/libxc/xc_domain.c 
--- xen-unstable.orig/tools/libxc/xc_domain.c   2005-06-12 20:13:42.000000000 
+++ xen-unstable/tools/libxc/xc_domain.c        2005-06-15 18:31:24.000000000 
@@ -77,6 +77,8 @@
     dom0_op_t op;
     int rc = 0; 
+    memset(info, 0, max_doms*sizeof(xc_dominfo_t));
     for ( nr_doms = 0; nr_doms < max_doms; nr_doms++ )
         op.cmd = DOM0_GETDOMAININFO;
Xen-devel mailing list
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] xc_domain_getinfo should zero info struct; can leave crashed flag set otherwise, Josh Triplett <=