aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxc/xc_dom_bzimageloader.c
Commit message (Collapse)AuthorAgeFilesLines
* libxc: add LZ4 decompression supportJan Beulich2013-10-071-1/+12
| | | | | | | | | | | 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>
* libxc: Add unsafe decompressorsBastian Blank2013-04-221-0/+11
| | | | | | | | | | | | | | | | | | | | Add decompressors based on hypervisor code. This are used in mini-os by pv-grub. This enables pv-grub to boot kernels compressed with e.g. xz, which are becoming more common. Signed-off-by: Bastian Blank <waldi@debian.org> Adjusted to use terminology "unsafe" rather than "trusted" to indicate that the user had better sanitise the data (or not care, as in stub domains) as suggested by Tim Deegan. This was effectively a sed script. Minimise the changes to hypervisor code by moving the "compat layer" into the relevant libxc source files (which include the Xen ones). Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
* Fix emacs local variable block to use correct C style variable.David Vrabel2013-02-211-1/+1
| | | | | | | The emacs variable to set the C style from a local variable block is c-file-style, not c-set-style. Signed-off-by: David Vrabel <david.vrabel@citrix.com
* libxc: builder: limit maximum size of kernel/ramdisk.Ian Jackson2012-10-261-4/+55
| | | | | | | | | | | | | | | | | | | | | | Allowing user supplied kernels of arbitrary sizes, especially during decompression, can swallow up dom0 memory leading to either virtual address space exhaustion in the builder process or allocation failures/OOM killing of both toolstack and unrelated processes. We disable these checks when building in a stub domain for pvgrub since this uses the guest's own memory and is isolated. Decompression of gzip compressed kernels and ramdisks has been safe since 14954:58205257517d (Xen 3.1.0 onwards). This is XSA-25 / CVE-2012-4544. Also make explicit checks for buffer overflows in various decompression routines. These were already ruled out due to other properties of the code but check them as a belt-and-braces measure. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
* Revert 26109:6ccfe4d29f95Ian Jackson2012-10-261-43/+4
| | | | | | | This changeset was contaminated by changes hanging around in my working tree. Sorry :-(. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* xl: Do not leak events when a domain exits.Ian Campbell2012-10-251-4/+43
| | | | | | | | | | | | | | | | | | | | | | | | The goto in both of these places misses the event free which would normally clean up. ==8655== 80 bytes in 1 blocks are definitely lost in loss record 1 of 1 ==8655== at 0x4024370: calloc (vg_replace_malloc.c:593) ==8655== by 0x406EAAE: libxl__zalloc (libxl_internal.c:83) ==8655== by 0x4078173: libxl__event_new (libxl_event.c:1167) ==8655== by 0x4056373: domain_death_occurred (libxl.c:958) ==8655== by 0x4058D06: domain_death_xswatch_callback (libxl.c:1038) ==8655== by 0x4078EB5: watchfd_callback (libxl_event.c:458) ==8655== by 0x407839E: afterpoll_internal (libxl_event.c:949) ==8655== by 0x4079142: eventloop_iteration (libxl_event.c:1371) ==8655== by 0x40799BB: libxl_event_wait (libxl_event.c:1396) ==8655== by 0x805CC67: create_domain (xl_cmdimpl.c:1698) ==8655== by 0x805E001: main_create (xl_cmdimpl.c:3986) ==8655== by 0x804D43D: main (xl.c:285) Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: do not "panic" if a kernel is not a bzImage.Ian Campbell2012-06-081-4/+2
| | | | | | | | | | Up until the point where we think this is a bzImage there is no point in printing panicy messages -- some other loader will have a go (probably the compressed ELF one) Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: [CVE-2011-1583] pv kernel image validationIan Jackson2011-05-091-44/+95
| | | | | | | | | | | | | | | | | | | | | | The functions which interpret the kernel image supplied for a paravirtualised guest, and decompress it into memory when booting the domain, are incautious. Specifically: (i) Integer overflow in the decompression loop memory allocator might result in overrunning the buffer used for the decompressed image; (ii) Integer overflows and lack of checking of certain length fields can result in the loader reading its own address space beyond the size of the supplied kernel image file. (iii) Lack of error checking in the decompression loop can lead to an infinite loop. This patch fixes these problems. CVE-2011-1583. Signed-off-by: Ian Campbell <Ian.Campbell@eu.citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: move error checking next to the function which returned the error.Ian Campbell2011-03-111-11/+16
| | | | | Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* Add DomU xz kernel decompressionJan Beulich2011-03-091-23/+61
| | | | Signed-off-by: Jan Beulich <jbeulich@novell.com>
* libxc: increase lzma max memory constant to 128MbyIan Jackson2011-02-111-1/+1
| | | | | | | | | | | According to lzma's configure.ac (!) the minimum memory limit to cope with arbitrary input is 128Mby (!) This is obviously an unreasonable amount of memory for this kind of task, but we need to increase the constant limit for it not to randomly fail. So do so. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: Do not use dom0 physmem as parameter to lzma decoderIan Jackson2011-01-281-1/+1
| | | | | | | | | | | | | | | | | | It's not clear why a userspace lzma decode would want to use that particular value, what bearing it has on anything or why it would assume it could use 1/3 of the total RAM in the system (potentially quite a large amount of RAM) as opposed to any other limit number. Instead, hardcode 32Mby. This reverts 22830:c80960244942, removes the xc_get_physmem/physmem function entirely, and replaces the expression at the call site with a fixed constant. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Acked-by: Ian Campbell <Ian.Campbell@eu.citrix.com> Cc: Christoph Egger <Christoph.Egger@amd.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: break xc_get_physmem out into os-dependent filesChristoph Egger2011-01-271-22/+1
| | | | | | | | | | | NetBSD doesn't have sysconf(_SC_PHYS_PAGES). Factor physmem() out into os-dependent files and rename it to xc_get_physmem() so as not to pollute the namespace. Signed-off-by: Christoph Egger <Christoph.Egger@amd.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Jackson <ian.jackson@eu.citrix.com>
* # HG changeset patchIan Campbell2010-08-241-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | # User Ian Campbell <ian.campbell@citrix.com> # Date 1282671421 -3600 # Node ID d1dd29a470ef1b9d2c77478a123326036dfe90bb # Parent d7a4adad9c328decbd384d87b23001aea8951b86 tools/libxc, tools/libelf: Relicense under LGPL v2.1 Relicense these two libraries under LGPL v2.1 only except where individual files already included the "or later" provision. Copyright holders have been contacted by Stephen Spector and have all agreed this change. Removed tools/libxc/ia64/aclinux.h since it appeared to be unused. There is a separate, more up to date, copy in xen/include/acpi/platform/aclinux.h which does appear to be used. Clarify the license of MiniOS privcmd.h under the same terms as other tools/include/xen-sys headers. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Acked-by: Stephen Spector <stephen.spector@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* Allow LZO compressed bzImage to be used as DomU kernelKeir Fraser2010-06-151-0/+193
| | | | | | | ... since recently Linux added this as another kernel compression method. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* libxc: eliminate static variables, use xentoollog; API changeKeir Fraser2010-05-281-35/+34
| | | | | | | | | | | | | | | | | | | | This patch eliminate the global variables in libxenctrl (used for logging and error reporting). Instead the information which was in the global variables is now in a new xc_interface* opaque structure, which xc_interface open returns instead of the raw file descriptor; furthermore, logging is done via xentoollog. There are three new parameters to xc_interface_open to control the logging, but existing callers can just pass "0" for all three to get the old behaviour. All libxc callers have been adjusted accordingly. Also update QEMU_TAG for corresponding qemu change. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
* libxc: Minor tools bzip2/lzma decompression fixesKeir Fraser2009-11-231-16/+22
| | | | | | | | | | The attached patch cleans up a few minor problems in the bzip2/lzma decompression support, pointed out by Jiri in internal review. In particular, it fixes a possible memory leak on realloc() error, it fixes a shifting typo, and it changes the xc_dom_printf()'s to be a bit clearly about which compression routine is in-use. Signed-off-by: Chris Lalancette <clalance@redhat.com>
* libxc: More LZMA/BZIP fixes.Keir Fraser2009-08-241-1/+1
| | | | | | | | | - Fix an error message in xc_try_bzip2_decode() - Check library installation on demand using a Makefile function, rather than generating a dependency file. Cleaner and avoids a race on generating the dep file. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* domain builder: Implement bzip2 and LZMA loadersKeir Fraser2009-08-201-57/+329
| | | | | | | | | | | Recent upstream kernels can be compressed using either gzip, bzip2, or LZMA. However, the PV kernel loader in Xen currently only understands gzip, and will fail on the other two types. The attached patch implements kernel decompression for gzip, bzip2, and LZMA so that kernels compressed with any of these methods can be launched. Signed-off-by: Chris Lalancette <clalance@redhat.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86: Support loading Linux bzImage v2.08 and up.Keir Fraser2008-04-011-0/+159
The latest -mm kernel (2.6.25-rc3-mm1) contains v2.08 of the Linux bzImage format which embeds an ELF file in place of the raw payload allowing it to be extracted and used by the Xen domain builder. It is expected that this functionality will be put forward for 2.6.26. Signed-off-by : Ian Campbell <ijc@hellion.org.uk>