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] libxc: Question on kernel image unzipping

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] libxc: Question on kernel image unzipping
From: Gerd Hoffmann <kraxel@xxxxxxxxxx>
Date: Thu, 09 Jul 2009 16:03:43 +0200
Cc: Andreas Sommer <AndiDog@xxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 09 Jul 2009 07:04:23 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <C67BB4E8.F3DB%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: <C67BB4E8.F3DB%keir.fraser@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1b3pre) Gecko/20090513 Fedora/3.0-2.3.beta2.fc11 Lightning/1.0pre Thunderbird/3.0b2
On 07/09/09 15:53, Keir Fraser wrote:
On 09/07/2009 13:34, "Andreas Sommer"<AndiDog@xxxxxx>  wrote:

libxc contains the following function which is used when uncompressing zipped
kernel images:
size_t xc_dom_check_gzip(void *blob, size_t ziplen)
{
     ...
     return unziplen + 16;
}
The returned unziplen+16 is used for the size of the destination buffer given
to inflate. But it is then also written to the kernel_size attribute of the
xc_dom_image struct. Hence kernel_size does not contain the uncompressed
kernel size but that plus 16.
So why do you always add 16 bytes to the real uncompressed kernel size?? That
doesn't make much sense to me but I need to know it because it is related to
my current work.

Gerd Hoffman would be the person to ask. The +16 doesn't appear to me to
have any purpose.

Oh, has been quite a while. IIRC that is related to zlib needing some extra space. So I *think* you can drop it there to get a correct kernel_size, but then you'll have to care somewhere else (probably when allocating the unzip target buffer) about the 16 extra bytes to make sure zlib doesn't overrun the buffer.

But better double-check that ...

cheers,
  Gerd

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

<Prev in Thread] Current Thread [Next in Thread>