linux/arch/arm/boot/compressed
Yinghai Lu 2d3862d26e lib/decompressors: use real out buf size for gunzip with kernel
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] <=== [0x807f2143b4-0x807ff61aee]
|
| Decompressing Linux... gz...
|
| uncompression error
|
| -- System halted

the new buffer is at 0x46fe000000ULL, decompressor_gzip is using
0xffffffb901ffffff as out_len.  gunzip in lib/zlib_inflate/inflate.c cap
that len to 0x01ffffff and decompress fails later.

We could hit this problem with crashkernel booting that uses kexec loading
kernel above 4GiB.

We have decompress_* support:
    1. inbuf[]/outbuf[] for kernel preboot.
    2. inbuf[]/flush() for initramfs
    3. fill()/flush() for initrd.
This bug only affect kernel preboot path that use outbuf[].

Add __decompress and take real out_buf_len for gunzip instead of guessing
wrong buf size.

Fixes: 1431574a1c (lib/decompressors: fix "no limit" output buffer length)
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Cc: Alexandre Courbot <acourbot@nvidia.com>
Cc: Jon Medhurst <tixy@linaro.org>
Cc: Stephen Warren <swarren@wwwdotorg.org>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2015-09-10 13:29:01 -07:00
..
.gitignore ARM: simplify generation of compressed vmlinux.lds file 2014-07-01 15:01:51 +01:00
Makefile ARM: shmobile: Remove obsolete zboot support 2015-07-06 09:29:45 +09:00
atags_to_fdt.c ARM: 8025/1: Get rid of meminfo 2014-06-01 01:17:12 +01:00
big-endian.S Linux-2.6.12-rc2 2005-04-16 15:20:36 -07:00
debug.S ARM: 7737/1: fix kernel decompressor compilation error with CONFIG_DEBUG_SEMIHOSTING 2013-06-05 23:32:24 +01:00
decompress.c lib/decompressors: use real out buf size for gunzip with kernel 2015-09-10 13:29:01 -07:00
head-sa1100.S ARM: 7743/1: compressed/head.S: work around new binutils warning 2013-06-05 23:32:27 +01:00
head-sharpsl.S Remove obsolete #include <linux/config.h> 2006-06-30 19:25:36 +02:00
head-xscale.S ARM: remove ixp23xx and ixp2000 platforms 2012-04-06 08:26:18 -05:00
head.S ARM: replace BSYM() with badr assembly macro 2015-05-08 17:33:50 +01:00
libfdt_env.h libfdt: add fdt type definitions 2015-04-29 17:17:17 -05:00
ll_char_wr.S [ARM] Remove LOADREGS macro 2006-06-25 11:23:45 +01:00
misc.c stackprotector: Introduce CONFIG_CC_STACKPROTECTOR_STRONG 2013-12-20 09:38:40 +01:00
piggy.gzip.S arm: add support for LZO-compressed kernels 2010-01-11 09:34:05 -08:00
piggy.lz4.S arm: add support for LZ4-compressed kernel 2013-07-09 10:33:30 -07:00
piggy.lzma.S ARM: 6026/1: ARM: Add support for LZMA-compressed kernel images 2010-04-14 12:05:36 +01:00
piggy.lzo.S arm: add support for LZO-compressed kernels 2010-01-11 09:34:05 -08:00
piggy.xzkern.S ARM: 7001/2: Wire up support for the XZ decompressor 2012-03-24 09:38:52 +00:00
string.c ARM: zImage: gather some string functions into string.c 2011-09-14 13:51:58 -04:00
vmlinux.lds.S ARM: simplify generation of compressed vmlinux.lds file 2014-07-01 15:01:51 +01:00