aboutsummaryrefslogtreecommitdiffstats
path: root/xen/common/unlzma.c
Commit message (Collapse)AuthorAgeFilesLines
* libxc: Add unsafe decompressorsBastian Blank2013-04-221-0/+2
| | | | | | | | | | | | | | | | | | | | 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>
* decompressors: fix string typo 'bufer'Paul Bolle2012-01-231-1/+1
| | | | | | Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Signed-off-by: Jan Beulich <jbeulich@suse.com> Committed-by: Jan Beulich <jbeulich@suse.com>
* Decompressors: validate match distance in unlzma.cLasse Collin2011-11-111-0/+3
| | | | | | | | | | | | | From: Lasse Collin <lasse.collin@tukaani.org> Validate the newly decoded distance (rep0) in process_bit1(). This is to detect corrupt LZMA data quickly. The old code can run for long time producing garbage until it hits the end of the input. Signed-off-by: Lasse Collin <lasse.collin@tukaani.org> Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Committed-by: Jan Beulich <jbeulich@suse.com>
* Decompressors: check for write errors in unlzma.cLasse Collin2011-11-111-21/+32
| | | | | | | | | | | | | | | | | From: Lasse Collin <lasse.collin@tukaani.org> The return value of wr->flush() is not checked in write_byte(). This means that the decompressor won't stop even if the caller doesn't want more data. This can happen e.g. with corrupt LZMA-compressed initramfs. Returning the error quickly allows the user to see the error message quicker. There is a similar missing check for wr.flush() near the end of unlzma(). Signed-off-by: Lasse Collin <lasse.collin@tukaani.org> Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Committed-by: Jan Beulich <jbeulich@suse.com>
* Decompressors: check for read errors in unlzma.cLasse Collin2011-11-111-0/+3
| | | | | | | | | | | | | | | | | | | | | From: Lasse Collin <lasse.collin@tukaani.org> Return value of rc->fill() is checked in rc_read() and error() is called when needed, but then the code continues as if nothing had happened. rc_read() is a void function and it's on the top of performance critical call stacks, so propagating the error code via return values doesn't sound like the best fix. It seems better to check rc->buffer_size (which holds the return value of rc->fill()) in the main loop. It does nothing bad that the code runs a little with unknown data after a failed rc->fill(). This fixes an infinite loop in initramfs decompression if the LZMA-compressed initramfs image is corrupt. Signed-off-by: Lasse Collin <lasse.collin@tukaani.org> Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Committed-by: Jan Beulich <jbeulich@suse.com>
* Decompressors: fix header validation in unlzma.cLasse Collin2011-11-111-1/+3
| | | | | | | | | | | | | From: Lasse Collin <lasse.collin@tukaani.org> Validation of header.pos calls error() but doesn't make the function return to indicate an error to the caller. Instead the decoding is attempted with invalid header.pos. This fixes it. Signed-off-by: Lasse Collin <lasse.collin@tukaani.org> Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Committed-by: Jan Beulich <jbeulich@suse.com>
* Decompressors: remove unused function from unlzma.cLasse Collin2011-11-111-6/+0
| | | | | | | | | From: Lasse Collin <lasse.collin@tukaani.org> Signed-off-by: Lasse Collin <lasse.collin@tukaani.org> Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Committed-by: Jan Beulich <jbeulich@suse.com>
* Decompressors: get rid of set_error_fn() macroLasse Collin2011-11-111-3/+4
| | | | | | | | | | | | | | From: Lasse Collin <lasse.collin@tukaani.org> set_error_fn() is a useless complication. Only unlzma.c had some use for it and that was easy to change too. This also gets rid of the static function pointer "error". Signed-off-by: Lasse Collin <lasse.collin@tukaani.org> Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org> Committed-by: Jan Beulich <jbeulich@suse.com>
* Move more kernel decompression bits to .init.* sectionsJan Beulich2011-03-091-1/+1
| | | | | | | | Based on how c/s 22986:076b63b74cf6 changed xen/libelf/Makefile I suppose this is compatibile with those clang/llvm changes, but I didn't actually test it. Signed-off-by: Jan Beulich <jbeulich@novell.com>
* unlzma: Remove 'inline' decl from non-static function.Keir Fraser2009-11-091-6/+6
| | | | | | Breaks the build with some versions of gcc. Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
* x86/dom0: support bzip2 and lzma compressed bzImage payloadsKeir Fraser2009-11-091-0/+647
This matches functionality in the tools already supporting the same for DomU-s. Code taken from Linux 2.6.32-rc and adjusted as little as possible to be usable in Xen. The question is whether, particularly for non-Linux Dom0-s, plain ELF images compressed by bzip2 or lzma should also be supported. Signed-off-by: Jan Beulich <jbeulich@novell.com>