24 May, 2019

1 commit

  • Based on 1 normalized pattern(s):

    library are free software you can redistribute them and or modify
    them under the terms of the gnu general public license as published
    by the free software foundation either version 2 of the license or
    at your option any later version this program is distributed in the
    hope that it will be useful but without any warranty without even
    the implied warranty of merchantability or fitness for a particular
    purpose see the gnu general public license for more details you
    should have received a copy of the gnu general public license along
    with this program see the file copying if not write to the free
    software foundation inc 59 temple place suite 330 boston ma 02111
    1307 usa

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-or-later

    has been chosen to replace the boilerplate/reference in 1 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Richard Fontana
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190520075212.429390570@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

11 Sep, 2015

1 commit

  • When loading x86 64bit kernel above 4GiB with patched grub2, got kernel
    gunzip error.

    | early console in decompress_kernel
    | decompress_kernel:
    | input: [0x807f2143b4-0x807ff61aee]
    | output: [0x807cc00000-0x807f3ea29b] 0x027ea29c: output_len
    | boot via startup_64
    | KASLR using RDTSC...
    | new output: [0x46fe000000-0x470138cfff] 0x0338d000: output_run_size
    | decompress: [0x46fe000000-0x47007ea29b]
    Cc: Alexandre Courbot
    Cc: Jon Medhurst
    Cc: Stephen Warren
    Cc: "H. Peter Anvin"
    Cc: Thomas Gleixner
    Cc: Ingo Molnar
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Yinghai Lu
     

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 599s

    Signed-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

    Yinghai Lu
     

21 Feb, 2013

1 commit


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

    Sascha Hauer
     

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

    Lasse Collin
     
  • 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

    Lasse Collin
     
  • 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

    Lasse Collin
     
  • 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

    Lasse Collin
     
  • 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

    Lasse Collin
     

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 occured

    Signed-off-by: Albin Tonnerre
    Tested-by: bert schulze
    Cc: "H. Peter Anvin"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Albin Tonnerre
     

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.48s

    So 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

    Albin Tonnerre