From mboxrd@z Thu Jan 1 00:00:00 1970 From: Josh Triplett Subject: [PATCH] xc_domain_getinfo should zero info struct; can leave crashed flag set otherwise Date: Mon, 20 Jun 2005 13:32:23 -0700 Message-ID: <42B727D7.7080501@us.ibm.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050401010201070109000009" Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------050401010201070109000009 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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 - Josh Triplett --------------050401010201070109000009 Content-Type: text/x-patch; name="libxc-zero-domain-info-struct.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="libxc-zero-domain-info-struct.patch" diff -Nur xen-unstable.orig/tools/libxc/xc_domain.c xen-unstable/tools/libxc/xc_domain.c --- xen-unstable.orig/tools/libxc/xc_domain.c 2005-06-12 20:13:42.000000000 -0700 +++ xen-unstable/tools/libxc/xc_domain.c 2005-06-15 18:31:24.000000000 -0700 @@ -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; --------------050401010201070109000009 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------050401010201070109000009--