Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Commits on Jan 13, 2011
  1. @torvalds

    Decompressors: validate match distance in decompress_unlzma.c

    Lasse Collin authored torvalds committed
    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>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Alain Knaff <alain@knaff.lu>
    Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com>
    Cc: Phillip Lougher <phillip@lougher.demon.co.uk>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  2. @torvalds

    Decompressors: check for write errors in decompress_unlzma.c

    Lasse Collin authored torvalds committed
    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>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Alain Knaff <alain@knaff.lu>
    Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com>
    Cc: Phillip Lougher <phillip@lougher.demon.co.uk>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  3. @torvalds

    Decompressors: check for read errors in decompress_unlzma.c

    Lasse Collin authored torvalds committed
    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>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Alain Knaff <alain@knaff.lu>
    Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com>
    Cc: Phillip Lougher <phillip@lougher.demon.co.uk>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  4. @torvalds

    Decompressors: fix header validation in decompress_unlzma.c

    Lasse Collin authored torvalds committed
    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>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Alain Knaff <alain@knaff.lu>
    Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com>
    Cc: Phillip Lougher <phillip@lougher.demon.co.uk>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  5. @torvalds

    Decompressors: remove unused function from lib/decompress_unlzma.c

    Lasse Collin authored torvalds committed
    Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Alain Knaff <alain@knaff.lu>
    Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com>
    Cc: Phillip Lougher <phillip@lougher.demon.co.uk>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  6. @torvalds

    Decompressors: include <linux/slab.h> in <linux/decompress/mm.h>

    Lasse Collin authored torvalds committed
    Currently users of mm.h need to include <linux/slab.h> to use the macros
    malloc() and free() provided by mm.h.  This fixes it.
    
    Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Alain Knaff <alain@knaff.lu>
    Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com>
    Cc: Phillip Lougher <phillip@lougher.demon.co.uk>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  7. @torvalds

    Decompressors: get rid of set_error_fn() macro

    Lasse Collin authored torvalds committed
    set_error_fn() has become a useless complication after c1e7c3a
    ("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 <lasse.collin@tukaani.org>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Alain Knaff <alain@knaff.lu>
    Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com>
    Cc: Phillip Lougher <phillip@lougher.demon.co.uk>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  8. @torvalds

    Decompressors: add missing INIT (i.e. __init)

    Lasse Collin authored torvalds committed
    Signed-off-by: Lasse Collin <lasse.collin@tukaani.org>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Alain Knaff <alain@knaff.lu>
    Cc: Albin Tonnerre <albin.tonnerre@free-electrons.com>
    Cc: Phillip Lougher <phillip@lougher.demon.co.uk>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Commits on Sep 24, 2009
  1. @plougher @torvalds

    lzma/gzip: fix potential oops when input data is truncated

    plougher authored torvalds committed
    If the lzma/gzip decompressors are called with insufficient input data
    (len > 0 & fill = NULL), they will attempt to call the fill function to
    obtain more data, leading to a kernel oops.
    
    Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Commits on Aug 7, 2009
  1. @torvalds

    lib/decompress_*: only include <linux/slab.h> if STATIC is not defined

    Albin Tonnerre authored torvalds committed
    These includes were added by 079effb
    ("kmemtrace, kbuild: fix slab.h dependency problem in
    lib/decompress_inflate.c") to fix the build when using kmemtrace.  However
    this is not necessary when used to create a compressed kernel, and
    actually creates issues (brings a lot of things unavailable in the
    decompression environment), so don't include it if STATIC is defined.
    
    Signed-off-by: Albin Tonnerre <albin.tonnerre@free-electrons.com>
    Cc: Sam Ravnborg <sam@ravnborg.org>
    Cc: Russell King <rmk@arm.linux.org.uk>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Pekka Enberg <penberg@cs.helsinki.fi>
    Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
    Cc: Phillip Lougher <phillip@lougher.demon.co.uk>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  2. @plougher @torvalds

    bzip2/lzma: remove nasty uncompressed size hack in pre-boot environment

    plougher authored torvalds committed
    decompress_bunzip2 and decompress_unlzma have a nasty hack that subtracts
    4 from the input length if being called in the pre-boot environment.
    
    This is a nasty hack because it relies on the fact that flush = NULL only
    when called from the pre-boot environment (i.e.
    arch/x86/boot/compressed/misc.c).  initramfs.c/do_mounts_rd.c pass in a
    flush buffer (flush != NULL).
    
    This hack prevents the decompressors from being used with flush = NULL by
    other callers unless knowledge of the hack is propagated to them.
    
    This patch removes the hack by making decompress (called only from the
    pre-boot environment) a wrapper function that subtracts 4 from the input
    length before calling the decompressor.
    
    Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Commits on Apr 3, 2009
  1. kmemtrace, kbuild: fix slab.h dependency problem in lib/decompress_un…

    Pekka Enberg authored Ingo Molnar committed
    …lzma.c
    
    Impact: cleanup
    
    lib/decompress_unlzma.c depends on slab.h without including it:
    
        CC      lib/decompress_unlzma.o
      lib/decompress_unlzma.c: In function ‘rc_free’:
      lib/decompress_unlzma.c:122: error: implicit declaration of function ‘kfree’
      lib/decompress_unlzma.c: In function ‘unlzma’:
      lib/decompress_unlzma.c:551: error: implicit declaration of function ‘kmalloc’
      lib/decompress_unlzma.c:551: warning: assignment makes pointer from integer without a cast
      make[1]: *** [lib/decompress_unlzma.o] Error 1
      make: *** [lib/] Error 2
    
    It gets included implicitly currently - but this will not be the
    case with upcoming kmemtrace changes.
    
    Signed-off-by: Pekka Enberg <penberg@cs.helsinki.fi>
    Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
    LKML-Reference: <1237886521.25315.58.camel@penberg-laptop>
    Signed-off-by: Ingo Molnar <mingo@elte.hu>
Commits on Jan 4, 2009
  1. bzip2/lzma: library support for gzip, bzip2 and lzma decompression

    Alain Knaff authored H. Peter Anvin committed
    Impact: Replaces inflate.c with a wrapper around zlib_inflate; new library code
    
    This is the first part of the bzip2/lzma patch
    
    The bzip patch is based on an idea by Christian Ludwig, includes support for
    compressing the kernel with bzip2 or lzma rather than gzip. Both
    compressors give smaller sizes than gzip.  Lzma's decompresses faster
    than bzip2.
    
    It also supports ramdisks and initramfs' compressed using these two
    compressors.
    
    The functionality has been successfully used for a couple of years by
    the udpcast project
    
    This version applies to "tip" kernel 2.6.28
    
    This part contains:
    - changed inflate.c to accomodate rest of patch
    - implementation of bzip2 compression (not used at this stage yet)
    - implementation of lzma compression (not used at this stage yet)
    - Makefile routines to support bzip2 and lzma kernel compression
    
    Signed-off-by: Alain Knaff <alain@knaff.lu>
    Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Something went wrong with that request. Please try again.