From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:56485) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4r6P-000808-2M for qemu-devel@nongnu.org; Fri, 24 Aug 2012 06:27:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1T4r6N-0004pi-VK for qemu-devel@nongnu.org; Fri, 24 Aug 2012 06:26:57 -0400 Received: from smtp02.citrix.com ([66.165.176.63]:39251) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T4r6N-0004pd-QU for qemu-devel@nongnu.org; Fri, 24 Aug 2012 06:26:55 -0400 Message-ID: <50375721.7080503@citrix.com> Date: Fri, 24 Aug 2012 11:27:45 +0100 From: Julien Grall MIME-Version: 1.0 References: <1345728471.12501.90.camel@zakaz.uk.xensource.com> <503680C5.6070509@citrix.com> <1345751525.23624.58.camel@dagon.hellion.org.uk> In-Reply-To: <1345751525.23624.58.camel@dagon.hellion.org.uk> Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [Xen-devel] [XEN][RFC PATCH V2 11/17] xc: modify save/restore to support multiple device models List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ian Campbell Cc: "christian.limpach@gmail.com" , "xen-devel@lists.xen.org" , "qemu-devel@nongnu.org" , Stefano Stabellini On 08/23/2012 08:52 PM, Ian Campbell wrote: > On Thu, 2012-08-23 at 20:13 +0100, Julien Grall wrote: > >> On 08/23/2012 02:27 PM, Ian Campbell wrote: >> >>> >>>> @@ -103,6 +103,9 @@ static ssize_t rdexact(xc_interface *xch, struct restore_ctx *ctx, >>>> #else >>>> #define RDEXACT read_exact >>>> #endif >>>> + >>>> +#define QEMUSIG_SIZE 21 >>>> + >>>> /* >>>> ** In the state file (or during transfer), all page-table pages are >>>> ** converted into a 'canonical' form where references to actual mfns >>>> @@ -467,7 +522,7 @@ static int buffer_tail_hvm(xc_interface *xch, struct restore_ctx *ctx, >>>> int vcpuextstate, uint32_t vcpuextstate_size) >>>> { >>>> uint8_t *tmp; >>>> - unsigned char qemusig[21]; >>>> + unsigned char qemusig[QEMUSIG_SIZE + 1]; >>>> >>>> >>> An extra + 1 here? >>> >>> >> QEMUSIG_SIZE doesn't take into account the '\0'. So we need to add 1. >> If an error occurred, without +1, the output log lost the last character. >> > So this is just a bug fix for a pre-existing issue? > Yes. >>> [...] >>> >>> >>>> - qemusig[20] = '\0'; >>>> + qemusig[QEMUSIG_SIZE] = '\0'; >>>> >>>> >>> This is one bigger than it used to be now. >>> >>> Perhaps this is an unrelated bug fix (I haven't check the real length of >>> the sig), in which case please can you split it out and submit >>> separately? >>> >>> >> #define QEMU_SIGNATURE "DeviceModelRecord0002" >> Just checked, the length seems to be 21. I will send a patch with >> this change. >> > Perhaps use either sizeof(QEMU_SIGNATURE) or strlen(QEMU_SIGNATURE) > (depending on which semantics you want)? > Here, QEMU_SIZE needs to be define as strlen (QEMU_SIGNATURE), but QEMU_SIGNATURE is not defined in libxc. It's defined in libxl/libxl_internal.h. By the way, I'm wondering why QEMU save (libxl__domain_save_device_model) is made in libxl and restore (dump_qemu) in libxc ?