[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] libxc: xc_dom_parse_elf_kernel: Return error for invalid kernel images
commit 37f1a96888f6022872213428cdc24060700aa9ba Author: Simon Gaiser <simon@xxxxxxxxxxxxxxxxxxxxxx> AuthorDate: Thu Feb 8 22:49:10 2018 +0100 Commit: Wei Liu <wei.liu2@xxxxxxxxxx> CommitDate: Tue Feb 13 11:48:43 2018 +0000 libxc: xc_dom_parse_elf_kernel: Return error for invalid kernel images Commit 96edb111dd ("libxc: panic when trying to create a PVH guest without kernel support") already improved the handling of non PVH capable kernels. But xc_dom_parse_elf_kernel() still returned success on invalid elf images and the domain build only failed later. Now the build process will fail immediately on detecting the error. Signed-off-by: Simon Gaiser <simon@xxxxxxxxxxxxxxxxxxxxxx> Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> --- tools/libxc/xc_dom_elfloader.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/libxc/xc_dom_elfloader.c b/tools/libxc/xc_dom_elfloader.c index c936f92..26b2846 100644 --- a/tools/libxc/xc_dom_elfloader.c +++ b/tools/libxc/xc_dom_elfloader.c @@ -64,7 +64,7 @@ static char *xc_dom_guest_type(struct xc_dom_image *dom, xc_dom_panic(dom->xch, XC_INVALID_KERNEL, "%s: image not capable of booting inside a HVM container", __FUNCTION__); - return "xen-3.0-unknown"; + return NULL; } switch ( machine ) @@ -86,7 +86,10 @@ static char *xc_dom_guest_type(struct xc_dom_image *dom, case EM_X86_64: return "xen-3.0-x86_64"; default: - return "xen-3.0-unknown"; + xc_dom_panic(dom->xch, XC_INVALID_KERNEL, + "%s: unkown image type %"PRIu64, + __FUNCTION__, machine); + return NULL; } } @@ -192,6 +195,8 @@ static elf_negerrnoval xc_dom_parse_elf_kernel(struct xc_dom_image *dom) dom->kernel_seg.vend = dom->parms.virt_kend; dom->guest_type = xc_dom_guest_type(dom, elf); + if ( dom->guest_type == NULL ) + return -EINVAL; DOMPRINTF("%s: %s: 0x%" PRIx64 " -> 0x%" PRIx64 "", __FUNCTION__, dom->guest_type, dom->kernel_seg.vstart, dom->kernel_seg.vend); -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |