From: Mukesh Rathor Subject: Re: [PATCH] libxc: failure to save/restore 32bit HVM guest Date: Wed, 25 Nov 2009 11:16:32 -0800 Message-ID: <20091125111632.3ef4a439@mantra.us.oracle.com> References: <20091124112348.7542f11d@mantra.us.oracle.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/r3GaOjII=EnU5=3HaGVRQfA" Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: "Xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org --MP_/r3GaOjII=EnU5=3HaGVRQfA Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline On Tue, 24 Nov 2009 19:58:48 +0000 Keir Fraser wrote: > On 24/11/2009 19:23, "Mukesh Rathor" 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 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; --MP_/r3GaOjII=EnU5=3HaGVRQfA Content-Type: application/octet-stream; name=diff.out Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename=diff.out ZGlmZiAtciBjOGNhYTI4MWE3NWEgdG9vbHMvbGlieGMveGNfY29yZS5jCi0tLSBhL3Rvb2xzL2xp YnhjL3hjX2NvcmUuYwlNb24gTm92IDIzIDA4OjA2OjU0IDIwMDkgKzAwMDAKKysrIGIvdG9vbHMv bGlieGMveGNfY29yZS5jCVdlZCBOb3YgMjUgMTE6MTU6MjAgMjAwOSAtMDgwMApAQCAtNjI4LDEw ICs2MjgsMTAgQEAKICAgICAgICAgUEVSUk9SKCJDb3VsZCBub3QgZ2V0IHNlY3Rpb24gaGVhZGVy IGZvciAueGVuX3Byc3RhdHVzIik7CiAgICAgICAgIGdvdG8gb3V0OwogICAgIH0KLSAgICBmaWxl c3ogPSBzaXplb2YoY3R4dFswXS5jKSAqIG5yX3ZjcHVzOworICAgIGZpbGVzeiA9IHNpemVvZigq Y3R4dCkgKiBucl92Y3B1czsKICAgICBzdHMgPSB4Y19jb3JlX3NoZHJfc2V0KHNoZHIsIHN0cnRh YiwgWEVOX0RVTVBDT1JFX1NFQ19QUlNUQVRVUywKICAgICAgICAgICAgICAgICAgICAgICAgICAg IFNIVF9QUk9HQklUUywgb2Zmc2V0LCBmaWxlc3osCi0gICAgICAgICAgICAgICAgICAgICAgICAg ICBfX2FsaWdub2ZfXyhjdHh0WzBdLmMpLCBzaXplb2YoY3R4dFswXS5jKSk7CisgICAgICAgICAg ICAgICAgICAgICAgICAgICBfX2FsaWdub2ZfXyhjdHh0WzBdLmMpLCBzaXplb2YoKmN0eHQpKTsK ICAgICBpZiAoIHN0cyAhPSAwICkKICAgICAgICAgZ290byBvdXQ7CiAgICAgb2Zmc2V0ICs9IGZp bGVzejsKQEAgLTc1NSw3ICs3NTUsNyBAQAogICAgICAgICBnb3RvIG91dDsKIAogICAgIC8qIHBy c3RhdHVzOiAueGVuX3Byc3RhdHVzICovCi0gICAgc3RzID0gZHVtcF9ydG4oYXJncywgKGNoYXIg KikmY3R4dFswXS5jLCBzaXplb2YoY3R4dFswXS5jKSAqIG5yX3ZjcHVzKTsKKyAgICBzdHMgPSBk dW1wX3J0bihhcmdzLCAoY2hhciAqKSZjdHh0WzBdLmMsIHNpemVvZigqY3R4dCkgKiBucl92Y3B1 cyk7CiAgICAgaWYgKCBzdHMgIT0gMCApCiAgICAgICAgIGdvdG8gb3V0OwogCg== --MP_/r3GaOjII=EnU5=3HaGVRQfA 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 --MP_/r3GaOjII=EnU5=3HaGVRQfA--