WARNING - OLD ARCHIVES

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/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] libxc: failure to save/restore 32bit HVM guest

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] libxc: failure to save/restore 32bit HVM guest
From: Mukesh Rathor <mukesh.rathor@xxxxxxxxxx>
Date: Wed, 25 Nov 2009 11:16:32 -0800
Cc: "Xen-devel@xxxxxxxxxxxxxxxxxxx" <Xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 25 Nov 2009 11:20:51 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C731EB78.1865%keir.fraser@xxxxxxxxxxxxx>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <20091124112348.7542f11d@xxxxxxxxxxxxxxxxxxxx> <C731EB78.1865%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Tue, 24 Nov 2009 19:58:48 +0000
Keir Fraser <keir.fraser@xxxxxxxxxxxxx> wrote:

> On 24/11/2009 19:23, "Mukesh Rathor" <mukesh.rathor@xxxxxxxxxx> wrote:
> 
> > Anyways, since 32bit HVM returns 64bit contexts, it appears the way
> > it is, is buggy, since the sizeof(ctxt[0].c) will return 32bit
> > context size in 32 bit libxc. Infact, after making the fix, user is
> > able to get proper core of a Java HVM guest. Can you please quickly
> > explain why you think it's correct in such case?
> 
> Ah, maybe you are right after all. But shouldn't you change the last
> two arguments in the call:
>    sts = xc_core_shdr_set(shdr, strtab, XEN_DUMPCORE_SEC_PRSTATUS,
>                            SHT_PROGBITS, offset, filesz,
>                            __alignof__(ctxt[0].c), sizeof(ctxt[0].c));
> ...to reference *ctxt instead of ctxt[0].c, as well?
> 
> If you agree, send an updated patch and I'll apply it.
> 
>  -- Keir
> 

Yup, attached please find updated patch. I had the user test it out
also. Since, ctxt is a union, the penultimate argument should be fine.

thanks,
mukesh


Signed-off-by: Mukesh Rathor <mukesh.rathor@xxxxxxxxxx>

diff -r c8caa281a75a tools/libxc/xc_core.c
--- a/tools/libxc/xc_core.c     Mon Nov 23 08:06:54 2009 +0000
+++ b/tools/libxc/xc_core.c     Wed Nov 25 11:15:20 2009 -0800
@@ -628,10 +628,10 @@
         PERROR("Could not get section header for .xen_prstatus");
         goto out;
     }
-    filesz = sizeof(ctxt[0].c) * nr_vcpus;
+    filesz = sizeof(*ctxt) * nr_vcpus;
     sts = xc_core_shdr_set(shdr, strtab, XEN_DUMPCORE_SEC_PRSTATUS,
                            SHT_PROGBITS, offset, filesz,
-                           __alignof__(ctxt[0].c), sizeof(ctxt[0].c));
+                           __alignof__(ctxt[0].c), sizeof(*ctxt));
     if ( sts != 0 )
         goto out;
     offset += filesz;
@@ -755,7 +755,7 @@
         goto out;
 
     /* prstatus: .xen_prstatus */
-    sts = dump_rtn(args, (char *)&ctxt[0].c, sizeof(ctxt[0].c) * nr_vcpus);
+    sts = dump_rtn(args, (char *)&ctxt[0].c, sizeof(*ctxt) * nr_vcpus);
     if ( sts != 0 )
         goto out;
 

Attachment: diff.out
Description: Binary data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel