xen/23574-x86-dom0-compressed-ELF.patch
Charles Arnold ed105f0f54 - fate#309894: Xen needs to correctly understand family 15h CPU
topology 
- fate#311376: EFI support in SP2
- fate#311529: Native UEFI booting under Xen (installation)
  23074-pfn.h.patch
  23571-vtd-fault-verbosity.patch
  23574-x86-dom0-compressed-ELF.patch
  23575-x86-DMI.patch
  23610-x86-topology-info.patch
  23611-amd-fam15-topology.patch
  23613-EFI-headers.patch
  23614-x86_64-EFI-boot.patch
  23615-x86_64-EFI-runtime.patch
  23616-x86_64-EFI-MPS.patch

- Mark xen-scsi.ko supported (bnc#582265, fate#309459).

- fate#310308: Hypervisor assisted watchdog driver 
  ioemu-watchdog-support.patch
  ioemu-watchdog-linkage.patch
  ioemu-watchdog-ib700-timer.patch
  tools-watchdog-support.patch

- bnc#702025 - VUL-0: xen: VT-d (PCI passthrough) MSI trap 
  injection  (CVE-2011-1898)
  Fixed in Xen version 4.1.1

- fate#310956: Support Direct Kernel Boot for FV guests
  kernel-boot-hvm.patch

OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=130
2011-07-01 19:31:25 +00:00

124 lines
3.9 KiB
Diff

References: fate#311376, fate#311529, bnc#578927, bnc#628554
# HG changeset patch
# User Jan Beulich <jbeulich@novell.com>
# Date 1308825237 -3600
# Node ID d7644abc218d3232b9d957ce94fc4b4bcc1f456e
# Parent 584c2e5e03d96f912cdfe90f8e9f910d5d661706
x86: allow Dom0 image to be compressed ELF
Rather than being able to decompress only the payloads of bzImage
containers, extend the logic to also decompress simple compressed ELF
images. At once, allow uncompressed bzImage payloads.
This is a prerequisite for native EFI booting support (where, in the
absence of a capable secondary boot loader, the image will always be
in compressed form).
Signed-off-by: Jan Beulich <jbeulich@novell.com>
--- a/xen/arch/x86/bzimage.c
+++ b/xen/arch/x86/bzimage.c
@@ -5,6 +5,7 @@
#include <xen/string.h>
#include <xen/types.h>
#include <xen/decompress.h>
+#include <xen/libelf.h>
#include <asm/bzimage.h>
#define HEAPORDER 3
@@ -199,25 +200,36 @@ static __init int bzimage_check(struct s
return 1;
}
-int __init bzimage_headroom(char *image_start, unsigned long image_length)
+static unsigned long __initdata orig_image_len;
+
+unsigned long __init bzimage_headroom(char *image_start,
+ unsigned long image_length)
{
struct setup_header *hdr = (struct setup_header *)image_start;
- char *img;
- int err, headroom;
+ int err;
+ unsigned long headroom;
err = bzimage_check(hdr, image_length);
- if (err < 1)
+ if ( err < 0 )
return 0;
- img = image_start + (hdr->setup_sects+1) * 512;
- img += hdr->payload_offset;
+ if ( err > 0 )
+ {
+ image_start += (hdr->setup_sects + 1) * 512 + hdr->payload_offset;
+ image_length = hdr->payload_length;
+ }
+
+ if ( elf_is_elfbinary(image_start) )
+ return 0;
- headroom = output_length(img, hdr->payload_length);
- if (gzip_check(img, hdr->payload_length)) {
+ orig_image_len = image_length;
+ headroom = output_length(image_start, image_length);
+ if (gzip_check(image_start, image_length))
+ {
headroom += headroom >> 12; /* Add 8 bytes for every 32K input block */
headroom += (32768 + 18); /* Add 32K + 18 bytes of extra headroom */
} else
- headroom += hdr->payload_length;
+ headroom += image_length;
headroom = (headroom + 4095) & ~4095;
return headroom;
@@ -229,18 +241,24 @@ int __init bzimage_parse(char *image_bas
int err = bzimage_check(hdr, *image_len);
unsigned long output_len;
- if (err < 1)
+ if ( err < 0 )
return err;
+ if ( err > 0 )
+ {
+ *image_start += (hdr->setup_sects + 1) * 512 + hdr->payload_offset;
+ *image_len = hdr->payload_length;
+ }
+
+ if ( elf_is_elfbinary(*image_start) )
+ return 0;
+
BUG_ON(!(image_base < *image_start));
- *image_start += (hdr->setup_sects+1) * 512;
- *image_start += hdr->payload_offset;
- *image_len = hdr->payload_length;
- output_len = output_length(*image_start, *image_len);
+ output_len = output_length(*image_start, orig_image_len);
- if ( (err = perform_gunzip(image_base, *image_start, *image_len)) > 0 )
- err = decompress(*image_start, *image_len, image_base);
+ if ( (err = perform_gunzip(image_base, *image_start, orig_image_len)) > 0 )
+ err = decompress(*image_start, orig_image_len, image_base);
if ( !err )
{
--- a/xen/include/asm-x86/bzimage.h
+++ b/xen/include/asm-x86/bzimage.h
@@ -4,10 +4,9 @@
#include <xen/config.h>
#include <xen/init.h>
-int __init bzimage_headroom(char *image_start, unsigned long image_length);
+unsigned long bzimage_headroom(char *image_start, unsigned long image_length);
-int __init bzimage_parse(char *image_base,
- char **image_start,
- unsigned long *image_len);
+int bzimage_parse(char *image_base, char **image_start,
+ unsigned long *image_len);
#endif /* __X86_BZIMAGE_H__ */