09 Aug, 2014
1 commit
-
Now with 64bit bzImage and kexec tools, we support ramdisk that size is
bigger than 2g, as we could put it above 4G.Found compressed initramfs image could not be decompressed properly. It
turns out that image length is int during decompress detection, and it
will become < 0 when length is more than 2G. Furthermore, during
decompressing len as int is used for inbuf count, that has problem too.Change len to long, that should be ok as on 32 bit platform long is
32bits.Tested with following compressed initramfs image as root with kexec.
gzip, bzip2, xz, lzma, lzop, lz4.
run time for populate_rootfs():
size name Nehalem-EX Westmere-EX Ivybridge-EX
9034400256 root_img : 26s 24s 30s
3561095057 root_img.lz4 : 28s 27s 27s
3459554629 root_img.lzo : 29s 29s 28s
3219399480 root_img.gz : 64s 62s 49s
2251594592 root_img.xz : 262s 260s 183s
2226366598 root_img.lzma: 386s 376s 277s
2901482513 root_img.bz2 : 635s 599sSigned-off-by: Yinghai Lu
Cc: "H. Peter Anvin"
Cc: Ingo Molnar
Cc: Rashika Kheria
Cc: Josh Triplett
Cc: Kyungsik Lee
Cc: P J P
Cc: Al Viro
Cc: Tetsuo Handa
Cc: "Daniel M. Weeks"
Cc: Alexandre Courbot
Cc: Jan Beulich
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
21 Feb, 2013
1 commit
-
Rename the source file to match the function name and thereby
also make room for a possible future even slightly faster
"non-safe" decompressor version.Signed-off-by: Markus F.X.J. Oberhumer
13 Jan, 2012
1 commit
-
unlzo modifies the pointer to in_buf, so we have to free the original
buffer, not the modified pointer.Signed-off-by: Sascha Hauer
Cc: Lasse Collin
Cc: Namhyung Kim
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
14 Jan, 2011
5 commits
-
Callback-to-callback decompression mode is used for initrd (not
initramfs). The LZO wrapper is broken for this use case for two reasons:- The argument validation is needlessly too strict by
requiring that "posp" is non-NULL when "fill" is non-NULL.- The buffer handling code didn't work at all for this
use case.I tested with LZO-compressed kernel, initramfs, initrd, and corrupt
(truncated) initramfs and initrd images.Signed-off-by: Lasse Collin
Cc: "H. Peter Anvin"
Cc: Alain Knaff
Cc: Albin Tonnerre
Cc: Phillip Lougher
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
The code assumes that the input is valid and not truncated. Add checks to
avoid reading past the end of the input buffer. Change the type of "skip"
from u8 to int to fix a possible integer overflow.Signed-off-by: Lasse Collin
Cc: "H. Peter Anvin"
Cc: Alain Knaff
Cc: Albin Tonnerre
Cc: Phillip Lougher
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
The return value of flush() is not checked in unlzo(). This means that
the decompressor won't stop even if the caller doesn't want more data.
This can happen e.g. with a corrupt LZO-compressed initramfs image.Signed-off-by: Lasse Collin
Cc: "H. Peter Anvin"
Cc: Alain Knaff
Cc: Albin Tonnerre
Cc: Phillip Lougher
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
Currently users of mm.h need to include to use the macros
malloc() and free() provided by mm.h. This fixes it.Signed-off-by: Lasse Collin
Cc: "H. Peter Anvin"
Cc: Alain Knaff
Cc: Albin Tonnerre
Cc: Phillip Lougher
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds -
set_error_fn() has become a useless complication after c1e7c3ae59
("bzip2/lzma/gzip: pre-boot malloc doesn't return NULL on failure") fixed
the use of error() in malloc(). Only decompress_unlzma.c had some use for
it and that was easy to change too.This also gets rid of the static function pointer "error", which
should have been marked as __initdata.Signed-off-by: Lasse Collin
Cc: "H. Peter Anvin"
Cc: Alain Knaff
Cc: Albin Tonnerre
Cc: Phillip Lougher
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
25 Apr, 2010
1 commit
-
This patch fixes 2 issues with the LZO decompressor:
- It doesn't handle the case where a block isn't compressed at all. In
this case, calling lzo1x_decompress_safe will fail, so we need to just
use memcpy() instead (the upstream LZO code does something similar)- Since commit 54291362d2a5738e1b0495df2abcb9e6b0563a3f ("initramfs: add
missing decompressor error check") , the decompressor return code is
checked in the init/initramfs.c The LZO decompressor didn't return the
expected value, causing the initramfs code to falsely believe a
decompression error occuredSigned-off-by: Albin Tonnerre
Tested-by: bert schulze
Cc: "H. Peter Anvin"
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
12 Jan, 2010
1 commit
-
This patch series adds generic support for creating and extracting
LZO-compressed kernel images, as well as support for using such images on
the x86 and ARM architectures, and support for creating and using
LZO-compressed initrd and initramfs images.Russell King said:
: Testing on a Cortex A9 model:
: - lzo decompressor is 65% of the time gzip takes to decompress a kernel
: - lzo kernel is 9% larger than a gzip kernel
:
: which I'm happy to say confirms your figures when comparing the two.
:
: However, when comparing your new gzip code to the old gzip code:
: - new is 99% of the size of the old code
: - new takes 42% of the time to decompress than the old code
:
: What this means is that for a proper comparison, the results get even better:
: - lzo is 7.5% larger than the old gzip'd kernel image
: - lzo takes 28% of the time that the old gzip code took
:
: So the expense seems definitely worth the effort. The only reason I
: can think of ever using gzip would be if you needed the additional
: compression (eg, because you have limited flash to store the image.)
:
: I would argue that the default for ARM should therefore be LZO.This patch:
The lzo compressor is worse than gzip at compression, but faster at
extraction. Here are some figures for an ARM board I'm working on:Uncompressed size: 3.24Mo
gzip 1.61Mo 0.72s
lzo 1.75Mo 0.48sSo for a compression ratio that is still relatively close to gzip, it's
much faster to extract, at least in that case.This part contains:
- Makefile routine to support lzo compression
- Fixes to the existing lzo compressor so that it can be used in
compressed kernels
- wrapper around the existing lzo1x_decompress, as it only extracts one
block at a time, while we need to extract a whole file here
- config dialog for kernel compression[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: cleanup]
Signed-off-by: Albin Tonnerre
Tested-by: Wu Zhangjin
Acked-by: "H. Peter Anvin"
Cc: Ingo Molnar
Cc: Thomas Gleixner
Tested-by: Russell King
Acked-by: Russell King
Cc: Ralf Baechle
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds