aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_dom_bzimageloader.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2013-10-07 09:42:51 +0200
committerJan Beulich <jbeulich@suse.com>2013-10-07 09:42:51 +0200
commit84f04d8f0dbfc24a48ee888011ca7410b7bbafc5 (patch)
tree8c4ea4483602a78ddc935cddfd82c525fe68dc7d /tools/libxc/xc_dom_bzimageloader.c
parente850049bbc831bfe40b87eaea673675d8a829e74 (diff)
downloadxen-84f04d8f0dbfc24a48ee888011ca7410b7bbafc5.tar.gz
xen-84f04d8f0dbfc24a48ee888011ca7410b7bbafc5.tar.bz2
xen-84f04d8f0dbfc24a48ee888011ca7410b7bbafc5.zip
libxc: add LZ4 decompression support
Since there's no shared or static library to link against, this simply re-uses the hypervisor side code. However, I only audited the code added here for possible security issues, not the referenced code in the hypervisor tree. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Acked-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxc/xc_dom_bzimageloader.c')
-rw-r--r--tools/libxc/xc_dom_bzimageloader.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/tools/libxc/xc_dom_bzimageloader.c b/tools/libxc/xc_dom_bzimageloader.c
index 3870c6d5f5..2225699b8a 100644
--- a/tools/libxc/xc_dom_bzimageloader.c
+++ b/tools/libxc/xc_dom_bzimageloader.c
@@ -33,7 +33,7 @@
#include <inttypes.h>
#include "xg_private.h"
-#include "xc_dom.h"
+#include "xc_dom_decompress.h"
#ifndef __MINIOS__
@@ -733,6 +733,17 @@ static int xc_dom_probe_bzimage_kernel(struct xc_dom_image *dom)
return -EINVAL;
}
}
+ else if ( check_magic(dom, "\x02\x21", 2) )
+ {
+ ret = xc_try_lz4_decode(dom, &dom->kernel_blob, &dom->kernel_size);
+ if ( ret < 0 )
+ {
+ xc_dom_panic(dom->xch, XC_INVALID_KERNEL,
+ "%s unable to LZ4 decompress kernel\n",
+ __FUNCTION__);
+ return -EINVAL;
+ }
+ }
else
{
xc_dom_panic(dom->xch, XC_INVALID_KERNEL,